diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b1d39af556..e8f4ad5511 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -48,8 +48,8 @@ jobs: cp -pR panda/ opendbc/ cereal/ $TEST_DIR # need this to build on x86 - cp -pR --parents phonelibs/capnp-cpp phonelibs/zmq phonelibs/libyuv phonelibs/snpe \ - external/bin external/capnp selfdrive/modeld/runners $TEST_DIR + cp -pR --parents phonelibs/libyuv phonelibs/snpe \ + external/bin selfdrive/modeld/runners $TEST_DIR # need these so docker copy won't fail cp Pipfile Pipfile.lock flake8_openpilot.sh pylint_openpilot.sh .pylintrc \ @@ -198,4 +198,3 @@ jobs: run: | docker commit tmppilot tmppilotci $CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -Z -F test_car_models" - diff --git a/Dockerfile.openpilot b/Dockerfile.openpilot index e2815189d7..2a7964aa21 100644 --- a/Dockerfile.openpilot +++ b/Dockerfile.openpilot @@ -5,6 +5,8 @@ RUN apt-get update && apt-get install -y \ autoconf \ build-essential \ bzip2 \ + capnproto \ + libcapnp-dev \ clang \ cmake \ curl \ @@ -27,7 +29,8 @@ RUN apt-get update && apt-get install -y \ libsqlite3-dev \ libtool \ libusb-1.0-0-dev \ - libzmq5-dev \ + libczmq-dev \ + libzmq3-dev \ locales \ ocl-icd-libopencl1 \ ocl-icd-opencl-dev \ @@ -67,6 +70,7 @@ ENV PATH="/tmp/openpilot/external/bin:${PATH}" ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH} RUN mkdir -p /tmp/openpilot + COPY ./flake8_openpilot.sh /tmp/openpilot/ COPY ./pylint_openpilot.sh /tmp/openpilot/ COPY ./.pylintrc /tmp/openpilot/ diff --git a/SConstruct b/SConstruct index aac002d13a..8630175a31 100644 --- a/SConstruct +++ b/SConstruct @@ -43,10 +43,9 @@ if arch == "aarch64" or arch == "larch64": ] if arch == "larch64": - cpppath += ["#phonelibs/capnp-cpp/include"] libpath += ["#phonelibs/snpe/larch64"] libpath += ["#phonelibs/libyuv/larch64/lib"] - libpath += ["#external/capnparm/lib", "/usr/lib/aarch64-linux-gnu"] + libpath += ["/usr/lib/aarch64-linux-gnu"] cflags = ["-DQCOM2", "-mcpu=cortex-a57"] cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"] rpath = ["/usr/local/lib"] @@ -62,14 +61,11 @@ else: "PATH": "#external/bin:" + os.environ['PATH'], } cpppath = [ - "#phonelibs/capnp-cpp/include", - "#phonelibs/zmq/x64/include", "#external/tensorflow/include", ] if arch == "Darwin": libpath = [ - "#phonelibs/capnp-cpp/mac/lib", "#phonelibs/libyuv/mac/lib", "#cereal", "#selfdrive/common", @@ -78,11 +74,8 @@ else: ] else: libpath = [ - "#phonelibs/capnp-cpp/x64/lib", "#phonelibs/snpe/x86_64-linux-clang", - "#phonelibs/zmq/x64/lib", "#phonelibs/libyuv/x64/lib", - "#external/zmq/lib", "#external/tensorflow/lib", "#cereal", "#selfdrive/common", @@ -90,8 +83,7 @@ else: "/usr/local/lib", ] - rpath = ["phonelibs/capnp-cpp/x64/lib", - "phonelibs/zmq/x64/lib", + rpath = [ "external/tensorflow/lib", "cereal", "selfdrive/common"] @@ -189,10 +181,7 @@ def abspath(x): return x[0].path.rsplit("/", 1)[1][:-3] # still needed for apks -if arch == 'larch64': - zmq = 'zmq' -else: - zmq = FindFile("libzmq.a", libpath) +zmq = 'zmq' Export('env', 'arch', 'zmq', 'SHARED', 'webcam') # cereal and messaging are shared with the system diff --git a/cereal b/cereal index 12aad06e12..775f09de45 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit 12aad06e12f249e57abda1664fb0c85e484a0c5d +Subproject commit 775f09de45353773f1fa697048be11c8317324b5 diff --git a/external/bin/capnp b/external/bin/capnp deleted file mode 120000 index 4fa0c5d67d..0000000000 --- a/external/bin/capnp +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnp \ No newline at end of file diff --git a/external/bin/capnpc b/external/bin/capnpc deleted file mode 120000 index 833204686c..0000000000 --- a/external/bin/capnpc +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnpc \ No newline at end of file diff --git a/external/bin/capnpc-c b/external/bin/capnpc-c deleted file mode 120000 index 5f36acd2aa..0000000000 --- a/external/bin/capnpc-c +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnpc-c \ No newline at end of file diff --git a/external/bin/capnpc-c++ b/external/bin/capnpc-c++ deleted file mode 120000 index c63802a798..0000000000 --- a/external/bin/capnpc-c++ +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnpc-c++ \ No newline at end of file diff --git a/external/bin/capnpc-capnp b/external/bin/capnpc-capnp deleted file mode 120000 index 6ce8504c1f..0000000000 --- a/external/bin/capnpc-capnp +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnpc-capnp \ No newline at end of file diff --git a/external/bin/capnpc-java b/external/bin/capnpc-java deleted file mode 120000 index 62e7133c48..0000000000 --- a/external/bin/capnpc-java +++ /dev/null @@ -1 +0,0 @@ -../capnp/bin/capnpc-java \ No newline at end of file diff --git a/external/capnp/.gitignore b/external/capnp/.gitignore deleted file mode 100644 index 30acc8dd7a..0000000000 --- a/external/capnp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -capnproto-c++-0.6.1* diff --git a/external/capnp/bin/capnp b/external/capnp/bin/capnp deleted file mode 100755 index 5d12ba79d6..0000000000 Binary files a/external/capnp/bin/capnp and /dev/null differ diff --git a/external/capnp/bin/capnpc b/external/capnp/bin/capnpc deleted file mode 120000 index 5668473f09..0000000000 --- a/external/capnp/bin/capnpc +++ /dev/null @@ -1 +0,0 @@ -capnp \ No newline at end of file diff --git a/external/capnp/bin/capnpc-c b/external/capnp/bin/capnpc-c deleted file mode 100755 index 657d51de88..0000000000 Binary files a/external/capnp/bin/capnpc-c and /dev/null differ diff --git a/external/capnp/bin/capnpc-c++ b/external/capnp/bin/capnpc-c++ deleted file mode 100755 index bb18064839..0000000000 Binary files a/external/capnp/bin/capnpc-c++ and /dev/null differ diff --git a/external/capnp/bin/capnpc-capnp b/external/capnp/bin/capnpc-capnp deleted file mode 100755 index a645fe78f3..0000000000 Binary files a/external/capnp/bin/capnpc-capnp and /dev/null differ diff --git a/external/capnp/bin/capnpc-java b/external/capnp/bin/capnpc-java deleted file mode 100755 index 55af5b5763..0000000000 Binary files a/external/capnp/bin/capnpc-java and /dev/null differ diff --git a/external/capnp/build.sh b/external/capnp/build.sh deleted file mode 100755 index 6fdf4f65e2..0000000000 --- a/external/capnp/build.sh +++ /dev/null @@ -1,32 +0,0 @@ -set -e -echo "Installing capnp" - -ONE=${HOME}/openpilot -VERSION=0.6.1 -wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz -tar xvf capnproto-c++-${VERSION}.tar.gz -cd capnproto-c++-${VERSION} -CXXFLAGS="-fPIC" ./configure --prefix=${ONE}/external/capnp -make -j9 - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - - -make -j4 install - -# -------- -echo "Installing java-capnp" - -git clone https://github.com/dwrensha/capnproto-java.git -cd capnproto-java -git reset --hard 2c43bd712fb218da0eabdf241a750b9c05903e8e -g++ compiler/src/main/cpp/capnpc-java.c++ -std=c++11 -pthread -I${ONE}/external/capnp/include -L${ONE}/external/capnp/lib -l:libcapnp.a -l:libkj.a -pthread -lpthread -o capnpc-java -cp capnpc-java ${ONE}/external/capnp/bin/ - -rm -rf capnproto-c++-${VERSION}.tar.gz -rm -rf capnproto-c++-${VERSION} diff --git a/external/capnp/include/capnp/any.h b/external/capnp/include/capnp/any.h deleted file mode 100644 index 6df9dc8dc2..0000000000 --- a/external/capnp/include/capnp/any.h +++ /dev/null @@ -1,1073 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ANY_H_ -#define CAPNP_ANY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "pointer-helpers.h" -#include "orphan.h" -#include "list.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -class InterfaceSchema; -class Orphanage; -class ClientHook; -class PipelineHook; -struct PipelineOp; -struct AnyPointer; - -struct AnyList { - AnyList() = delete; - - class Reader; - class Builder; -}; - -struct AnyStruct { - AnyStruct() = delete; - - class Reader; - class Builder; - class Pipeline; -}; - -template<> -struct List { - List() = delete; - - class Reader; - class Builder; -}; - -namespace _ { // private -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -} // namespace _ (private) - -// ======================================================================================= -// AnyPointer! - -enum class Equality { - NOT_EQUAL, - EQUAL, - UNKNOWN_CONTAINS_CAPS -}; - -kj::StringPtr KJ_STRINGIFY(Equality res); - -struct AnyPointer { - // Reader/Builder for the `AnyPointer` field type, i.e. a pointer that can point to an arbitrary - // object. - - AnyPointer() = delete; - - class Reader { - public: - typedef AnyPointer Reads; - - Reader() = default; - inline Reader(_::PointerReader reader): reader(reader) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType() const; - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() const { return getPointerType() == PointerType::STRUCT; } - inline bool isList() const { return getPointerType() == PointerType::LIST; } - inline bool isCapability() const { return getPointerType() == PointerType::CAPABILITY; } - - Equality equals(AnyPointer::Reader right); - bool operator==(AnyPointer::Reader right); - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - template - inline ReaderFor getAs() const; - // Valid for T = any generated struct type, interface type, List, Text, or Data. - - template - inline ReaderFor getAs(StructSchema schema) const; - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline ReaderFor getAs(ListSchema schema) const; - // Only valid for T = DynamicList. Requires `#include `. - - template - inline ReaderFor getAs(InterfaceSchema schema) const; - // Only valid for T = DynamicCapability. Requires `#include `. - -#if !CAPNP_LITE - kj::Own getPipelinedCap(kj::ArrayPtr ops) const; - // Used by RPC system to implement pipelining. Applications generally shouldn't use this - // directly. -#endif // !CAPNP_LITE - - private: - _::PointerReader reader; - friend struct AnyPointer; - friend class Orphanage; - friend class CapReaderContext; - friend struct _::PointerHelpers; - }; - - class Builder { - public: - typedef AnyPointer Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline Builder(_::PointerBuilder builder): builder(builder) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType(); - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() { return getPointerType() == PointerType::STRUCT; } - inline bool isList() { return getPointerType() == PointerType::LIST; } - inline bool isCapability() { return getPointerType() == PointerType::CAPABILITY; } - - inline Equality equals(AnyPointer::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyPointer::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - inline void clear(); - // Set to null. - - template - inline BuilderFor getAs(); - // Valid for T = any generated struct type, List, Text, or Data. - - template - inline BuilderFor getAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor getAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline BuilderFor getAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - template - inline BuilderFor initAs(); - // Valid for T = any generated struct type. - - template - inline BuilderFor initAs(uint elementCount); - // Valid for T = List, Text, or Data. - - template - inline BuilderFor initAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor initAs(ListSchema schema, uint elementCount); - // Only valid for T = DynamicList. Requires `#include `. - - inline AnyList::Builder initAsAnyList(ElementSize elementSize, uint elementCount); - // Note: Does not accept INLINE_COMPOSITE for elementSize. - - inline List::Builder initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount); - - inline AnyStruct::Builder initAsAnyStruct(uint16_t dataWordCount, uint16_t pointerCount); - - template - inline void setAs(ReaderFor value); - // Valid for ReaderType = T::Reader for T = any generated struct type, List, Text, Data, - // DynamicStruct, or DynamicList (the dynamic types require `#include `). - - template - inline void setAs(std::initializer_list>> list); - // Valid for T = List. - - template - inline void setCanonicalAs(ReaderFor value); - - inline void set(Reader value) { builder.copyFrom(value.reader); } - // Set to a copy of another AnyPointer. - - inline void setCanonical(Reader value) { builder.copyFrom(value.reader, true); } - - template - inline void adopt(Orphan&& orphan); - // Valid for T = any generated struct type, List, Text, Data, DynamicList, DynamicStruct, - // or DynamicValue (the dynamic types require `#include `). - - template - inline Orphan disownAs(); - // Valid for T = any generated struct type, List, Text, Data. - - template - inline Orphan disownAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline Orphan disownAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline Orphan disownAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - inline Orphan disown(); - // Disown without a type. - - inline Reader asReader() const { return Reader(builder.asReader()); } - inline operator Reader() const { return Reader(builder.asReader()); } - - private: - _::PointerBuilder builder; - friend class Orphanage; - friend class CapBuilderContext; - friend struct _::PointerHelpers; - }; - -#if !CAPNP_LITE - class Pipeline { - public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)) {} - inline explicit Pipeline(kj::Own&& hook): hook(kj::mv(hook)) {} - - Pipeline noop(); - // Just make a copy. - - Pipeline getPointerField(uint16_t pointerIndex); - // Deprecated. In the future, we should use .asAnyStruct.getPointerField. - - inline AnyStruct::Pipeline asAnyStruct(); - - kj::Own asCap(); - // Expect that the result is a capability and construct a pipelined version of it now. - - inline kj::Own releasePipelineHook() { return kj::mv(hook); } - // For use by RPC implementations. - - template ) == Kind::INTERFACE>> - inline operator T() { return T(asCap()); } - - private: - kj::Own hook; - kj::Array ops; - - inline Pipeline(kj::Own&& hook, kj::Array&& ops) - : hook(kj::mv(hook)), ops(kj::mv(ops)) {} - - friend class LocalClient; - friend class PipelineHook; - friend class AnyStruct::Pipeline; - }; -#endif // !CAPNP_LITE -}; - -template <> -class Orphan { - // An orphaned object of unknown type. - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder) - : builder(kj::mv(builder)) {} - - Orphan& operator=(Orphan&&) = default; - - template - inline Orphan(Orphan&& other): builder(kj::mv(other.builder)) {} - template - inline Orphan& operator=(Orphan&& other) { builder = kj::mv(other.builder); return *this; } - // Cast from typed orphan. - - // It's not possible to get an AnyPointer::{Reader,Builder} directly since there is no - // underlying pointer (the pointer would normally live in the parent, but this object is - // orphaned). It is possible, however, to request typed readers/builders. - - template - inline BuilderFor getAs(); - template - inline BuilderFor getAs(StructSchema schema); - template - inline BuilderFor getAs(ListSchema schema); - template - inline typename T::Client getAs(InterfaceSchema schema); - template - inline ReaderFor getAsReader() const; - template - inline ReaderFor getAsReader(StructSchema schema) const; - template - inline ReaderFor getAsReader(ListSchema schema) const; - template - inline typename T::Client getAsReader(InterfaceSchema schema) const; - - template - inline Orphan releaseAs(); - template - inline Orphan releaseAs(StructSchema schema); - template - inline Orphan releaseAs(ListSchema schema); - template - inline Orphan releaseAs(InterfaceSchema schema); - // Down-cast the orphan to a specific type. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend class Orphan; - friend class AnyPointer::Builder; -}; - -template struct AnyTypeFor_; -template <> struct AnyTypeFor_ { typedef AnyStruct Type; }; -template <> struct AnyTypeFor_ { typedef AnyList Type; }; - -template -using AnyTypeFor = typename AnyTypeFor_::Type; - -template -inline ReaderFor>> toAny(T&& value) { - return ReaderFor>>( - _::PointerHelpers>::getInternalReader(value)); -} -template -inline BuilderFor>> toAny(T&& value) { - return BuilderFor>>( - _::PointerHelpers>::getInternalBuilder(kj::mv(value))); -} - -template <> -struct List { - // Note: This cannot be used for a list of structs, since such lists are not encoded as pointer - // lists! Use List. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyPointer::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyPointer::Reader(reader.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::POINTER) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyPointer::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyPointer::Builder(builder.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; -}; - -class AnyStruct::Reader { -public: - typedef AnyStruct Reads; - - Reader() = default; - inline Reader(_::StructReader reader): _reader(reader) {} - - template ) == Kind::STRUCT>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} - - kj::ArrayPtr getDataSection() { - return _reader.getDataSectionAsBlob(); - } - List::Reader getPointerSection() { - return List::Reader(_reader.getPointerSectionAsList()); - } - - kj::Array canonicalize() { - return _reader.canonicalize(); - } - - Equality equals(AnyStruct::Reader right); - bool operator==(AnyStruct::Reader right); - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - template - ReaderFor as() const { - // T must be a struct type. - return typename T::Reader(_reader); - } -private: - _::StructReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyStruct::Builder { -public: - typedef AnyStruct Builds; - - inline Builder(decltype(nullptr)) {} - inline Builder(_::StructBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::STRUCT>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline kj::ArrayPtr getDataSection() { - return _builder.getDataSectionAsBlob(); - } - List::Builder getPointerSection() { - return List::Builder(_builder.getPointerSectionAsList()); - } - - inline Equality equals(AnyStruct::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyStruct::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - - template - BuilderFor as() { - // T must be a struct type. - return typename T::Builder(_builder); - } -private: - _::StructBuilder _builder; - friend class Orphanage; - friend class CapBuilderContext; -}; - -#if !CAPNP_LITE -class AnyStruct::Pipeline { -public: - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - inline explicit Pipeline(AnyPointer::Pipeline&& typeless) - : typeless(kj::mv(typeless)) {} - - inline AnyPointer::Pipeline getPointerField(uint16_t pointerIndex) { - // Return a new Promise representing a sub-object of the result. `pointerIndex` is the index - // of the sub-object within the pointer section of the result (the result must be a struct). - // - // TODO(perf): On GCC 4.8 / Clang 3.3, use rvalue qualifiers to avoid the need for copies. - // Also make `ops` into a Vector to optimize this. - return typeless.getPointerField(pointerIndex); - } - -private: - AnyPointer::Pipeline typeless; -}; -#endif // !CAPNP_LITE - -class List::Reader { -public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyStruct::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyStruct::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class List::Builder { -public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::INLINE_COMPOSITE) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyStruct::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyStruct::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - -private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class AnyList::Reader { -public: - typedef AnyList Reads; - - inline Reader(): _reader(ElementSize::VOID) {} - inline Reader(_::ListReader reader): _reader(reader) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _reader.getElementSize(); } - inline uint size() { return unbound(_reader.size() / ELEMENTS); } - - inline kj::ArrayPtr getRawBytes() { return _reader.asRawBytes(); } - - Equality equals(AnyList::Reader right); - bool operator==(AnyList::Reader right); - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template ReaderFor as() { - // T must be List. - return ReaderFor(_reader); - } -private: - _::ListReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyList::Builder { -public: - typedef AnyList Builds; - - inline Builder(decltype(nullptr)): _builder(ElementSize::VOID) {} - inline Builder(_::ListBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _builder.getElementSize(); } - inline uint size() { return unbound(_builder.size() / ELEMENTS); } - - Equality equals(AnyList::Reader right); - inline bool operator==(AnyList::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template BuilderFor as() { - // T must be List. - return BuilderFor(_builder); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - -private: - _::ListBuilder _builder; - - friend class Orphanage; -}; - -// ======================================================================================= -// Pipeline helpers -// -// These relate to capabilities, but we don't declare them in capability.h because generated code -// for structs needs to know about these, even in files that contain no interfaces. - -#if !CAPNP_LITE - -struct PipelineOp { - // Corresponds to rpc.capnp's PromisedAnswer.Op. - - enum Type { - NOOP, // for convenience - - GET_POINTER_FIELD - - // There may be other types in the future... - }; - - Type type; - union { - uint16_t pointerIndex; // for GET_POINTER_FIELD - }; -}; - -class PipelineHook { - // Represents a currently-running call, and implements pipelined requests on its result. - -public: - virtual kj::Own addRef() = 0; - // Increment this object's reference count. - - virtual kj::Own getPipelinedCap(kj::ArrayPtr ops) = 0; - // Extract a promised Capability from the results. - - virtual kj::Own getPipelinedCap(kj::Array&& ops); - // Version of getPipelinedCap() passing the array by move. May avoid a copy in some cases. - // Default implementation just calls the other version. - - template > - static inline kj::Own from(Pipeline&& pipeline); - -private: - template struct FromImpl; -}; - -#endif // !CAPNP_LITE - -// ======================================================================================= -// Inline implementation details - -inline MessageSize AnyPointer::Reader::targetSize() const { - return reader.targetSize().asPublic(); -} - -inline PointerType AnyPointer::Reader::getPointerType() const { - return reader.getPointerType(); -} - -template -inline ReaderFor AnyPointer::Reader::getAs() const { - return _::PointerHelpers::get(reader); -} - -inline MessageSize AnyPointer::Builder::targetSize() const { - return asReader().targetSize(); -} - -inline PointerType AnyPointer::Builder::getPointerType() { - return builder.getPointerType(); -} - -inline void AnyPointer::Builder::clear() { - return builder.clear(); -} - -template -inline BuilderFor AnyPointer::Builder::getAs() { - return _::PointerHelpers::get(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs() { - return _::PointerHelpers::init(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs(uint elementCount) { - return _::PointerHelpers::init(builder, elementCount); -} - -inline AnyList::Builder AnyPointer::Builder::initAsAnyList( - ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList(elementSize, bounded(elementCount) * ELEMENTS)); -} - -inline List::Builder AnyPointer::Builder::initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return List::Builder(builder.initStructList(bounded(elementCount) * ELEMENTS, - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -inline AnyStruct::Builder AnyPointer::Builder::initAsAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -template -inline void AnyPointer::Builder::setAs(ReaderFor value) { - return _::PointerHelpers::set(builder, value); -} - -template -inline void AnyPointer::Builder::setCanonicalAs(ReaderFor value) { - return _::PointerHelpers::setCanonical(builder, value); -} - -template -inline void AnyPointer::Builder::setAs( - std::initializer_list>> list) { - return _::PointerHelpers::set(builder, list); -} - -template -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - _::PointerHelpers::adopt(builder, kj::mv(orphan)); -} - -template -inline Orphan AnyPointer::Builder::disownAs() { - return _::PointerHelpers::disown(builder); -} - -inline Orphan AnyPointer::Builder::disown() { - return Orphan(builder.disown()); -} - -template <> struct ReaderFor_ { typedef AnyPointer::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyPointer::Builder Type; }; -template <> struct ReaderFor_ { typedef AnyStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyStruct::Builder Type; }; - -template <> -struct Orphanage::GetInnerReader { - static inline _::PointerReader apply(const AnyPointer::Reader& t) { - return t.reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::PointerBuilder apply(AnyPointer::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const AnyStruct::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(AnyStruct::Builder& t) { - return t._builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const AnyList::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(AnyList::Builder& t) { - return t._builder; - } -}; - -template -inline BuilderFor Orphan::getAs() { - return _::OrphanGetImpl::apply(builder); -} -template -inline ReaderFor Orphan::getAsReader() const { - return _::OrphanGetImpl::applyReader(builder); -} -template -inline Orphan Orphan::releaseAs() { - return Orphan(kj::mv(builder)); -} - -// Using AnyPointer as the template type should work... - -template <> -inline typename AnyPointer::Reader AnyPointer::Reader::getAs() const { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::getAs() { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::initAs() { - clear(); - return *this; -} -template <> -inline void AnyPointer::Builder::setAs(AnyPointer::Reader value) { - return builder.copyFrom(value.reader); -} -template <> -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - builder.adopt(kj::mv(orphan.builder)); -} -template <> -inline Orphan AnyPointer::Builder::disownAs() { - return Orphan(builder.disown()); -} -template <> -inline Orphan Orphan::releaseAs() { - return kj::mv(*this); -} - -namespace _ { // private - -// Specialize PointerHelpers for AnyPointer. - -template <> -struct PointerHelpers { - static inline AnyPointer::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Reader(reader); - } - static inline AnyPointer::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Builder(builder); - } - static inline void set(PointerBuilder builder, AnyPointer::Reader value) { - AnyPointer::Builder(builder).set(value); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::PointerReader getInternalReader(const AnyPointer::Reader& reader) { - return reader.reader; - } - static inline _::PointerBuilder getInternalBuilder(AnyPointer::Builder&& builder) { - return builder.builder; - } -}; - -template <> -struct PointerHelpers { - static inline AnyStruct::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyStruct::Reader(reader.getStruct(defaultValue)); - } - static inline AnyStruct::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - // TODO(someday): Allow specifying the size somehow? - return AnyStruct::Builder(builder.getStruct( - _::StructSize(ZERO * WORDS, ZERO * POINTERS), defaultValue)); - } - static inline void set(PointerBuilder builder, AnyStruct::Reader value) { - builder.setStruct(value._reader); - } - static inline AnyStruct::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct PointerHelpers { - static inline AnyList::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyList::Reader(reader.getListAnySize(defaultValue)); - } - static inline AnyList::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - return AnyList::Builder(builder.getListAnySize(defaultValue)); - } - static inline void set(PointerBuilder builder, AnyList::Reader value) { - builder.setList(value._reader); - } - static inline AnyList::Builder init( - PointerBuilder builder, ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList( - elementSize, bounded(elementCount) * ELEMENTS)); - } - static inline AnyList::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return AnyList::Builder(builder.initStructList( - bounded(elementCount) * ELEMENTS, - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyStruct::Builder apply(_::OrphanBuilder& builder) { - return AnyStruct::Builder(builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline AnyStruct::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyStruct::Reader(builder.asStructReader(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::StructSize(ZERO * WORDS, ZERO * POINTERS)); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyList::Builder apply(_::OrphanBuilder& builder) { - return AnyList::Builder(builder.asListAnySize()); - } - static inline AnyList::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyList::Reader(builder.asListReaderAnySize()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -} // namespace _ (private) - -#if !CAPNP_LITE - -template -struct PipelineHook::FromImpl { - static inline kj::Own apply(typename T::Pipeline&& pipeline) { - return from(kj::mv(pipeline._typeless)); - } -}; - -template <> -struct PipelineHook::FromImpl { - static inline kj::Own apply(AnyPointer::Pipeline&& pipeline) { - return kj::mv(pipeline.hook); - } -}; - -template -inline kj::Own PipelineHook::from(Pipeline&& pipeline) { - return FromImpl::apply(kj::fwd(pipeline)); -} - -#endif // !CAPNP_LITE - -} // namespace capnp - -#endif // CAPNP_ANY_H_ diff --git a/external/capnp/include/capnp/blob.h b/external/capnp/include/capnp/blob.h deleted file mode 100644 index d11f101a5a..0000000000 --- a/external/capnp/include/capnp/blob.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_BLOB_H_ -#define CAPNP_BLOB_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include - -namespace capnp { - -struct Data { - Data() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -struct Text { - Text() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -class Data::Reader: public kj::ArrayPtr { - // Points to a blob of bytes. The usual Reader rules apply -- Data::Reader behaves like a simple - // pointer which does not own its target, can be passed by value, etc. - -public: - typedef Data Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Reader(const byte* value, size_t size): ArrayPtr(value, size) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} -}; - -class Text::Reader: public kj::StringPtr { - // Like Data::Reader, but points at NUL-terminated UTF-8 text. The NUL terminator is not counted - // in the size but must be present immediately after the last byte. - // - // Text::Reader's interface contract is that its data MUST be NUL-terminated. The producer of - // the Text::Reader must guarantee this, so that the consumer need not check. The data SHOULD - // also be valid UTF-8, but this is NOT guaranteed -- the consumer must verify if it cares. - -public: - typedef Text Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): StringPtr(nullptr) {} - inline Reader(const char* value): StringPtr(value) {} - inline Reader(const char* value, size_t size): StringPtr(value, size) {} - inline Reader(const kj::String& value): StringPtr(value) {} - inline Reader(const StringPtr& value): StringPtr(value) {} - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline Reader(const T& t): StringPtr(t) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif -}; - -class Data::Builder: public kj::ArrayPtr { - // Like Data::Reader except the pointers aren't const. - -public: - typedef Data Builds; - - Builder() = default; - inline Builder(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Builder(byte* value, size_t size): ArrayPtr(value, size) {} - inline Builder(kj::Array& value): ArrayPtr(value) {} - inline Builder(ArrayPtr value): ArrayPtr(value) {} - - inline Data::Reader asReader() const { return Data::Reader(*this); } - inline operator Reader() const { return asReader(); } -}; - -class Text::Builder: public kj::DisallowConstCopy { - // Basically identical to kj::StringPtr, except that the contents are non-const. - -public: - inline Builder(): content(nulstr, 1) {} - inline Builder(decltype(nullptr)): content(nulstr, 1) {} - inline Builder(char* value): content(value, strlen(value) + 1) {} - inline Builder(char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - - inline Reader asReader() const { return Reader(content.begin(), content.size() - 1); } - inline operator Reader() const { return asReader(); } - - inline operator kj::ArrayPtr(); - inline kj::ArrayPtr asArray(); - inline operator kj::ArrayPtr() const; - inline kj::ArrayPtr asArray() const; - inline kj::ArrayPtr asBytes() { return asArray().asBytes(); } - inline kj::ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline operator kj::StringPtr() const; - inline kj::StringPtr asString() const; - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - inline char& operator[](size_t index) { return content[index]; } - - inline char* begin() { return content.begin(); } - inline char* end() { return content.end() - 1; } - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(Builder other) const { return asString() == other.asString(); } - inline bool operator!=(Builder other) const { return asString() != other.asString(); } - inline bool operator< (Builder other) const { return asString() < other.asString(); } - inline bool operator> (Builder other) const { return asString() > other.asString(); } - inline bool operator<=(Builder other) const { return asString() <= other.asString(); } - inline bool operator>=(Builder other) const { return asString() >= other.asString(); } - - inline kj::StringPtr slice(size_t start) const; - inline kj::ArrayPtr slice(size_t start, size_t end) const; - inline Builder slice(size_t start); - inline kj::ArrayPtr slice(size_t start, size_t end); - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - -private: - inline explicit Builder(kj::ArrayPtr content): content(content) {} - - kj::ArrayPtr content; - - static char nulstr[1]; -}; - -inline kj::StringPtr KJ_STRINGIFY(Text::Builder builder) { - return builder.asString(); -} - -inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); } -inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); } - -inline Text::Builder::operator kj::StringPtr() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline kj::StringPtr Text::Builder::asString() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() { - return content.slice(0, content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline kj::StringPtr Text::Builder::slice(size_t start) const { - return asReader().slice(start); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline Text::Builder Text::Builder::slice(size_t start) { - return Text::Builder(content.slice(start, content.size())); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) { - return content.slice(start, end); -} - -} // namespace capnp - -#endif // CAPNP_BLOB_H_ diff --git a/external/capnp/include/capnp/c++.capnp b/external/capnp/include/capnp/c++.capnp deleted file mode 100644 index 2bda547179..0000000000 --- a/external/capnp/include/capnp/c++.capnp +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xbdf87d7bb8304e81; -$namespace("capnp::annotations"); - -annotation namespace(file): Text; -annotation name(field, enumerant, struct, enum, interface, method, param, group, union): Text; diff --git a/external/capnp/include/capnp/c++.capnp.h b/external/capnp/include/capnp/c++.capnp.h deleted file mode 100644 index 6d9817fbde..0000000000 --- a/external/capnp/include/capnp/c++.capnp.h +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: c++.capnp - -#ifndef CAPNP_INCLUDED_bdf87d7bb8304e81_ -#define CAPNP_INCLUDED_bdf87d7bb8304e81_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(b9c6f99ebf805f2c); -CAPNP_DECLARE_SCHEMA(f264a779fef191ce); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace annotations { - -// ======================================================================================= - -// ======================================================================================= - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_bdf87d7bb8304e81_ diff --git a/external/capnp/include/capnp/c.capnp b/external/capnp/include/capnp/c.capnp deleted file mode 100644 index 5de7e7363a..0000000000 --- a/external/capnp/include/capnp/c.capnp +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2016 NetDEF, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xc0183dd65ffef0f3; - -annotation nameinfix @0x85a8d86d736ba637 (file): Text; -# add an infix (middle insert) for output file names -# -# "make" generally has implicit rules for compiling "foo.c" => "foo". This -# is very annoying with capnp since the rule will be "foo" => "foo.c", leading -# to a loop. $nameinfix (recommended parameter: "-gen") inserts its parameter -# before the ".c", so the filename becomes "foo-gen.c" -# -# ("foo" is really "foo.capnp", so it's foo.capnp-gen.c) - -annotation fieldgetset @0xf72bc690355d66de (file): Void; -# generate getter & setter functions for accessing fields -# -# allows grabbing/putting values without de-/encoding the entire struct. diff --git a/external/capnp/include/capnp/capability.h b/external/capnp/include/capnp/capability.h deleted file mode 100644 index 56a5e6f6de..0000000000 --- a/external/capnp/include/capnp/capability.h +++ /dev/null @@ -1,884 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_CAPABILITY_H_ -#define CAPNP_CAPABILITY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "RPC APIs, including this header, are not available in lite mode." -#endif - -#include -#include -#include "raw-schema.h" -#include "any.h" -#include "pointer-helpers.h" - -namespace capnp { - -template -class Response; - -template -class RemotePromise: public kj::Promise>, public T::Pipeline { - // A Promise which supports pipelined calls. T is typically a struct type. T must declare - // an inner "mix-in" type "Pipeline" which implements pipelining; RemotePromise simply - // multiply-inherits that type along with Promise>. T::Pipeline must be movable, - // but does not need to be copyable (i.e. just like Promise). - // - // The promise is for an owned pointer so that the RPC system can allocate the MessageReader - // itself. - -public: - inline RemotePromise(kj::Promise>&& promise, typename T::Pipeline&& pipeline) - : kj::Promise>(kj::mv(promise)), - T::Pipeline(kj::mv(pipeline)) {} - inline RemotePromise(decltype(nullptr)) - : kj::Promise>(nullptr), - T::Pipeline(nullptr) {} - KJ_DISALLOW_COPY(RemotePromise); - RemotePromise(RemotePromise&& other) = default; - RemotePromise& operator=(RemotePromise&& other) = default; -}; - -class LocalClient; -namespace _ { // private -extern const RawSchema NULL_INTERFACE_SCHEMA; // defined in schema.c++ -class CapabilityServerSetBase; -} // namespace _ (private) - -struct Capability { - // A capability without type-safe methods. Typed capability clients wrap `Client` and typed - // capability servers subclass `Server` to dispatch to the regular, typed methods. - - class Client; - class Server; - - struct _capnpPrivate { - struct IsInterface; - static constexpr uint64_t typeId = 0x3; - static constexpr Kind kind = Kind::INTERFACE; - static constexpr _::RawSchema const* schema = &_::NULL_INTERFACE_SCHEMA; - - static const _::RawBrandedSchema* brand() { - return &_::NULL_INTERFACE_SCHEMA.defaultBrand; - } - }; -}; - -// ======================================================================================= -// Capability clients - -class RequestHook; -class ResponseHook; -class PipelineHook; -class ClientHook; - -template -class Request: public Params::Builder { - // A call that hasn't been sent yet. This class extends a Builder for the call's "Params" - // structure with a method send() that actually sends it. - // - // Given a Cap'n Proto method `foo(a :A, b :B): C`, the generated client interface will have - // a method `Request fooRequest()` (as well as a convenience method - // `RemotePromise foo(A::Reader a, B::Reader b)`). - -public: - inline Request(typename Params::Builder builder, kj::Own&& hook) - : Params::Builder(builder), hook(kj::mv(hook)) {} - inline Request(decltype(nullptr)): Params::Builder(nullptr) {} - - RemotePromise send() KJ_WARN_UNUSED_RESULT; - // Send the call and return a promise for the results. - -private: - kj::Own hook; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template -class Response: public Results::Reader { - // A completed call. This class extends a Reader for the call's answer structure. The Response - // is move-only -- once it goes out-of-scope, the underlying message will be freed. - -public: - inline Response(typename Results::Reader reader, kj::Own&& hook) - : Results::Reader(reader), hook(kj::mv(hook)) {} - -private: - kj::Own hook; - - template - friend class Request; - friend class ResponseHook; -}; - -class Capability::Client { - // Base type for capability clients. - -public: - typedef Capability Reads; - typedef Capability Calls; - - Client(decltype(nullptr)); - // If you need to declare a Client before you have anything to assign to it (perhaps because - // the assignment is going to occur in an if/else scope), you can start by initializing it to - // `nullptr`. The resulting client is not meant to be called and throws exceptions from all - // methods. - - template ()>> - Client(kj::Own&& server); - // Make a client capability that wraps the given server capability. The server's methods will - // only be executed in the given EventLoop, regardless of what thread calls the client's methods. - - template ()>> - Client(kj::Promise&& promise); - // Make a client from a promise for a future client. The resulting client queues calls until the - // promise resolves. - - Client(kj::Exception&& exception); - // Make a broken client that throws the given exception from all calls. - - Client(Client& other); - Client& operator=(Client& other); - // Copies by reference counting. Warning: This refcounting is not thread-safe. All copies of - // the client must remain in one thread. - - Client(Client&&) = default; - Client& operator=(Client&&) = default; - // Move constructor avoids reference counting. - - explicit Client(kj::Own&& hook); - // For use by the RPC implementation: Wrap a ClientHook. - - template - typename T::Client castAs(); - // Reinterpret the capability as implementing the given interface. Note that no error will occur - // here if the capability does not actually implement this interface, but later method calls will - // fail. It's up to the application to decide how indicate that additional interfaces are - // supported. - // - // TODO(perf): GCC 4.8 / Clang 3.3: rvalue-qualified version for better performance. - - template - typename T::Client castAs(InterfaceSchema schema); - // Dynamic version. `T` must be `DynamicCapability`, and you must `#include `. - - kj::Promise whenResolved(); - // If the capability is actually only a promise, the returned promise resolves once the - // capability itself has resolved to its final destination (or propagates the exception if - // the capability promise is rejected). This is mainly useful for error-checking in the case - // where no calls are being made. There is no reason to wait for this before making calls; if - // the capability does not resolve, the call results will propagate the error. - - Request typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - // Make a request without knowing the types of the params or results. You specify the type ID - // and method number manually. - - // TODO(someday): method(s) for Join - -protected: - Client() = default; - - template - Request newCall(uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - -private: - kj::Own hook; - - static kj::Own makeLocalClient(kj::Own&& server); - - template - friend struct _::PointerHelpers; - friend struct DynamicCapability; - friend class Orphanage; - friend struct DynamicStruct; - friend struct DynamicList; - template - friend struct List; - friend class _::CapabilityServerSetBase; - friend class ClientHook; -}; - -// ======================================================================================= -// Capability servers - -class CallContextHook; - -template -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - // - // The CallContext becomes invalid as soon as the call reports completion. - -public: - explicit CallContext(CallContextHook& hook); - - typename Params::Reader getParams(); - // Get the params payload. - - void releaseParams(); - // Release the params payload. getParams() will throw an exception after this is called. - // Releasing the params may allow the RPC system to free up buffer space to handle other - // requests. Long-running asynchronous methods should try to call this as early as is - // convenient. - - typename Results::Builder getResults(kj::Maybe sizeHint = nullptr); - typename Results::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(typename Results::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - // Manipulate the results payload. The "Return" message (part of the RPC protocol) will - // typically be allocated the first time one of these is called. Some RPC systems may - // allocate these messages in a limited space (such as a shared memory segment), therefore the - // application should delay calling these as long as is convenient to do so (but don't delay - // if doing so would require extra copies later). - // - // `sizeHint` indicates a guess at the message size. This will usually be used to decide how - // much space to allocate for the first message segment (don't worry: only space that is actually - // used will be sent on the wire). If omitted, the system decides. The message root pointer - // should not be included in the size. So, if you are simply going to copy some existing message - // directly into the results, just call `.totalSize()` and pass that in. - - template - kj::Promise tailCall(Request&& tailRequest); - // Resolve the call by making a tail call. `tailRequest` is a request that has been filled in - // but not yet sent. The context will send the call, then fill in the results with the result - // of the call. If tailCall() is used, {get,init,set,adopt}Results (above) *must not* be called. - // - // The RPC implementation may be able to optimize a tail call to another machine such that the - // results never actually pass through this machine. Even if no such optimization is possible, - // `tailCall()` may allow pipelined calls to be forwarded optimistically to the new call site. - // - // In general, this should be the last thing a method implementation calls, and the promise - // returned from `tailCall()` should then be returned by the method implementation. - - void allowCancellation(); - // Indicate that it is OK for the RPC system to discard its Promise for this call's result if - // the caller cancels the call, thereby transitively canceling any asynchronous operations the - // call implementation was performing. This is not done by default because it could represent a - // security risk: applications must be carefully written to ensure that they do not end up in - // a bad state if an operation is canceled at an arbitrary point. However, for long-running - // method calls that hold significant resources, prompt cancellation is often useful. - // - // Keep in mind that asynchronous cancellation cannot occur while the method is synchronously - // executing on a local thread. The method must perform an asynchronous operation or call - // `EventLoop::current().evalLater()` to yield control. - // - // Note: You might think that we should offer `onCancel()` and/or `isCanceled()` methods that - // provide notification when the caller cancels the request without forcefully killing off the - // promise chain. Unfortunately, this composes poorly with promise forking: the canceled - // path may be just one branch of a fork of the result promise. The other branches still want - // the call to continue. Promise forking is used within the Cap'n Proto implementation -- in - // particular each pipelined call forks the result promise. So, if a caller made a pipelined - // call and then dropped the original object, the call should not be canceled, but it would be - // excessively complicated for the framework to avoid notififying of cancellation as long as - // pipelined calls still exist. - -private: - CallContextHook* hook; - - friend class Capability::Server; - friend struct DynamicCapability; -}; - -class Capability::Server { - // Objects implementing a Cap'n Proto interface must subclass this. Typically, such objects - // will instead subclass a typed Server interface which will take care of implementing - // dispatchCall(). - -public: - typedef Capability Serves; - - virtual kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) = 0; - // Call the given method. `params` is the input struct, and should be released as soon as it - // is no longer needed. `context` may be used to allocate the output struct and deal with - // cancellation. - - // TODO(someday): Method which can optionally be overridden to implement Join when the object is - // a proxy. - -protected: - inline Capability::Client thisCap(); - // Get a capability pointing to this object, much like the `this` keyword. - // - // The effect of this method is undefined if: - // - No capability client has been created pointing to this object. (This is always the case in - // the server's constructor.) - // - The capability client pointing at this object has been destroyed. (This is always the case - // in the server's destructor.) - // - Multiple capability clients have been created around the same server (possible if the server - // is refcounted, which is not recommended since the client itself provides refcounting). - - template - CallContext internalGetTypedContext( - CallContext typeless); - kj::Promise internalUnimplemented(const char* actualInterfaceName, - uint64_t requestedTypeId); - kj::Promise internalUnimplemented(const char* interfaceName, - uint64_t typeId, uint16_t methodId); - kj::Promise internalUnimplemented(const char* interfaceName, const char* methodName, - uint64_t typeId, uint16_t methodId); - -private: - ClientHook* thisHook = nullptr; - friend class LocalClient; -}; - -// ======================================================================================= - -class ReaderCapabilityTable: private _::CapTableReader { - // Class which imbues Readers with the ability to read capabilities. - // - // In Cap'n Proto format, the encoding of a capability pointer is simply an integer index into - // an external table. Since these pointers fundamentally point outside the message, a - // MessageReader by default has no idea what they point at, and therefore reading capabilities - // from such a reader will throw exceptions. - // - // In order to be able to read capabilities, you must first attach a capability table, using - // this class. By "imbuing" a Reader, you get a new Reader which will interpret capability - // pointers by treating them as indexes into the ReaderCapabilityTable. - // - // Note that when using Cap'n Proto's RPC system, this is handled automatically. - -public: - explicit ReaderCapabilityTable(kj::Array>> table); - KJ_DISALLOW_COPY(ReaderCapabilityTable); - - template - T imbue(T reader); - // Return a reader equivalent to `reader` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Array>> table; - - kj::Maybe> extractCap(uint index) override; -}; - -class BuilderCapabilityTable: private _::CapTableBuilder { - // Class which imbues Builders with the ability to read and write capabilities. - // - // This is much like ReaderCapabilityTable, except for builders. The table starts out empty, - // but capabilities can be added to it over time. - -public: - BuilderCapabilityTable(); - KJ_DISALLOW_COPY(BuilderCapabilityTable); - - inline kj::ArrayPtr>> getTable() { return table; } - - template - T imbue(T builder); - // Return a builder equivalent to `builder` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Vector>> table; - - kj::Maybe> extractCap(uint index) override; - uint injectCap(kj::Own&& cap) override; - void dropCap(uint index) override; -}; - -// ======================================================================================= - -namespace _ { // private - -class CapabilityServerSetBase { -public: - Capability::Client addInternal(kj::Own&& server, void* ptr); - kj::Promise getLocalServerInternal(Capability::Client& client); -}; - -} // namespace _ (private) - -template -class CapabilityServerSet: private _::CapabilityServerSetBase { - // Allows a server to recognize its own capabilities when passed back to it, and obtain the - // underlying Server objects associated with them. - // - // All objects in the set must have the same interface type T. The objects may implement various - // interfaces derived from T (and in fact T can be `capnp::Capability` to accept all objects), - // but note that if you compile with RTTI disabled then you will not be able to down-cast through - // virtual inheritance, and all inheritance between server interfaces is virtual. So, with RTTI - // disabled, you will likely need to set T to be the most-derived Cap'n Proto interface type, - // and you server class will need to be directly derived from that, so that you can use - // static_cast (or kj::downcast) to cast to it after calling getLocalServer(). (If you compile - // with RTTI, then you can freely dynamic_cast and ignore this issue!) - -public: - CapabilityServerSet() = default; - KJ_DISALLOW_COPY(CapabilityServerSet); - - typename T::Client add(kj::Own&& server); - // Create a new capability Client for the given Server and also add this server to the set. - - kj::Promise> getLocalServer(typename T::Client& client); - // Given a Client pointing to a server previously passed to add(), return the corresponding - // Server. This returns a promise because if the input client is itself a promise, this must - // wait for it to resolve. Keep in mind that the server will be deleted when all clients are - // gone, so the caller should make sure to keep the client alive (hence why this method only - // accepts an lvalue input). -}; - -// ======================================================================================= -// Hook interfaces which must be implemented by the RPC system. Applications never call these -// directly; the RPC system implements them and the types defined earlier in this file wrap them. - -class RequestHook { - // Hook interface implemented by RPC system representing a request being built. - -public: - virtual RemotePromise send() = 0; - // Send the call and return a promise for the result. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this request. This can be used by an RPC adapter to - // discover when tail call is going to be sent over its own connection and therefore can be - // optimized into a remote tail call. - - template - inline static kj::Own from(Request&& request) { - return kj::mv(request.hook); - } -}; - -class ResponseHook { - // Hook interface implemented by RPC system representing a response. - // - // At present this class has no methods. It exists only for garbage collection -- when the - // ResponseHook is destroyed, the results can be freed. - -public: - virtual ~ResponseHook() noexcept(false); - // Just here to make sure the type is dynamic. - - template - inline static kj::Own from(Response&& response) { - return kj::mv(response.hook); - } -}; - -// class PipelineHook is declared in any.h because it is needed there. - -class ClientHook { -public: - ClientHook(); - - virtual Request newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) = 0; - // Start a new call, allowing the client to allocate request/response objects as it sees fit. - // This version is used when calls are made from application code in the local process. - - struct VoidPromiseAndPipeline { - kj::Promise promise; - kj::Own pipeline; - }; - - virtual VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId, - kj::Own&& context) = 0; - // Call the object, but the caller controls allocation of the request/response objects. If the - // callee insists on allocating these objects itself, it must make a copy. This version is used - // when calls come in over the network via an RPC system. Note that even if the returned - // `Promise` is discarded, the call may continue executing if any pipelined calls are - // waiting for it. - // - // Since the caller of this method chooses the CallContext implementation, it is the caller's - // responsibility to ensure that the returned promise is not canceled unless allowed via - // the context's `allowCancellation()`. - // - // The call must not begin synchronously; the callee must arrange for the call to begin in a - // later turn of the event loop. Otherwise, application code may call back and affect the - // callee's state in an unexpected way. - - virtual kj::Maybe getResolved() = 0; - // If this ClientHook is a promise that has already resolved, returns the inner, resolved version - // of the capability. The caller may permanently replace this client with the resolved one if - // desired. Returns null if the client isn't a promise or hasn't resolved yet -- use - // `whenMoreResolved()` to distinguish between them. - - virtual kj::Maybe>> whenMoreResolved() = 0; - // If this client is a settled reference (not a promise), return nullptr. Otherwise, return a - // promise that eventually resolves to a new client that is closer to being the final, settled - // client (i.e. the value eventually returned by `getResolved()`). Calling this repeatedly - // should eventually produce a settled client. - - kj::Promise whenResolved(); - // Repeatedly calls whenMoreResolved() until it returns nullptr. - - virtual kj::Own addRef() = 0; - // Return a new reference to the same capability. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this client. This can be used by an RPC adapter to - // discover when a capability it needs to marshal is one that it created in the first place, and - // therefore it can transfer the capability without proxying. - - static const uint NULL_CAPABILITY_BRAND; - // Value is irrelevant; used for pointer. - - inline bool isNull() { return getBrand() == &NULL_CAPABILITY_BRAND; } - // Returns true if the capability was created as a result of assigning a Client to null or by - // reading a null pointer out of a Cap'n Proto message. - - virtual void* getLocalServer(_::CapabilityServerSetBase& capServerSet); - // If this is a local capability created through `capServerSet`, return the underlying Server. - // Otherwise, return nullptr. Default implementation (which everyone except LocalClient should - // use) always returns nullptr. - - static kj::Own from(Capability::Client client) { return kj::mv(client.hook); } -}; - -class CallContextHook { - // Hook interface implemented by RPC system to manage a call on the server side. See - // CallContext. - -public: - virtual AnyPointer::Reader getParams() = 0; - virtual void releaseParams() = 0; - virtual AnyPointer::Builder getResults(kj::Maybe sizeHint) = 0; - virtual kj::Promise tailCall(kj::Own&& request) = 0; - virtual void allowCancellation() = 0; - - virtual kj::Promise onTailCall() = 0; - // If `tailCall()` is called, resolves to the PipelineHook from the tail call. An - // implementation of `ClientHook::call()` is allowed to call this at most once. - - virtual ClientHook::VoidPromiseAndPipeline directTailCall(kj::Own&& request) = 0; - // Call this when you would otherwise call onTailCall() immediately followed by tailCall(). - // Implementations of tailCall() should typically call directTailCall() and then fulfill the - // promise fulfiller for onTailCall() with the returned pipeline. - - virtual kj::Own addRef() = 0; -}; - -kj::Own newLocalPromiseClient(kj::Promise>&& promise); -// Returns a ClientHook that queues up calls until `promise` resolves, then forwards them to -// the new client. This hook's `getResolved()` and `whenMoreResolved()` methods will reflect the -// redirection to the eventual replacement client. - -kj::Own newLocalPromisePipeline(kj::Promise>&& promise); -// Returns a PipelineHook that queues up calls until `promise` resolves, then forwards them to -// the new pipeline. - -kj::Own newBrokenCap(kj::StringPtr reason); -kj::Own newBrokenCap(kj::Exception&& reason); -// Helper function that creates a capability which simply throws exceptions when called. - -kj::Own newBrokenPipeline(kj::Exception&& reason); -// Helper function that creates a pipeline which simply throws exceptions when called. - -Request newBrokenRequest( - kj::Exception&& reason, kj::Maybe sizeHint); -// Helper function that creates a Request object that simply throws exceptions when sent. - -// ======================================================================================= -// Extend PointerHelpers for interfaces - -namespace _ { // private - -template -struct PointerHelpers { - static inline typename T::Client get(PointerReader reader) { - return typename T::Client(reader.getCapability()); - } - static inline typename T::Client get(PointerBuilder builder) { - return typename T::Client(builder.getCapability()); - } - static inline void set(PointerBuilder builder, typename T::Client&& value) { - builder.setCapability(kj::mv(value.Capability::Client::hook)); - } - static inline void set(PointerBuilder builder, typename T::Client& value) { - builder.setCapability(value.Capability::Client::hook->addRef()); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -} // namespace _ (private) - -// ======================================================================================= -// Extend List for interfaces - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Client(reader.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Client(builder.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - inline void set(uint index, typename T::Client value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setCapability(kj::mv(value.hook)); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -// ======================================================================================= -// Inline implementation details - -template -RemotePromise Request::send() { - auto typelessPromise = hook->send(); - hook = nullptr; // prevent reuse - - // Convert the Promise to return the correct response type. - // Explicitly upcast to kj::Promise to make clear that calling .then() doesn't invalidate the - // Pipeline part of the RemotePromise. - auto typedPromise = kj::implicitCast>&>(typelessPromise) - .then([](Response&& response) -> Response { - return Response(response.getAs(), kj::mv(response.hook)); - }); - - // Wrap the typeless pipeline in a typed wrapper. - typename Results::Pipeline typedPipeline( - kj::mv(kj::implicitCast(typelessPromise))); - - return RemotePromise(kj::mv(typedPromise), kj::mv(typedPipeline)); -} - -inline Capability::Client::Client(kj::Own&& hook): hook(kj::mv(hook)) {} -template -inline Capability::Client::Client(kj::Own&& server) - : hook(makeLocalClient(kj::mv(server))) {} -template -inline Capability::Client::Client(kj::Promise&& promise) - : hook(newLocalPromiseClient(promise.then([](T&& t) { return kj::mv(t.hook); }))) {} -inline Capability::Client::Client(Client& other): hook(other.hook->addRef()) {} -inline Capability::Client& Capability::Client::operator=(Client& other) { - hook = other.hook->addRef(); - return *this; -} -template -inline typename T::Client Capability::Client::castAs() { - return typename T::Client(hook->addRef()); -} -inline kj::Promise Capability::Client::whenResolved() { - return hook->whenResolved(); -} -inline Request Capability::Client::typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint) { - return newCall(interfaceId, methodId, sizeHint); -} -template -inline Request Capability::Client::newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) { - auto typeless = hook->newCall(interfaceId, methodId, sizeHint); - return Request(typeless.template getAs(), kj::mv(typeless.hook)); -} - -template -inline CallContext::CallContext(CallContextHook& hook): hook(&hook) {} -template -inline typename Params::Reader CallContext::getParams() { - return hook->getParams().template getAs(); -} -template -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -template -inline typename Results::Builder CallContext::getResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template getAs(); -} -template -inline typename Results::Builder CallContext::initResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template initAs(); -} -template -inline void CallContext::setResults(typename Results::Reader value) { - hook->getResults(value.totalSize()).template setAs(value); -} -template -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(nullptr).adopt(kj::mv(value)); -} -template -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -template -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template -CallContext Capability::Server::internalGetTypedContext( - CallContext typeless) { - return CallContext(*typeless.hook); -} - -Capability::Client Capability::Server::thisCap() { - return Client(thisHook->addRef()); -} - -template -T ReaderCapabilityTable::imbue(T reader) { - return T(_::PointerHelpers>::getInternalReader(reader).imbue(this)); -} - -template -T BuilderCapabilityTable::imbue(T builder) { - return T(_::PointerHelpers>::getInternalBuilder(kj::mv(builder)).imbue(this)); -} - -template -typename T::Client CapabilityServerSet::add(kj::Own&& server) { - void* ptr = reinterpret_cast(server.get()); - // Clang insists that `castAs` is a template-dependent member and therefore we need the - // `template` keyword here, but AFAICT this is wrong: addImpl() is not a template. - return addInternal(kj::mv(server), ptr).template castAs(); -} - -template -kj::Promise> CapabilityServerSet::getLocalServer( - typename T::Client& client) { - return getLocalServerInternal(client) - .then([](void* server) -> kj::Maybe { - if (server == nullptr) { - return nullptr; - } else { - return *reinterpret_cast(server); - } - }); -} - -template -struct Orphanage::GetInnerReader { - static inline kj::Own apply(typename T::Client t) { - return ClientHook::from(kj::mv(t)); - } -}; - -} // namespace capnp - -#endif // CAPNP_CAPABILITY_H_ diff --git a/external/capnp/include/capnp/common.h b/external/capnp/include/capnp/common.h deleted file mode 100644 index 3fc7a42112..0000000000 --- a/external/capnp/include/capnp/common.h +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef CAPNP_COMMON_H_ -#define CAPNP_COMMON_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include - -#if CAPNP_DEBUG_TYPES -#include -#endif - -namespace capnp { - -#define CAPNP_VERSION_MAJOR 0 -#define CAPNP_VERSION_MINOR 6 -#define CAPNP_VERSION_MICRO 1 - -#define CAPNP_VERSION \ - (CAPNP_VERSION_MAJOR * 1000000 + CAPNP_VERSION_MINOR * 1000 + CAPNP_VERSION_MICRO) - -#ifndef CAPNP_LITE -#define CAPNP_LITE 0 -#endif - -typedef unsigned int uint; - -struct Void { - // Type used for Void fields. Using C++'s "void" type creates a bunch of issues since it behaves - // differently from other types. - - inline constexpr bool operator==(Void other) const { return true; } - inline constexpr bool operator!=(Void other) const { return false; } -}; - -static constexpr Void VOID = Void(); -// Constant value for `Void`, which is an empty struct. - -inline kj::StringPtr KJ_STRINGIFY(Void) { return "void"; } - -struct Text; -struct Data; - -enum class Kind: uint8_t { - PRIMITIVE, - BLOB, - ENUM, - STRUCT, - UNION, - INTERFACE, - LIST, - - OTHER - // Some other type which is often a type parameter to Cap'n Proto templates, but which needs - // special handling. This includes types like AnyPointer, Dynamic*, etc. -}; - -enum class Style: uint8_t { - PRIMITIVE, - POINTER, // other than struct - STRUCT, - CAPABILITY -}; - -enum class ElementSize: uint8_t { - // Size of a list element. - - VOID = 0, - BIT = 1, - BYTE = 2, - TWO_BYTES = 3, - FOUR_BYTES = 4, - EIGHT_BYTES = 5, - - POINTER = 6, - - INLINE_COMPOSITE = 7 -}; - -enum class PointerType { - // Various wire types a pointer field can take - - NULL_, - // Should be NULL, but that's #defined in stddef.h - - STRUCT, - LIST, - CAPABILITY -}; - -namespace schemas { - -template -struct EnumInfo; - -} // namespace schemas - -namespace _ { // private - -template struct Kind_; - -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; - -template struct Kind_> { - static constexpr Kind kind = Kind::STRUCT; -}; -template struct Kind_> { - static constexpr Kind kind = Kind::INTERFACE; -}; -template struct Kind_::IsEnum>> { - static constexpr Kind kind = Kind::ENUM; -}; - -} // namespace _ (private) - -template ::kind> -inline constexpr Kind kind() { - // This overload of kind() matches types which have a Kind_ specialization. - - return k; -} - -#if _MSC_VER - -#define CAPNP_KIND(T) ::capnp::_::Kind_::kind -// Avoid constexpr methods in MSVC (it remains buggy in many situations). - -#else // _MSC_VER - -#define CAPNP_KIND(T) ::capnp::kind() -// Use this macro rather than kind() in any code which must work in MSVC. - -#endif // _MSC_VER, else - -#if !CAPNP_LITE - -template ()> -inline constexpr Style style() { - return k == Kind::PRIMITIVE || k == Kind::ENUM ? Style::PRIMITIVE - : k == Kind::STRUCT ? Style::STRUCT - : k == Kind::INTERFACE ? Style::CAPABILITY : Style::POINTER; -} - -#endif // !CAPNP_LITE - -template -struct List; - -#if _MSC_VER - -template -struct List {}; -// For some reason, without this declaration, MSVC will error out on some uses of List -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -template struct ListElementType_; -template struct ListElementType_> { typedef T Type; }; -template using ListElementType = typename ListElementType_::Type; - -namespace _ { // private -template struct Kind_> { - static constexpr Kind kind = Kind::LIST; -}; -} // namespace _ (private) - -template struct ReaderFor_ { typedef typename T::Reader Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef typename T::Client Type; }; -template using ReaderFor = typename ReaderFor_::Type; -// The type returned by List::Reader::operator[]. - -template struct BuilderFor_ { typedef typename T::Builder Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef typename T::Client Type; }; -template using BuilderFor = typename BuilderFor_::Type; -// The type returned by List::Builder::operator[]. - -template struct PipelineFor_ { typedef typename T::Pipeline Type;}; -template struct PipelineFor_ { typedef typename T::Client Type; }; -template using PipelineFor = typename PipelineFor_::Type; - -template struct TypeIfEnum_; -template struct TypeIfEnum_ { typedef T Type; }; - -template -using TypeIfEnum = typename TypeIfEnum_>::Type; - -template -using FromReader = typename kj::Decay::Reads; -// FromReader = MyType (for any Cap'n Proto type). - -template -using FromBuilder = typename kj::Decay::Builds; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromPipeline = typename kj::Decay::Pipelines; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromClient = typename kj::Decay::Calls; -// FromReader = MyType (for any Cap'n Proto interface type). - -template -using FromServer = typename kj::Decay::Serves; -// FromBuilder = MyType (for any Cap'n Proto interface type). - -template -struct FromAny_; - -template -struct FromAny_>> { - using Type = FromReader; -}; - -template -struct FromAny_>> { - using Type = FromBuilder; -}; - -template -struct FromAny_>> { - using Type = FromPipeline; -}; - -// Note that T::Client is covered by FromReader - -template -struct FromAny_, kj::VoidSfinae>> { - using Type = FromServer; -}; - -template -struct FromAny_::kind == Kind::PRIMITIVE || _::Kind_::kind == Kind::ENUM>> { - // TODO(msvc): Ideally the EnableIf condition would be `style() == Style::PRIMITIVE`, but MSVC - // cannot yet use style() in this constexpr context. - - using Type = kj::Decay; -}; - -template -using FromAny = typename FromAny_::Type; -// Given any Cap'n Proto value type as an input, return the Cap'n Proto base type. That is: -// -// Foo::Reader -> Foo -// Foo::Builder -> Foo -// Foo::Pipeline -> Foo -// Foo::Client -> Foo -// Own -> Foo -// uint32_t -> uint32_t - -namespace _ { // private - -template -struct PointerHelpers; - -#if _MSC_VER - -template -struct PointerHelpers {}; -// For some reason, without this declaration, MSVC will error out on some uses of PointerHelpers -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -} // namespace _ (private) - -struct MessageSize { - // Size of a message. Every struct type has a method `.totalSize()` that returns this. - uint64_t wordCount; - uint capCount; -}; - -// ======================================================================================= -// Raw memory types and measures - -using kj::byte; - -class word { uint64_t content KJ_UNUSED_MEMBER; KJ_DISALLOW_COPY(word); public: word() = default; }; -// word is an opaque type with size of 64 bits. This type is useful only to make pointer -// arithmetic clearer. Since the contents are private, the only way to access them is to first -// reinterpret_cast to some other pointer type. -// -// Copying is disallowed because you should always use memcpy(). Otherwise, you may run afoul of -// aliasing rules. -// -// A pointer of type word* should always be word-aligned even if won't actually be dereferenced as -// that type. - -static_assert(sizeof(byte) == 1, "uint8_t is not one byte?"); -static_assert(sizeof(word) == 8, "uint64_t is not 8 bytes?"); - -#if CAPNP_DEBUG_TYPES -// Set CAPNP_DEBUG_TYPES to 1 to use kj::Quantity for "count" types. Otherwise, plain integers are -// used. All the code should still operate exactly the same, we just lose compile-time checking. -// Note that this will also change symbol names, so it's important that the library and any clients -// be compiled with the same setting here. -// -// We disable this by default to reduce symbol name size and avoid any possibility of the compiler -// failing to fully-optimize the types, but anyone modifying Cap'n Proto itself should enable this -// during development and testing. - -namespace _ { class BitLabel; class ElementLabel; struct WirePointer; } - -template -using BitCountN = kj::Quantity(), T>, _::BitLabel>; -template -using ByteCountN = kj::Quantity(), T>, byte>; -template -using WordCountN = kj::Quantity(), T>, word>; -template -using ElementCountN = kj::Quantity(), T>, _::ElementLabel>; -template -using WirePointerCountN = kj::Quantity(), T>, _::WirePointer>; - -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::bounded; -using kj::unbound; -using kj::unboundAs; -using kj::unboundMax; -using kj::unboundMaxBits; -using kj::assertMax; -using kj::assertMaxBits; -using kj::upgradeBound; -using kj::ThrowOverflow; -using kj::assumeBits; -using kj::assumeMax; -using kj::subtractChecked; -using kj::trySubtract; - -template -inline constexpr U* operator+(U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+(const U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator+=(U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} - -template -inline constexpr U* operator-(U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-(const U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator-=(U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} - -constexpr auto BITS = kj::unit>(); -constexpr auto BYTES = kj::unit>(); -constexpr auto WORDS = kj::unit>(); -constexpr auto ELEMENTS = kj::unit>(); -constexpr auto POINTERS = kj::unit>(); - -constexpr auto ZERO = kj::bounded<0>(); -constexpr auto ONE = kj::bounded<1>(); - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr auto BITS_PER_BYTE KJ_UNUSED = bounded<8>() * BITS / BYTES; -constexpr auto BITS_PER_WORD KJ_UNUSED = bounded<64>() * BITS / WORDS; -constexpr auto BYTES_PER_WORD KJ_UNUSED = bounded<8>() * BYTES / WORDS; - -constexpr auto BITS_PER_POINTER KJ_UNUSED = bounded<64>() * BITS / POINTERS; -constexpr auto BYTES_PER_POINTER KJ_UNUSED = bounded<8>() * BYTES / POINTERS; -constexpr auto WORDS_PER_POINTER KJ_UNUSED = ONE * WORDS / POINTERS; - -constexpr auto POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; - -constexpr auto MAX_SEGMENT_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_LIST_ELEMENTS = - bounded()>() * ELEMENTS; -constexpr auto MAX_STUCT_DATA_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_STRUCT_POINTER_COUNT = - bounded()>() * POINTERS; - -using StructDataBitCount = decltype(WordCountN() * BITS_PER_WORD); -// Number of bits in a Struct data segment (should come out to BitCountN<22>). - -using StructDataOffset = decltype(StructDataBitCount() * (ONE * ELEMENTS / BITS)); -using StructPointerOffset = StructPointerCount; -// Type of a field offset. - -inline StructDataOffset assumeDataOffset(uint32_t offset) { - return assumeMax(MAX_STUCT_DATA_WORDS * BITS_PER_WORD * (ONE * ELEMENTS / BITS), - bounded(offset) * ELEMENTS); -} - -inline StructPointerOffset assumePointerOffset(uint32_t offset) { - return assumeMax(MAX_STRUCT_POINTER_COUNT, bounded(offset) * POINTERS); -} - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef kj::Quantity, byte> TextSize; -// Not including NUL terminator. - -template -inline KJ_CONSTEXPR() decltype(bounded() * BYTES / ELEMENTS) bytesPerElement() { - return bounded() * BYTES / ELEMENTS; -} - -template -inline KJ_CONSTEXPR() decltype(bounded() * BITS / ELEMENTS) bitsPerElement() { - return bounded() * BITS / ELEMENTS; -} - -template -inline constexpr kj::Quantity, T> -intervalLength(const T* a, const T* b, kj::Quantity, T>) { - return kj::assumeMax(b - a) * kj::unit, T>>(); -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} - -#else - -template -using BitCountN = T; -template -using ByteCountN = T; -template -using WordCountN = T; -template -using ElementCountN = T; -template -using WirePointerCountN = T; - - -// XXX -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::ThrowOverflow; -// YYY - -template inline constexpr uint bounded() { return i; } -template inline constexpr T bounded(T i) { return i; } -template inline constexpr T unbound(T i) { return i; } - -template inline constexpr T unboundAs(U i) { return i; } - -template inline constexpr uint unboundMax(T i) { return i; } -template inline constexpr uint unboundMaxBits(T i) { return i; } - -template -inline T assertMax(T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMax(uint newMax, T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMaxBits(T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > kj::maxValueForBits())) func(); - return value; -} - -template -inline T assertMaxBits(uint bits, T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > (1ull << bits) - 1)) func(); - return value; -} - -template inline constexpr T upgradeBound(U i) { return i; } - -template inline constexpr T assumeBits(T i) { return i; } -template inline constexpr T assumeMax(T i) { return i; } - -template -inline auto subtractChecked(T a, U b, ErrorFunc&& errorFunc = ErrorFunc()) - -> decltype(a - b) { - if (b > a) errorFunc(); - return a - b; -} - -template -inline auto trySubtract(T a, U b) -> kj::Maybe { - if (b > a) { - return nullptr; - } else { - return a - b; - } -} - -constexpr uint BITS = 1; -constexpr uint BYTES = 1; -constexpr uint WORDS = 1; -constexpr uint ELEMENTS = 1; -constexpr uint POINTERS = 1; - -constexpr uint ZERO = 0; -constexpr uint ONE = 1; - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr uint BITS_PER_BYTE KJ_UNUSED = 8; -constexpr uint BITS_PER_WORD KJ_UNUSED = 64; -constexpr uint BYTES_PER_WORD KJ_UNUSED = 8; - -constexpr uint BITS_PER_POINTER KJ_UNUSED = 64; -constexpr uint BYTES_PER_POINTER KJ_UNUSED = 8; -constexpr uint WORDS_PER_POINTER KJ_UNUSED = 1; - -// XXX -constexpr uint POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; -// YYY - -constexpr auto MAX_SEGMENT_WORDS = kj::maxValueForBits(); -constexpr auto MAX_LIST_ELEMENTS = kj::maxValueForBits(); -constexpr auto MAX_STUCT_DATA_WORDS = kj::maxValueForBits(); -constexpr auto MAX_STRUCT_POINTER_COUNT = kj::maxValueForBits(); - -typedef uint StructDataBitCount; -typedef uint StructDataOffset; -typedef uint StructPointerOffset; - -inline StructDataOffset assumeDataOffset(uint32_t offset) { return offset; } -inline StructPointerOffset assumePointerOffset(uint32_t offset) { return offset; } - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef uint TextSize; - -template -inline KJ_CONSTEXPR() size_t bytesPerElement() { return sizeof(T); } - -template -inline KJ_CONSTEXPR() size_t bitsPerElement() { return sizeof(T) * 8; } - -template -inline constexpr ptrdiff_t intervalLength(const T* a, const T* b, uint) { - return b - a; -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} - -#endif - -} // namespace capnp - -#endif // CAPNP_COMMON_H_ diff --git a/external/capnp/include/capnp/compat/json.capnp.h b/external/capnp/include/capnp/compat/json.capnp.h deleted file mode 100644 index a8877e540b..0000000000 --- a/external/capnp/include/capnp/compat/json.capnp.h +++ /dev/null @@ -1,860 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: json.capnp - -#ifndef CAPNP_INCLUDED_8ef99297a43a5e34_ -#define CAPNP_INCLUDED_8ef99297a43a5e34_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(8825ffaa852cda72); -CAPNP_DECLARE_SCHEMA(c27855d853a937cc); -CAPNP_DECLARE_SCHEMA(9bbf84153dd4bb60); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -struct JsonValue { - JsonValue() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NULL_, - BOOLEAN, - NUMBER, - STRING, - ARRAY, - OBJECT, - CALL, - }; - struct Field; - struct Call; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8825ffaa852cda72, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c27855d853a937cc, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9bbf84153dd4bb60, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class JsonValue::Reader { -public: - typedef JsonValue Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNull() const; - inline ::capnp::Void getNull() const; - - inline bool isBoolean() const; - inline bool getBoolean() const; - - inline bool isNumber() const; - inline double getNumber() const; - - inline bool isString() const; - inline bool hasString() const; - inline ::capnp::Text::Reader getString() const; - - inline bool isArray() const; - inline bool hasArray() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getArray() const; - - inline bool isObject() const; - inline bool hasObject() const; - inline ::capnp::List< ::capnp::JsonValue::Field>::Reader getObject() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::JsonValue::Call::Reader getCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Builder { -public: - typedef JsonValue Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNull(); - inline ::capnp::Void getNull(); - inline void setNull( ::capnp::Void value = ::capnp::VOID); - - inline bool isBoolean(); - inline bool getBoolean(); - inline void setBoolean(bool value); - - inline bool isNumber(); - inline double getNumber(); - inline void setNumber(double value); - - inline bool isString(); - inline bool hasString(); - inline ::capnp::Text::Builder getString(); - inline void setString( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initString(unsigned int size); - inline void adoptString(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownString(); - - inline bool isArray(); - inline bool hasArray(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getArray(); - inline void setArray( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initArray(unsigned int size); - inline void adoptArray(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownArray(); - - inline bool isObject(); - inline bool hasObject(); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder getObject(); - inline void setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder initObject(unsigned int size); - inline void adoptObject(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> disownObject(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::JsonValue::Call::Builder getCall(); - inline void setCall( ::capnp::JsonValue::Call::Reader value); - inline ::capnp::JsonValue::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::JsonValue::Call>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue::Call> disownCall(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Pipeline { -public: - typedef JsonValue Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline bool hasValue() const; - inline ::capnp::JsonValue::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline bool hasValue(); - inline ::capnp::JsonValue::Builder getValue(); - inline void setValue( ::capnp::JsonValue::Reader value); - inline ::capnp::JsonValue::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::JsonValue>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::JsonValue::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasFunction() const; - inline ::capnp::Text::Reader getFunction() const; - - inline bool hasParams() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasFunction(); - inline ::capnp::Text::Builder getFunction(); - inline void setFunction( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFunction(unsigned int size); - inline void adoptFunction(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFunction(); - - inline bool hasParams(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getParams(); - inline void setParams( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initParams(unsigned int size); - inline void adoptParams(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::JsonValue::Which JsonValue::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::JsonValue::Which JsonValue::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Reader::isNull() const { - return which() == JsonValue::NULL_; -} -inline bool JsonValue::Builder::isNull() { - return which() == JsonValue::NULL_; -} -inline ::capnp::Void JsonValue::Reader::getNull() const { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void JsonValue::Builder::getNull() { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNull( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NULL_); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isBoolean() const { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Builder::isBoolean() { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Reader::getBoolean() const { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Builder::getBoolean() { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setBoolean(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::BOOLEAN); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isNumber() const { - return which() == JsonValue::NUMBER; -} -inline bool JsonValue::Builder::isNumber() { - return which() == JsonValue::NUMBER; -} -inline double JsonValue::Reader::getNumber() const { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double JsonValue::Builder::getNumber() { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNumber(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NUMBER); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isString() const { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Builder::isString() { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Reader::hasString() const { - if (which() != JsonValue::STRING) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasString() { - if (which() != JsonValue::STRING) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Reader::getString() const { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Builder::getString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setString( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Builder::initString(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptString( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Builder::disownString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isArray() const { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Builder::isArray() { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Reader::hasArray() const { - if (which() != JsonValue::ARRAY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasArray() { - if (which() != JsonValue::ARRAY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Reader::getArray() const { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::getArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setArray( ::capnp::List< ::capnp::JsonValue>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::initArray(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptArray( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Builder::disownArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isObject() const { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Builder::isObject() { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Reader::hasObject() const { - if (which() != JsonValue::OBJECT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasObject() { - if (which() != JsonValue::OBJECT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Reader JsonValue::Reader::getObject() const { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::getObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::initObject(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptObject( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> JsonValue::Builder::disownObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isCall() const { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Builder::isCall() { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Reader::hasCall() const { - if (which() != JsonValue::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasCall() { - if (which() != JsonValue::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Call::Reader JsonValue::Reader::getCall() const { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::getCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setCall( ::capnp::JsonValue::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::adoptCall( - ::capnp::Orphan< ::capnp::JsonValue::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue::Call> JsonValue::Builder::disownCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Reader JsonValue::Field::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::JsonValue::Pipeline JsonValue::Field::Pipeline::getValue() { - return ::capnp::JsonValue::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void JsonValue::Field::Builder::setValue( ::capnp::JsonValue::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::adoptValue( - ::capnp::Orphan< ::capnp::JsonValue>&& value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue> JsonValue::Field::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasFunction() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasFunction() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Call::Reader::getFunction() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::getFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setFunction( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::initFunction(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptFunction( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Call::Builder::disownFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setParams( ::capnp::List< ::capnp::JsonValue>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::initParams(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -} // namespace - -#endif // CAPNP_INCLUDED_8ef99297a43a5e34_ diff --git a/external/capnp/include/capnp/compat/json.h b/external/capnp/include/capnp/compat/json.h deleted file mode 100644 index 7fa815e099..0000000000 --- a/external/capnp/include/capnp/compat/json.h +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_COMPAT_JSON_H_ -#define CAPNP_COMPAT_JSON_H_ - -#include -#include -#include - -namespace capnp { - -class JsonCodec { - // Flexible class for encoding Cap'n Proto types as JSON, and decoding JSON back to Cap'n Proto. - // - // Typical usage: - // - // JsonCodec json; - // - // // encode - // kj::String encoded = json.encode(someStructReader); - // - // // decode - // json.decode(encoded, someStructBuilder); - // - // Advanced users can do fancy things like override the way certain types or fields are - // represented in JSON by registering handlers. See the unit test for an example. - // - // Notes: - // - When encoding, all primitive fields are always encoded, even if default-valued. Pointer - // fields are only encoded if they are non-null. - // - 64-bit integers are encoded as strings, since JSON "numbers" are double-precision floating - // points which cannot store a 64-bit integer without losing data. - // - NaNs and infinite floating point numbers are not allowed by the JSON spec, and so are encoded - // as null. This matches the behavior of `JSON.stringify` in at least Firefox and Chrome. - // - Data is encoded as an array of numbers in the range [0,255]. You probably want to register - // a handler that does something better, like maybe base64 encoding, but there are a zillion - // different ways people do this. - // - Encoding/decoding capabilities and AnyPointers requires registering a Handler, since there's - // no obvious default behavior. - // - When decoding, unrecognized field names are ignored. Note: This means that JSON is NOT a - // good format for receiving input from a human. Consider `capnp eval` or the SchemaParser - // library for human input. - -public: - JsonCodec(); - ~JsonCodec() noexcept(false); - - // --------------------------------------------------------------------------- - // standard API - - void setPrettyPrint(bool enabled); - // Enable to insert newlines, indentation, and other extra spacing into the output. The default - // is to use minimal whitespace. - - void setMaxNestingDepth(size_t maxNestingDepth); - // Set maximum nesting depth when decoding JSON to prevent highly nested input from overflowing - // the call stack. The default is 64. - - template - kj::String encode(T&& value); - // Encode any Cap'n Proto value to JSON, including primitives and - // Dynamic{Enum,Struct,List,Capability}, but not DynamicValue (see below). - - kj::String encode(DynamicValue::Reader value, Type type) const; - // Encode a DynamicValue to JSON. `type` is needed because `DynamicValue` itself does - // not distinguish between e.g. int32 and int64, which in JSON are handled differently. Most - // of the time, though, you can use the single-argument templated version of `encode()` instead. - - void decode(kj::ArrayPtr input, DynamicStruct::Builder output) const; - // Decode JSON text directly into a struct builder. This only works for structs since lists - // need to be allocated with the correct size in advance. - // - // (Remember that any Cap'n Proto struct reader type can be implicitly cast to - // DynamicStruct::Reader.) - - template - Orphan decode(kj::ArrayPtr input, Orphanage orphanage) const; - // Decode JSON text to any Cap'n Proto object (pointer value), allocated using the given - // orphanage. T must be specified explicitly and cannot be dynamic, e.g.: - // - // Orphan orphan = json.decode(text, orphanage); - - template - ReaderFor decode(kj::ArrayPtr input) const; - // Decode JSON text into a primitive or capability value. T must be specified explicitly and - // cannot be dynamic, e.g.: - // - // uint32_t n = json.decode(text); - - Orphan decode(kj::ArrayPtr input, Type type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(kj::ArrayPtr input, InterfaceSchema type) const; - DynamicEnum decode(kj::ArrayPtr input, EnumSchema type) const; - // Decode to a dynamic value, specifying the type schema. - - // --------------------------------------------------------------------------- - // layered API - // - // You can separate text <-> JsonValue from JsonValue <-> T. These are particularly useful - // for calling from Handler implementations. - - kj::String encodeRaw(JsonValue::Reader value) const; - void decodeRaw(kj::ArrayPtr input, JsonValue::Builder output) const; - // Translate JsonValue <-> text. - - template - void encode(T&& value, JsonValue::Builder output); - void encode(DynamicValue::Reader input, Type type, JsonValue::Builder output) const; - void decode(JsonValue::Reader input, DynamicStruct::Builder output) const; - template - Orphan decode(JsonValue::Reader input, Orphanage orphanage) const; - template - ReaderFor decode(JsonValue::Reader input) const; - - Orphan decode(JsonValue::Reader input, Type type, Orphanage orphanage) const; - Orphan decode(JsonValue::Reader input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(JsonValue::Reader input, InterfaceSchema type) const; - DynamicEnum decode(JsonValue::Reader input, EnumSchema type) const; - - // --------------------------------------------------------------------------- - // specializing particular types - - template ()> - class Handler; - // Implement this interface to specify a special encoding for a particular type or field. - // - // The templates are a bit ugly, but subclasses of this type essentially implement two methods, - // one to encode values of this type and one to decode values of this type. `encode()` is simple: - // - // void encode(const JsonCodec& codec, ReaderFor input, JsonValue::Builder output) const; - // - // `decode()` is a bit trickier. When T is a struct (including DynamicStruct), it is: - // - // void decode(const JsonCodec& codec, JsonValue::Reader input, BuilderFor output) const; - // - // However, when T is a primitive, decode() is: - // - // T decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Or when T is any non-struct object (list, blob), decode() is: - // - // Orphan decode(const JsonCodec& codec, JsonValue::Reader input, Orphanage orphanage) const; - // - // Or when T is an interface: - // - // T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Additionally, when T is a struct you can *optionally* also implement the orphan-returning form - // of decode(), but it will only be called when the struct would be allocated as an individual - // object, not as part of a list. This allows you to return "nullptr" in these cases to say that - // the pointer value should be null. This does not apply to list elements because struct list - // elements cannot ever be null (since Cap'n Proto encodes struct lists as a flat list rather - // than list-of-pointers). - - template - void addTypeHandler(Handler& handler); - void addTypeHandler(Type type, Handler& handler); - void addTypeHandler(EnumSchema type, Handler& handler); - void addTypeHandler(StructSchema type, Handler& handler); - void addTypeHandler(ListSchema type, Handler& handler); - void addTypeHandler(InterfaceSchema type, Handler& handler); - // Arrange that whenever the type T appears in the message, your handler will be used to - // encode/decode it. - // - // Note that if you register a handler for a capability type, it will also apply to subtypes. - // Thus Handler handles all capabilities. - - template - void addFieldHandler(StructSchema::Field field, Handler& handler); - // Matches only the specific field. T can be a dynamic type. T must match the field's type. - -private: - class HandlerBase; - struct Impl; - - kj::Own impl; - - void encodeField(StructSchema::Field field, DynamicValue::Reader input, - JsonValue::Builder output) const; - void decodeArray(List::Reader input, DynamicList::Builder output) const; - void decodeObject(List::Reader input, DynamicStruct::Builder output) const; - void addTypeHandlerImpl(Type type, HandlerBase& handler); - void addFieldHandlerImpl(StructSchema::Field field, Type type, HandlerBase& handler); -}; - -// ======================================================================================= -// inline implementation details - -template -kj::String JsonCodec::encode(T&& value) { - typedef FromAny> Base; - return encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from()); -} - -template -inline Orphan JsonCodec::decode(kj::ArrayPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(kj::ArrayPtr input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - kj::ArrayPtr input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(kj::ArrayPtr input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -template -void JsonCodec::encode(T&& value, JsonValue::Builder output) { - typedef FromAny> Base; - encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from(), output); -} - -template -inline Orphan JsonCodec::decode(JsonValue::Reader input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(JsonValue::Reader input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - JsonValue::Reader input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - JsonValue::Reader input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(JsonValue::Reader input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -class JsonCodec::HandlerBase { - // Internal helper; ignore. -public: - virtual void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const = 0; - virtual Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const; - virtual void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - BuilderFor output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template <> -class JsonCodec::Handler: private JsonCodec::HandlerBase { - // Almost identical to Style::STRUCT except that we pass the struct type to decode(). - -public: - virtual void encode(const JsonCodec& codec, DynamicStruct::Reader input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - StructSchema type, Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(type); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, type.asStruct(), orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, T input, JsonValue::Builder output) const = 0; - virtual T decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, typename T::Client input, - JsonValue::Builder output) const = 0; - virtual typename T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return orphanage.newOrphanCopy(decode(codec, input)); - } - friend class JsonCodec; -}; - -template -inline void JsonCodec::addTypeHandler(Handler& handler) { - addTypeHandlerImpl(Type::from(), handler); -} -inline void JsonCodec::addTypeHandler(Type type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(EnumSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(StructSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(ListSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(InterfaceSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} - -template -inline void JsonCodec::addFieldHandler(StructSchema::Field field, Handler& handler) { - addFieldHandlerImpl(field, Type::from(), handler); -} - -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -// TODO(someday): Implement support for registering handlers that cover thinsg like "all structs" -// or "all lists". Currently you can only target a specific struct or list type. - -} // namespace capnp - -#endif // CAPNP_COMPAT_JSON_H_ diff --git a/external/capnp/include/capnp/dynamic.h b/external/capnp/include/capnp/dynamic.h deleted file mode 100644 index fcefcc3bf2..0000000000 --- a/external/capnp/include/capnp/dynamic.h +++ /dev/null @@ -1,1643 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines classes that can be used to manipulate messages based on schemas that are not -// known until runtime. This is also useful for writing generic code that uses schemas to handle -// arbitrary types in a generic way. -// -// Each of the classes defined here has a to() template method which converts an instance back to a -// native type. This method will throw an exception if the requested type does not match the -// schema. To convert native types to dynamic, use DynamicFactory. -// -// As always, underlying data is validated lazily, so you have to actually traverse the whole -// message if you want to validate all content. - -#ifndef CAPNP_DYNAMIC_H_ -#define CAPNP_DYNAMIC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include "layout.h" -#include "message.h" -#include "any.h" -#include "capability.h" - -namespace capnp { - -class MessageReader; -class MessageBuilder; - -struct DynamicValue { - DynamicValue() = delete; - - enum Type { - UNKNOWN, - // Means that the value has unknown type and content because it comes from a newer version of - // the schema, or from a newer version of Cap'n Proto that has new features that this version - // doesn't understand. - - VOID, - BOOL, - INT, - UINT, - FLOAT, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - CAPABILITY, - ANY_POINTER - }; - - class Reader; - class Builder; - class Pipeline; -}; -class DynamicEnum; -struct DynamicStruct { - DynamicStruct() = delete; - class Reader; - class Builder; - class Pipeline; -}; -struct DynamicList { - DynamicList() = delete; - class Reader; - class Builder; -}; -struct DynamicCapability { - DynamicCapability() = delete; - class Client; - class Server; -}; -template <> class Orphan; - -template struct DynamicTypeFor_; -template <> struct DynamicTypeFor_ { typedef DynamicEnum Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicStruct Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicList Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicCapability Type; }; - -template -using DynamicTypeFor = typename DynamicTypeFor_()>::Type; - -template -ReaderFor>> toDynamic(T&& value); -template -BuilderFor>> toDynamic(T&& value); -template -DynamicTypeFor> toDynamic(T&& value); -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value); - -namespace _ { // private - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -} // namespace _ (private) - -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::PRIMITIVE; } -template <> inline constexpr Style style() { return Style::STRUCT; } -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::CAPABILITY; } - -// ------------------------------------------------------------------- - -class DynamicEnum { -public: - DynamicEnum() = default; - inline DynamicEnum(EnumSchema::Enumerant enumerant) - : schema(enumerant.getContainingEnum()), value(enumerant.getOrdinal()) {} - inline DynamicEnum(EnumSchema schema, uint16_t value) - : schema(schema), value(value) {} - - template () == Kind::ENUM>> - inline DynamicEnum(T&& value): DynamicEnum(toDynamic(value)) {} - - template - inline T as() const { return static_cast(asImpl(typeId())); } - // Cast to a native enum type. - - inline EnumSchema getSchema() const { return schema; } - - kj::Maybe getEnumerant() const; - // Get which enumerant this enum value represents. Returns nullptr if the numeric value does not - // correspond to any enumerant in the schema -- this can happen if the data was built using a - // newer schema that has more values defined. - - inline uint16_t getRaw() const { return value; } - // Returns the raw underlying enum value. - -private: - EnumSchema schema; - uint16_t value; - - uint16_t asImpl(uint64_t requestedTypeId) const; - - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - template - friend DynamicTypeFor> toDynamic(T&& value); -}; - -// ------------------------------------------------------------------- - -class DynamicStruct::Reader { -public: - typedef DynamicStruct Reads; - - Reader() = default; - - template >() == Kind::STRUCT>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - inline MessageSize totalSize() const { return reader.totalSize().asPublic(); } - - template - typename T::Reader as() const; - // Convert the dynamic struct to its compiled-in type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Reader get(StructSchema::Field field) const; - // Read the given field value. - - bool has(StructSchema::Field field) const; - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns false if the union member is not - // active, but does not necessarily return true if the member is active (depends on the field's - // value). - - kj::Maybe which() const; - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - DynamicValue::Reader get(kj::StringPtr name) const; - bool has(kj::StringPtr name) const; - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - -private: - StructSchema schema; - _::StructReader reader; - - inline Reader(StructSchema schema, _::StructReader reader) - : schema(schema), reader(reader) {} - Reader(StructSchema schema, const _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field) const; - void verifySetInUnion(StructSchema::Field field) const; - static DynamicValue::Reader getImpl(_::StructReader reader, StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend class DynamicStruct::Builder; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Builder { -public: - typedef DynamicStruct Builds; - - Builder() = default; - inline Builder(decltype(nullptr)) {} - - template >() == Kind::STRUCT>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - inline MessageSize totalSize() const { return asReader().totalSize(); } - - template - typename T::Builder as(); - // Cast to a particular struct type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Builder get(StructSchema::Field field); - // Read the given field value. - - inline bool has(StructSchema::Field field) { return asReader().has(field); } - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns whether the field is currently - // active and the union as a whole is non-default -- so, the only time has() will return false - // for an active union field is if it is the default active field and it has its default value. - - kj::Maybe which(); - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - void set(StructSchema::Field field, const DynamicValue::Reader& value); - // Set the given field value. - - DynamicValue::Builder init(StructSchema::Field field); - DynamicValue::Builder init(StructSchema::Field field, uint size); - // Init a struct, list, or blob field. - - void adopt(StructSchema::Field field, Orphan&& orphan); - Orphan disown(StructSchema::Field field); - // Adopt/disown. This works even for non-pointer fields: adopt() becomes equivalent to set() - // and disown() becomes like get() followed by clear(). - - void clear(StructSchema::Field field); - // Clear a field, setting it to its default value. For pointer fields, this actually makes the - // field null. - - DynamicValue::Builder get(kj::StringPtr name); - bool has(kj::StringPtr name); - void set(kj::StringPtr name, const DynamicValue::Reader& value); - void set(kj::StringPtr name, std::initializer_list value); - DynamicValue::Builder init(kj::StringPtr name); - DynamicValue::Builder init(kj::StringPtr name, uint size); - void adopt(kj::StringPtr name, Orphan&& orphan); - Orphan disown(kj::StringPtr name); - void clear(kj::StringPtr name); - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - - Reader asReader() const; - -private: - StructSchema schema; - _::StructBuilder builder; - - inline Builder(StructSchema schema, _::StructBuilder builder) - : schema(schema), builder(builder) {} - Builder(StructSchema schema, _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field); - void verifySetInUnion(StructSchema::Field field); - void setInUnion(StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Pipeline { -public: - typedef DynamicStruct Pipelines; - - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - - template - typename T::Pipeline releaseAs(); - // Convert the dynamic pipeline to its compiled-in type. - - inline StructSchema getSchema() { return schema; } - - DynamicValue::Pipeline get(StructSchema::Field field); - // Read the given field value. - - DynamicValue::Pipeline get(kj::StringPtr name); - // Get by string name. - -private: - StructSchema schema; - AnyPointer::Pipeline typeless; - - inline explicit Pipeline(StructSchema schema, AnyPointer::Pipeline&& typeless) - : schema(schema), typeless(kj::mv(typeless)) {} - - friend class Request; -}; - -// ------------------------------------------------------------------- - -class DynamicList::Reader { -public: - typedef DynamicList Reads; - - inline Reader(): reader(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - template - typename T::Reader as() const; - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - DynamicValue::Reader operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - ListSchema schema; - _::ListReader reader; - - Reader(ListSchema schema, _::ListReader reader): schema(schema), reader(reader) {} - Reader(ListSchema schema, const _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend class DynamicList::Builder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicList::Builder { -public: - typedef DynamicList Builds; - - inline Builder(): builder(ElementSize::VOID) {} - inline Builder(decltype(nullptr)): builder(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - template - typename T::Builder as(); - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - DynamicValue::Builder operator[](uint index); - void set(uint index, const DynamicValue::Reader& value); - DynamicValue::Builder init(uint index, uint size); - void adopt(uint index, Orphan&& orphan); - Orphan disown(uint index); - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - void copyFrom(std::initializer_list value); - - Reader asReader() const; - -private: - ListSchema schema; - _::ListBuilder builder; - - Builder(ListSchema schema, _::ListBuilder builder): schema(schema), builder(builder) {} - Builder(ListSchema schema, _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - template - friend struct _::OrphanGetImpl; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -// ------------------------------------------------------------------- - -class DynamicCapability::Client: public Capability::Client { -public: - typedef DynamicCapability Calls; - typedef DynamicCapability Reads; - - Client() = default; - - template >() == Kind::INTERFACE>> - inline Client(T&& client); - - template ()>> - inline Client(kj::Own&& server); - - template () == Kind::INTERFACE>> - typename T::Client as(); - template () == Kind::INTERFACE>> - typename T::Client releaseAs(); - // Convert to any client type. - - Client upcast(InterfaceSchema requestedSchema); - // Upcast to a superclass. Throws an exception if `schema` is not a superclass. - - inline InterfaceSchema getSchema() { return schema; } - - Request newRequest( - InterfaceSchema::Method method, kj::Maybe sizeHint = nullptr); - Request newRequest( - kj::StringPtr methodName, kj::Maybe sizeHint = nullptr); - -private: - InterfaceSchema schema; - - Client(InterfaceSchema schema, kj::Own&& hook) - : Capability::Client(kj::mv(hook)), schema(schema) {} - - template - inline Client(InterfaceSchema schema, kj::Own&& server); - - friend struct Capability; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - friend class Orphan; - friend class Orphan; - friend class Orphan; - template - friend struct _::PointerHelpers; -}; - -class DynamicCapability::Server: public Capability::Server { -public: - typedef DynamicCapability Serves; - - Server(InterfaceSchema schema): schema(schema) {} - - virtual kj::Promise call(InterfaceSchema::Method method, - CallContext context) = 0; - - kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) override final; - - inline InterfaceSchema getSchema() const { return schema; } - -private: - InterfaceSchema schema; -}; - -template <> -class Request: public DynamicStruct::Builder { - // Specialization of `Request` for DynamicStruct. - -public: - inline Request(DynamicStruct::Builder builder, kj::Own&& hook, - StructSchema resultSchema) - : DynamicStruct::Builder(builder), hook(kj::mv(hook)), resultSchema(resultSchema) {} - - RemotePromise send(); - // Send the call and return a promise for the results. - -private: - kj::Own hook; - StructSchema resultSchema; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template <> -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - -public: - explicit CallContext(CallContextHook& hook, StructSchema paramType, StructSchema resultType); - - DynamicStruct::Reader getParams(); - void releaseParams(); - DynamicStruct::Builder getResults(kj::Maybe sizeHint = nullptr); - DynamicStruct::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(DynamicStruct::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - template - kj::Promise tailCall(Request&& tailRequest); - void allowCancellation(); - -private: - CallContextHook* hook; - StructSchema paramType; - StructSchema resultType; - - friend class DynamicCapability::Server; -}; - -// ------------------------------------------------------------------- - -// Make sure ReaderFor and BuilderFor work for DynamicEnum, DynamicStruct, and -// DynamicList, so that we can define DynamicValue::as(). - -template <> struct ReaderFor_ { typedef DynamicEnum Type; }; -template <> struct BuilderFor_ { typedef DynamicEnum Type; }; -template <> struct ReaderFor_ { typedef DynamicStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicStruct::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicList::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicList::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct BuilderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct PipelineFor_ { typedef DynamicCapability::Client Type; }; - -class DynamicValue::Reader { -public: - typedef DynamicValue Reads; - - inline Reader(decltype(nullptr) n = nullptr); // UNKNOWN - inline Reader(Void value); - inline Reader(bool value); - inline Reader(char value); - inline Reader(signed char value); - inline Reader(short value); - inline Reader(int value); - inline Reader(long value); - inline Reader(long long value); - inline Reader(unsigned char value); - inline Reader(unsigned short value); - inline Reader(unsigned int value); - inline Reader(unsigned long value); - inline Reader(unsigned long long value); - inline Reader(float value); - inline Reader(double value); - inline Reader(const char* value); // Text - inline Reader(const Text::Reader& value); - inline Reader(const Data::Reader& value); - inline Reader(const DynamicList::Reader& value); - inline Reader(DynamicEnum value); - inline Reader(const DynamicStruct::Reader& value); - inline Reader(const AnyPointer::Reader& value); - inline Reader(DynamicCapability::Client& value); - inline Reader(DynamicCapability::Client&& value); - template ()>> - inline Reader(kj::Own&& value); - Reader(ConstSchema constant); - - template ()))> - inline Reader(T&& value): Reader(toDynamic(kj::mv(value))) {} - - Reader(const Reader& other); - Reader(Reader&& other) noexcept; - ~Reader() noexcept(false); - Reader& operator=(const Reader& other); - Reader& operator=(Reader&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline ReaderFor as() const { return AsImpl::apply(*this); } - // Use to interpret the value as some Cap'n Proto type. Allowed types are: - // - Void, bool, [u]int{8,16,32,64}_t, float, double, any enum: Returns the raw value. - // - Text, Data, AnyPointer, any struct type: Returns the corresponding Reader. - // - List for any T listed above: Returns List::Reader. - // - DynamicEnum: Returns the corresponding type. - // - DynamicStruct, DynamicList: Returns the corresponding Reader. - // - Any capability type, including DynamicCapability: Returns the corresponding Client. - // - DynamicValue: Returns an identical Reader. Useful to avoid special-casing in generic code. - // (TODO(perf): On GCC 4.8 / Clang 3.3, provide rvalue-qualified version that avoids - // refcounting.) - // - // DynamicValue allows various implicit conversions, mostly just to make the interface friendlier. - // - Any integer can be converted to any other integer type so long as the actual value is within - // the new type's range. - // - Floating-point types can be converted to integers as long as no information would be lost - // in the conversion. - // - Integers can be converted to floating points. This may lose information, but won't throw. - // - Float32/Float64 can be converted between each other. Converting Float64 -> Float32 may lose - // information, but won't throw. - // - Text can be converted to an enum, if the Text matches one of the enumerant names (but not - // vice-versa). - // - Capabilities can be upcast (cast to a supertype), but not downcast. - // - // Any other conversion attempt will throw an exception. - - inline Type getType() const { return type; } - // Get the type of this value. - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Reader textValue; - Data::Reader dataValue; - DynamicList::Reader listValue; - DynamicEnum enumValue; - DynamicStruct::Reader structValue; - AnyPointer::Reader anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - - // Warning: Copy/move constructors assume all these types are trivially copyable except - // Capability. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphanage; // to speed up newOrphanCopy(DynamicValue::Reader) -}; - -class DynamicValue::Builder { -public: - typedef DynamicValue Builds; - - inline Builder(decltype(nullptr) n = nullptr); // UNKNOWN - inline Builder(Void value); - inline Builder(bool value); - inline Builder(char value); - inline Builder(signed char value); - inline Builder(short value); - inline Builder(int value); - inline Builder(long value); - inline Builder(long long value); - inline Builder(unsigned char value); - inline Builder(unsigned short value); - inline Builder(unsigned int value); - inline Builder(unsigned long value); - inline Builder(unsigned long long value); - inline Builder(float value); - inline Builder(double value); - inline Builder(Text::Builder value); - inline Builder(Data::Builder value); - inline Builder(DynamicList::Builder value); - inline Builder(DynamicEnum value); - inline Builder(DynamicStruct::Builder value); - inline Builder(AnyPointer::Builder value); - inline Builder(DynamicCapability::Client& value); - inline Builder(DynamicCapability::Client&& value); - - template ()))> - inline Builder(T value): Builder(toDynamic(value)) {} - - Builder(Builder& other); - Builder(Builder&& other) noexcept; - ~Builder() noexcept(false); - Builder& operator=(Builder& other); - Builder& operator=(Builder&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline BuilderFor as() { return AsImpl::apply(*this); } - // See DynamicValue::Reader::as(). - - inline Type getType() { return type; } - // Get the type of this value. - - Reader asReader() const; - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Builder textValue; - Data::Builder dataValue; - DynamicList::Builder listValue; - DynamicEnum enumValue; - DynamicStruct::Builder structValue; - AnyPointer::Builder anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphan; -}; - -class DynamicValue::Pipeline { -public: - typedef DynamicValue Pipelines; - - inline Pipeline(decltype(nullptr) n = nullptr); - inline Pipeline(DynamicStruct::Pipeline&& value); - inline Pipeline(DynamicCapability::Client&& value); - - Pipeline(Pipeline&& other) noexcept; - Pipeline& operator=(Pipeline&& other); - ~Pipeline() noexcept(false); - - template - inline PipelineFor releaseAs() { return AsImpl::apply(*this); } - - inline Type getType() { return type; } - // Get the type of this value. - -private: - Type type; - union { - DynamicStruct::Pipeline structValue; - DynamicCapability::Client capabilityValue; - }; - - template ()> struct AsImpl; - // Implementation backing the releaseAs() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. -}; - -kj::StringTree KJ_STRINGIFY(const DynamicValue::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicValue::Builder& value); -kj::StringTree KJ_STRINGIFY(DynamicEnum value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Builder& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Builder& value); - -// ------------------------------------------------------------------- -// Orphan <-> Dynamic glue - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::STRUCT>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicStruct::Builder get(); - DynamicStruct::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicStruct::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - StructSchema schema; - _::OrphanBuilder builder; - - inline Orphan(StructSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class MessageBuilder; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::LIST>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicList::Builder get(); - DynamicList::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicList::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - // TODO(someday): Support truncate(). - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - ListSchema schema; - _::OrphanBuilder builder; - - inline Orphan(ListSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::INTERFACE>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicCapability::Client get(); - DynamicCapability::Client getReader() const; - - template - Orphan releaseAs(); - // Like DynamicCapability::Client::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - InterfaceSchema schema; - _::OrphanBuilder builder; - - inline Orphan(InterfaceSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - inline Orphan(decltype(nullptr) n = nullptr): type(DynamicValue::UNKNOWN) {} - inline Orphan(Void value); - inline Orphan(bool value); - inline Orphan(char value); - inline Orphan(signed char value); - inline Orphan(short value); - inline Orphan(int value); - inline Orphan(long value); - inline Orphan(long long value); - inline Orphan(unsigned char value); - inline Orphan(unsigned short value); - inline Orphan(unsigned int value); - inline Orphan(unsigned long value); - inline Orphan(unsigned long long value); - inline Orphan(float value); - inline Orphan(double value); - inline Orphan(DynamicEnum value); - Orphan(Orphan&&) = default; - template - Orphan(Orphan&&); - Orphan(Orphan&&); - Orphan(void*) = delete; // So Orphan(bool) doesn't accept pointers. - KJ_DISALLOW_COPY(Orphan); - - Orphan& operator=(Orphan&&) = default; - - inline DynamicValue::Type getType() { return type; } - - DynamicValue::Builder get(); - DynamicValue::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicValue::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - -private: - DynamicValue::Type type; - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - DynamicEnum enumValue; - StructSchema structSchema; - ListSchema listSchema; - InterfaceSchema interfaceSchema; - }; - - _::OrphanBuilder builder; - // Only used if `type` is a pointer type. - - Orphan(DynamicValue::Builder value, _::OrphanBuilder&& builder); - Orphan(DynamicValue::Type type, _::OrphanBuilder&& builder) - : type(type), builder(kj::mv(builder)) {} - Orphan(StructSchema structSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::STRUCT), structSchema(structSchema), builder(kj::mv(builder)) {} - Orphan(ListSchema listSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::LIST), listSchema(listSchema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct AnyPointer; - friend class Orphanage; -}; - -template -inline Orphan::Orphan(Orphan&& other) - : Orphan(other.get(), kj::mv(other.builder)) {} - -inline Orphan::Orphan(Orphan&& other) - : type(DynamicValue::ANY_POINTER), builder(kj::mv(other.builder)) {} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - type = DynamicValue::UNKNOWN; - return Orphan(kj::mv(builder)); -} - -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(DynamicStruct::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(DynamicList::Builder& t) { - return t.builder; - } -}; - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicStruct::Reader copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicList::Reader copyFrom) const { - return Orphan(copyFrom.getSchema(), - _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicCapability::Client copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.hook->addRef())); -} - -template <> -Orphan Orphanage::newOrphanCopy( - DynamicValue::Reader copyFrom) const; - -namespace _ { // private - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicStruct::Reader getDynamic(PointerReader reader, StructSchema schema); - static DynamicStruct::Builder getDynamic(PointerBuilder builder, StructSchema schema); - static void set(PointerBuilder builder, const DynamicStruct::Reader& value); - static DynamicStruct::Builder init(PointerBuilder builder, StructSchema schema); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, StructSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicList::Reader getDynamic(PointerReader reader, ListSchema schema); - static DynamicList::Builder getDynamic(PointerBuilder builder, ListSchema schema); - static void set(PointerBuilder builder, const DynamicList::Reader& value); - static DynamicList::Builder init(PointerBuilder builder, ListSchema schema, uint size); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, ListSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicCapability::Client getDynamic(PointerReader reader, InterfaceSchema schema); - static DynamicCapability::Client getDynamic(PointerBuilder builder, InterfaceSchema schema); - static void set(PointerBuilder builder, DynamicCapability::Client& value); - static void set(PointerBuilder builder, DynamicCapability::Client&& value); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, InterfaceSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -} // namespace _ (private) - -template -inline ReaderFor AnyPointer::Reader::getAs(StructSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(ListSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(InterfaceSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(StructSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(ListSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(InterfaceSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(StructSchema schema) { - return _::PointerHelpers::init(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(ListSchema schema, uint elementCount) { - return _::PointerHelpers::init(builder, schema, elementCount); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicStruct::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicList::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicCapability::Client value) { - return _::PointerHelpers::set(builder, kj::mv(value)); -} -template <> -void AnyPointer::Builder::adopt(Orphan&& orphan); -template -inline Orphan AnyPointer::Builder::disownAs(StructSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(ListSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(InterfaceSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} - -// We have to declare the methods below inline because Clang and GCC disagree about how to mangle -// their symbol names. -template <> -inline DynamicStruct::Builder Orphan::getAs(StructSchema schema) { - return DynamicStruct::Builder(schema, builder); -} -template <> -inline DynamicStruct::Reader Orphan::getAsReader( - StructSchema schema) const { - return DynamicStruct::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(StructSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicList::Builder Orphan::getAs(ListSchema schema) { - return DynamicList::Builder(schema, builder); -} -template <> -inline DynamicList::Reader Orphan::getAsReader(ListSchema schema) const { - return DynamicList::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(ListSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicCapability::Client Orphan::getAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline DynamicCapability::Client Orphan::getAsReader( - InterfaceSchema schema) const { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline Orphan Orphan::releaseAs( - InterfaceSchema schema) { - return Orphan(schema, kj::mv(builder)); -} - -// ======================================================================================= -// Inline implementation details. - -template -struct ToDynamic_ { - static inline DynamicStruct::Reader apply(const typename T::Reader& value) { - return DynamicStruct::Reader(Schema::from(), value._reader); - } - static inline DynamicStruct::Builder apply(typename T::Builder& value) { - return DynamicStruct::Builder(Schema::from(), value._builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicList::Reader apply(const typename T::Reader& value) { - return DynamicList::Reader(Schema::from(), value.reader); - } - static inline DynamicList::Builder apply(typename T::Builder& value) { - return DynamicList::Builder(Schema::from(), value.builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicCapability::Client apply(typename T::Client value) { - return DynamicCapability::Client(kj::mv(value)); - } - static inline DynamicCapability::Client apply(typename T::Client&& value) { - return DynamicCapability::Client(kj::mv(value)); - } -}; - -template -ReaderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -BuilderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -DynamicTypeFor> toDynamic(T&& value) { - return DynamicEnum(Schema::from>(), static_cast(value)); -} -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value) { - return typename FromServer::Client(kj::mv(value)); -} - -inline DynamicValue::Reader::Reader(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Builder::Builder(std::nullptr_t n): type(UNKNOWN) {} - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline Orphan::Orphan(cppType value) \ - : type(DynamicValue::typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Void, VOID, void); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(bool, BOOL, bool); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(signed char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(short, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(int, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned char, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned short, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned int, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(float, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(double, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicEnum, ENUM, enum); -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(const cppType::Reader& value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType::Builder value) \ - : type(typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Text, TEXT, text); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Data, DATA, data); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicList, LIST, list); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicStruct, STRUCT, struct); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(AnyPointer, ANY_POINTER, anyPointer); - -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -inline DynamicValue::Reader::Reader(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Reader::Reader(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -template -inline DynamicValue::Reader::Reader(kj::Own&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -inline DynamicValue::Reader::Reader(const char* value): Reader(Text::Reader(value)) {} - -#define CAPNP_DECLARE_TYPE(discrim, typeName) \ -template <> \ -struct DynamicValue::Reader::AsImpl { \ - static ReaderFor apply(const Reader& reader); \ -}; \ -template <> \ -struct DynamicValue::Builder::AsImpl { \ - static BuilderFor apply(Builder& builder); \ -}; - -//CAPNP_DECLARE_TYPE(VOID, Void) -CAPNP_DECLARE_TYPE(BOOL, bool) -CAPNP_DECLARE_TYPE(INT8, int8_t) -CAPNP_DECLARE_TYPE(INT16, int16_t) -CAPNP_DECLARE_TYPE(INT32, int32_t) -CAPNP_DECLARE_TYPE(INT64, int64_t) -CAPNP_DECLARE_TYPE(UINT8, uint8_t) -CAPNP_DECLARE_TYPE(UINT16, uint16_t) -CAPNP_DECLARE_TYPE(UINT32, uint32_t) -CAPNP_DECLARE_TYPE(UINT64, uint64_t) -CAPNP_DECLARE_TYPE(FLOAT32, float) -CAPNP_DECLARE_TYPE(FLOAT64, double) - -CAPNP_DECLARE_TYPE(TEXT, Text) -CAPNP_DECLARE_TYPE(DATA, Data) -CAPNP_DECLARE_TYPE(LIST, DynamicList) -CAPNP_DECLARE_TYPE(STRUCT, DynamicStruct) -CAPNP_DECLARE_TYPE(INTERFACE, DynamicCapability) -CAPNP_DECLARE_TYPE(ENUM, DynamicEnum) -CAPNP_DECLARE_TYPE(ANY_POINTER, AnyPointer) -#undef CAPNP_DECLARE_TYPE - -// CAPNP_DECLARE_TYPE(Void) causes gcc 4.7 to segfault. If I do it manually and remove the -// ReaderFor<> and BuilderFor<> wrappers, it works. -template <> -struct DynamicValue::Reader::AsImpl { - static Void apply(const Reader& reader); -}; -template <> -struct DynamicValue::Builder::AsImpl { - static Void apply(Builder& builder); -}; - -template -struct DynamicValue::Reader::AsImpl { - static T apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static T apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Client apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Client apply(Builder& builder) { - return builder.as().as(); - } -}; - -template <> -struct DynamicValue::Reader::AsImpl { - static DynamicValue::Reader apply(const Reader& reader) { - return reader; - } -}; -template <> -struct DynamicValue::Builder::AsImpl { - static DynamicValue::Builder apply(Builder& builder) { - return builder; - } -}; - -inline DynamicValue::Pipeline::Pipeline(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Pipeline::Pipeline(DynamicStruct::Pipeline&& value) - : type(STRUCT), structValue(kj::mv(value)) {} -inline DynamicValue::Pipeline::Pipeline(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Pipeline apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Client apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicStruct::Reader::as() const { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Reader::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} - -template -typename T::Builder DynamicStruct::Builder::as() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Builder::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicStruct::Reader DynamicStruct::Reader::as() const { - return *this; -} -template <> -inline DynamicStruct::Builder DynamicStruct::Builder::as() { - return *this; -} - -inline DynamicStruct::Reader DynamicStruct::Builder::asReader() const { - return DynamicStruct::Reader(schema, builder.asReader()); -} - -template <> -inline AnyStruct::Reader DynamicStruct::Reader::as() const { - return AnyStruct::Reader(reader); -} - -template <> -inline AnyStruct::Builder DynamicStruct::Builder::as() { - return AnyStruct::Builder(builder); -} - -template -typename T::Pipeline DynamicStruct::Pipeline::releaseAs() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Pipeline::releaseAs() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Pipeline(kj::mv(typeless)); -} - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicList::Reader::as() const { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Reader::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} -template -typename T::Builder DynamicList::Builder::as() { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Builder::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicList::Reader DynamicList::Reader::as() const { - return *this; -} -template <> -inline DynamicList::Builder DynamicList::Builder::as() { - return *this; -} - -template <> -inline AnyList::Reader DynamicList::Reader::as() const { - return AnyList::Reader(reader); -} - -template <> -inline AnyList::Builder DynamicList::Builder::as() { - return AnyList::Builder(builder); -} - -// ------------------------------------------------------------------- - -template -inline DynamicCapability::Client::Client(T&& client) - : Capability::Client(kj::mv(client)), schema(Schema::from>()) {} - -template -inline DynamicCapability::Client::Client(kj::Own&& server) - : Client(server->getSchema(), kj::mv(server)) {} -template -inline DynamicCapability::Client::Client(InterfaceSchema schema, kj::Own&& server) - : Capability::Client(kj::mv(server)), schema(schema) {} - -template -typename T::Client DynamicCapability::Client::as() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(hook->addRef()); -} - -template -typename T::Client DynamicCapability::Client::releaseAs() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(kj::mv(hook)); -} - -inline CallContext::CallContext( - CallContextHook& hook, StructSchema paramType, StructSchema resultType) - : hook(&hook), paramType(paramType), resultType(resultType) {} -inline DynamicStruct::Reader CallContext::getParams() { - return hook->getParams().getAs(paramType); -} -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -inline DynamicStruct::Builder CallContext::getResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).getAs(resultType); -} -inline DynamicStruct::Builder CallContext::initResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).initAs(resultType); -} -inline void CallContext::setResults(DynamicStruct::Reader value) { - hook->getResults(value.totalSize()).setAs(value); -} -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(MessageSize { 0, 0 }).adopt(kj::mv(value)); -} -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template <> -inline DynamicCapability::Client Capability::Client::castAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, hook->addRef()); -} - -// ------------------------------------------------------------------- - -template -ReaderFor ConstSchema::as() const { - return DynamicValue::Reader(*this).as(); -} - -} // namespace capnp - -#endif // CAPNP_DYNAMIC_H_ diff --git a/external/capnp/include/capnp/endian.h b/external/capnp/include/capnp/endian.h deleted file mode 100644 index c5a6e63c5a..0000000000 --- a/external/capnp/include/capnp/endian.h +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ENDIAN_H_ -#define CAPNP_ENDIAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include // memcpy - -namespace capnp { -namespace _ { // private - -// WireValue -// -// Wraps a primitive value as it appears on the wire. Namely, values are little-endian on the -// wire, because little-endian is the most common endianness in modern CPUs. -// -// Note: In general, code that depends cares about byte ordering is bad. See: -// http://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html -// Cap'n Proto is special because it is essentially doing compiler-like things, fussing over -// allocation and layout of memory, in order to squeeze out every last drop of performance. - -#if _MSC_VER -// Assume Windows is little-endian. -// -// TODO(msvc): This is ugly. Maybe refactor later checks to be based on CAPNP_BYTE_ORDER or -// CAPNP_SWAP_BYTES or something, and define that in turn based on _MSC_VER or the GCC -// intrinsics. - -#ifndef __ORDER_BIG_ENDIAN__ -#define __ORDER_BIG_ENDIAN__ 4321 -#endif -#ifndef __ORDER_LITTLE_ENDIAN__ -#define __ORDER_LITTLE_ENDIAN__ 1234 -#endif -#ifndef __BYTE_ORDER__ -#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ -#endif -#endif - -#if CAPNP_REVERSE_ENDIAN -#define CAPNP_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#else -#define CAPNP_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#endif - -#if defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_WIRE_BYTE_ORDER && \ - !CAPNP_DISABLE_ENDIAN_DETECTION -// CPU is little-endian. We can just read/write the memory directly. - -template -class DirectWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -using WireValue = DirectWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#elif defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER && \ - defined(__GNUC__) && !CAPNP_DISABLE_ENDIAN_DETECTION -// Big-endian, but GCC's __builtin_bswap() is available. - -// TODO(perf): Use dedicated instructions to read little-endian data on big-endian CPUs that have -// them. - -// TODO(perf): Verify that this code optimizes reasonably. In particular, ensure that the -// compiler optimizes away the memcpy()s and keeps everything in registers. - -template -class SwappingWireValue; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - uint16_t swapped = (value << 8) | (value >> 8); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - value = (raw << 8) | (raw >> 8); - } - -private: - uint16_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t swapped = __builtin_bswap32(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap32(raw); - } - -private: - uint32_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t swapped = __builtin_bswap64(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap64(raw); - } - -private: - uint64_t value; -}; - -template -using WireValue = SwappingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#else -// Unknown endianness. Fall back to bit shifts. - -#if !CAPNP_DISABLE_ENDIAN_DETECTION -#if _MSC_VER -#pragma message("Couldn't detect endianness of your platform. Using unoptimized fallback implementation.") -#pragma message("Consider changing this code to detect your platform and send us a patch!") -#else -#warning "Couldn't detect endianness of your platform. Using unoptimized fallback implementation." -#warning "Consider changing this code to detect your platform and send us a patch!" -#endif -#endif // !CAPNP_DISABLE_ENDIAN_DETECTION - -template -class ShiftingWireValue; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint16_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - } - -private: - union { - byte bytes[2]; - uint16_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - } - -private: - union { - byte bytes[4]; - uint32_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24) | - (static_cast(bytes[4]) << 32) | - (static_cast(bytes[5]) << 40) | - (static_cast(bytes[6]) << 48) | - (static_cast(bytes[7]) << 56); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - bytes[4] = raw >> 32; - bytes[5] = raw >> 40; - bytes[6] = raw >> 48; - bytes[7] = raw >> 56; - } - -private: - union { - byte bytes[8]; - uint64_t align; - }; -}; - -template -using WireValue = ShiftingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#endif - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_ENDIAN_H_ diff --git a/external/capnp/include/capnp/ez-rpc.h b/external/capnp/include/capnp/ez-rpc.h deleted file mode 100644 index fba5ace582..0000000000 --- a/external/capnp/include/capnp/ez-rpc.h +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_EZ_RPC_H_ -#define CAPNP_EZ_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" - -struct sockaddr; - -namespace kj { class AsyncIoProvider; class LowLevelAsyncIoProvider; } - -namespace capnp { - -class EzRpcContext; - -class EzRpcClient { - // Super-simple interface for setting up a Cap'n Proto RPC client. Example: - // - // # Cap'n Proto schema - // interface Adder { - // add @0 (left :Int32, right :Int32) -> (value :Int32); - // } - // - // // C++ client - // int main() { - // capnp::EzRpcClient client("localhost:3456"); - // Adder::Client adder = client.getMain(); - // auto request = adder.addRequest(); - // request.setLeft(12); - // request.setRight(34); - // auto response = request.send().wait(client.getWaitScope()); - // assert(response.getValue() == 46); - // return 0; - // } - // - // // C++ server - // class AdderImpl final: public Adder::Server { - // public: - // kj::Promise add(AddContext context) override { - // auto params = context.getParams(); - // context.getResults().setValue(params.getLeft() + params.getRight()); - // return kj::READY_NOW; - // } - // }; - // - // int main() { - // capnp::EzRpcServer server(kj::heap(), "*:3456"); - // kj::NEVER_DONE.wait(server.getWaitScope()); - // } - // - // This interface is easy, but it hides a lot of useful features available from the lower-level - // classes: - // - The server can only export a small set of public, singleton capabilities under well-known - // string names. This is fine for transient services where no state needs to be kept between - // connections, but hides the power of Cap'n Proto when it comes to long-lived resources. - // - EzRpcClient/EzRpcServer automatically set up a `kj::EventLoop` and make it current for the - // thread. Only one `kj::EventLoop` can exist per thread, so you cannot use these interfaces - // if you wish to set up your own event loop. (However, you can safely create multiple - // EzRpcClient / EzRpcServer objects in a single thread; they will make sure to make no more - // than one EventLoop.) - // - These classes only support simple two-party connections, not multilateral VatNetworks. - // - These classes only support communication over a raw, unencrypted socket. If you want to - // build on an abstract stream (perhaps one which supports encryption), you must use the - // lower-level interfaces. - // - // Some of these restrictions will probably be lifted in future versions, but some things will - // always require using the low-level interfaces directly. If you are interested in working - // at a lower level, start by looking at these interfaces: - // - `kj::setupAsyncIo()` in `kj/async-io.h`. - // - `RpcSystem` in `capnp/rpc.h`. - // - `TwoPartyVatNetwork` in `capnp/rpc-twoparty.h`. - -public: - explicit EzRpcClient(kj::StringPtr serverAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()); - // Construct a new EzRpcClient and connect to the given address. The connection is formed in - // the background -- if it fails, calls to capabilities returned by importCap() will fail with an - // appropriate exception. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, the port is required in `serverAddress`. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcClient(const struct sockaddr* serverAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but connects to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - explicit EzRpcClient(int socketFd, ReaderOptions readerOpts = ReaderOptions()); - // Create a client on top of an already-connected socket. - // `readerOpts` acts as in the first constructor. - - ~EzRpcClient() noexcept(false); - - template - typename Type::Client getMain(); - Capability::Client getMain(); - // Get the server's main (aka "bootstrap") interface. - - template - typename Type::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - Capability::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - // ** DEPRECATED ** - // - // Ask the sever for the capability with the given name. You may specify a type to automatically - // down-cast to that type. It is up to you to specify the correct expected type. - // - // Named interfaces are deprecated. The new preferred usage pattern is for the server to export - // a "main" interface which itself has methods for getting any other interfaces. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -class EzRpcServer { - // The server counterpart to `EzRpcClient`. See `EzRpcClient` for an example. - -public: - explicit EzRpcServer(Capability::Client mainInterface, kj::StringPtr bindAddress, - uint defaultPort = 0, ReaderOptions readerOpts = ReaderOptions()); - // Construct a new `EzRpcServer` that binds to the given address. An address of "*" means to - // bind to all local addresses. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, a port is chosen automatically, and you must call getPort() to find out what - // it is. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // The server might not begin listening immediately, especially if `bindAddress` needs to be - // resolved. If you need to wait until the server is definitely up, wait on the promise returned - // by `getPort()`. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcServer(Capability::Client mainInterface, struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but binds to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - EzRpcServer(Capability::Client mainInterface, int socketFd, uint port, - ReaderOptions readerOpts = ReaderOptions()); - // Create a server on top of an already-listening socket (i.e. one on which accept() may be - // called). `port` is returned by `getPort()` -- it serves no other purpose. - // `readerOpts` acts as in the other two above constructors. - - explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(int socketFd, uint port, ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - - ~EzRpcServer() noexcept(false); - - void exportCap(kj::StringPtr name, Capability::Client cap); - // Export a capability publicly under the given name, so that clients can import it. - // - // Keep in mind that you can implicitly convert `kj::Own&&` to - // `Capability::Client`, so it's typical to pass something like - // `kj::heap()` as the second parameter. - - kj::Promise getPort(); - // Get the IP port number on which this server is listening. This promise won't resolve until - // the server is actually listening. If the address was not an IP address (e.g. it was a Unix - // domain socket) then getPort() resolves to zero. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -inline typename Type::Client EzRpcClient::getMain() { - return getMain().castAs(); -} - -template -inline typename Type::Client EzRpcClient::importCap(kj::StringPtr name) { - return importCap(name).castAs(); -} - -} // namespace capnp - -#endif // CAPNP_EZ_RPC_H_ diff --git a/external/capnp/include/capnp/generated-header-support.h b/external/capnp/include/capnp/generated-header-support.h deleted file mode 100644 index 51b6dd7c11..0000000000 --- a/external/capnp/include/capnp/generated-header-support.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is included from all generated headers. - -#ifndef CAPNP_GENERATED_HEADER_SUPPORT_H_ -#define CAPNP_GENERATED_HEADER_SUPPORT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "raw-schema.h" -#include "layout.h" -#include "list.h" -#include "orphan.h" -#include "pointer-helpers.h" -#include "any.h" -#include -#include - -namespace capnp { - -class MessageBuilder; // So that it can be declared a friend. - -template -struct ToDynamic_; // Defined in dynamic.h, needs to be declared as everyone's friend. - -struct DynamicStruct; // So that it can be declared a friend. - -struct Capability; // To declare brandBindingFor() - -namespace _ { // private - -#if !CAPNP_LITE - -template -inline const RawSchema& rawSchema() { - return *CapnpPrivate::schema; -} -template ::typeId> -inline const RawSchema& rawSchema() { - return *schemas::EnumInfo::schema; -} - -template -inline const RawBrandedSchema& rawBrandedSchema() { - return *CapnpPrivate::brand(); -} -template ::typeId> -inline const RawBrandedSchema& rawBrandedSchema() { - return schemas::EnumInfo::schema->defaultBrand; -} - -template -struct ChooseBrand; -// If all of `Params` are `AnyPointer`, return the type's default brand. Otherwise, return a -// specific brand instance. TypeTag is the _capnpPrivate struct for the type in question. - -template -struct ChooseBrand { - // All params were AnyPointer. No specific brand needed. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::schema->defaultBrand; } -}; - -template -struct ChooseBrand: public ChooseBrand {}; -// The first parameter is AnyPointer, so recurse to check the rest. - -template -struct ChooseBrand { - // At least one parameter is not AnyPointer, so use the specificBrand constant. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::specificBrand; } -}; - -template ()> -struct BrandBindingFor_; - -#define HANDLE_TYPE(Type, which) \ - template <> \ - struct BrandBindingFor_ { \ - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { \ - return { which, listDepth, nullptr }; \ - } \ - } -HANDLE_TYPE(Void, 0); -HANDLE_TYPE(bool, 1); -HANDLE_TYPE(int8_t, 2); -HANDLE_TYPE(int16_t, 3); -HANDLE_TYPE(int32_t, 4); -HANDLE_TYPE(int64_t, 5); -HANDLE_TYPE(uint8_t, 6); -HANDLE_TYPE(uint16_t, 7); -HANDLE_TYPE(uint32_t, 8); -HANDLE_TYPE(uint64_t, 9); -HANDLE_TYPE(float, 10); -HANDLE_TYPE(double, 11); -#undef HANDLE_TYPE - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 12, listDepth, nullptr }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 13, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_, Kind::LIST> { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return BrandBindingFor_::get(listDepth + 1); - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 15, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 16, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 17, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 0 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 1 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 2 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 3 }; - } -}; - -template -constexpr RawBrandedSchema::Binding brandBindingFor() { - return BrandBindingFor_::get(0); -} - -kj::StringTree structString(StructReader reader, const RawBrandedSchema& schema); -kj::String enumString(uint16_t value, const RawBrandedSchema& schema); -// Declared here so that we can declare inline stringify methods on generated types. -// Defined in stringify.c++, which depends on dynamic.c++, which is allowed not to be linked in. - -template -inline kj::StringTree structString(StructReader reader) { - return structString(reader, rawBrandedSchema()); -} -template -inline kj::String enumString(T value) { - return enumString(static_cast(value), rawBrandedSchema()); -} - -#endif // !CAPNP_LITE - -// TODO(cleanup): Unify ConstStruct and ConstList. -template -class ConstStruct { -public: - ConstStruct() = delete; - KJ_DISALLOW_COPY(ConstStruct); - inline explicit constexpr ConstStruct(const word* ptr): ptr(ptr) {} - - inline typename T::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs(); - } - - inline operator typename T::Reader() const { return get(); } - inline typename T::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstList { -public: - ConstList() = delete; - KJ_DISALLOW_COPY(ConstList); - inline explicit constexpr ConstList(const word* ptr): ptr(ptr) {} - - inline typename List::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs>(); - } - - inline operator typename List::Reader() const { return get(); } - inline typename List::Reader operator*() const { return get(); } - inline TemporaryPointer::Reader> operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstText { -public: - ConstText() = delete; - KJ_DISALLOW_COPY(ConstText); - inline explicit constexpr ConstText(const word* ptr): ptr(ptr) {} - - inline Text::Reader get() const { - return Text::Reader(reinterpret_cast(ptr), size); - } - - inline operator Text::Reader() const { return get(); } - inline Text::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - - inline kj::StringPtr toString() const { - return get(); - } - -private: - const word* ptr; -}; - -template -inline kj::StringPtr KJ_STRINGIFY(const ConstText& s) { - return s.get(); -} - -template -class ConstData { -public: - ConstData() = delete; - KJ_DISALLOW_COPY(ConstData); - inline explicit constexpr ConstData(const word* ptr): ptr(ptr) {} - - inline Data::Reader get() const { - return Data::Reader(reinterpret_cast(ptr), size); - } - - inline operator Data::Reader() const { return get(); } - inline Data::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -inline auto KJ_STRINGIFY(const ConstData& s) -> decltype(kj::toCharSequence(s.get())) { - return kj::toCharSequence(s.get()); -} - -} // namespace _ (private) - -template -inline constexpr uint64_t typeId() { return CapnpPrivate::typeId; } -template ::typeId> -inline constexpr uint64_t typeId() { return id; } -// typeId() returns the type ID as defined in the schema. Works with structs, enums, and -// interfaces. - -template -inline constexpr uint sizeInWords() { - // Return the size, in words, of a Struct type, if allocated free-standing (not in a list). - // May be useful for pre-computing space needed in order to precisely allocate messages. - - return unbound((upgradeBound(_::structSize().data) + - _::structSize().pointers * WORDS_PER_POINTER) / WORDS); -} - -} // namespace capnp - -#if _MSC_VER -// MSVC doesn't understand floating-point constexpr yet. -// -// TODO(msvc): Remove this hack when MSVC is fixed. -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) = value -#else -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) = value -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) -#endif - -#if _MSC_VER -// TODO(msvc): A little hack to allow MSVC to use C++14 return type deduction in cases where the -// explicit type exposes bugs in the compiler. -#define CAPNP_AUTO_IF_MSVC(...) auto -#else -#define CAPNP_AUTO_IF_MSVC(...) __VA_ARGS__ -#endif - -#if CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::kj::str(static_cast(value)); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - } - -#if _MSC_VER -// TODO(msvc): MSVC dosen't expect constexprs to have definitions. -#define CAPNP_DEFINE_ENUM(type, id) -#else -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId -#endif - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } - -#else // CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id; \ - extern const ::capnp::_::RawSchema s_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::capnp::_::enumString(value); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &s_##id; \ - } -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId; \ - constexpr ::capnp::_::RawSchema const* EnumInfo::schema - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::STRUCT; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#define CAPNP_DECLARE_INTERFACE_HEADER(id) \ - struct IsInterface; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::INTERFACE; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#endif // CAPNP_LITE, else - -#endif // CAPNP_GENERATED_HEADER_SUPPORT_H_ diff --git a/external/capnp/include/capnp/json.capnp b/external/capnp/include/capnp/json.capnp deleted file mode 100644 index 55188736f8..0000000000 --- a/external/capnp/include/capnp/json.capnp +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0x8ef99297a43a5e34; - -$import "/capnp/c++.capnp".namespace("capnp"); - -struct JsonValue { - union { - null @0 :Void; - boolean @1 :Bool; - number @2 :Float64; - string @3 :Text; - array @4 :List(JsonValue); - object @5 :List(Field); - # Standard JSON values. - - call @6 :Call; - # Non-standard: A "function call", applying a named function (named by a single identifier) - # to a parameter list. Examples: - # - # BinData(0, "Zm9vCg==") - # ISODate("2015-04-15T08:44:50.218Z") - # - # Mongo DB users will recognize the above as exactly the syntax Mongo uses to represent BSON - # "binary" and "date" types in text, since JSON has no analog of these. This is basically the - # reason this extension exists. We do NOT recommend using `call` unless you specifically need - # to be compatible with some silly format that uses this syntax. - } - - struct Field { - name @0 :Text; - value @1 :JsonValue; - } - - struct Call { - function @0 :Text; - params @1 :List(JsonValue); - } -} diff --git a/external/capnp/include/capnp/layout.h b/external/capnp/include/capnp/layout.h deleted file mode 100644 index 99dc533b2b..0000000000 --- a/external/capnp/include/capnp/layout.h +++ /dev/null @@ -1,1274 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is NOT intended for use by clients, except in generated code. -// -// This file defines low-level, non-type-safe classes for traversing the Cap'n Proto memory layout -// (which is also its wire format). Code generated by the Cap'n Proto compiler uses these classes, -// as does other parts of the Cap'n proto library which provide a higher-level interface for -// dynamic introspection. - -#ifndef CAPNP_LAYOUT_H_ -#define CAPNP_LAYOUT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include "blob.h" -#include "endian.h" - -#if (defined(__mips__) || defined(__hppa__)) && !defined(CAPNP_CANONICALIZE_NAN) -#define CAPNP_CANONICALIZE_NAN 1 -// Explicitly detect NaNs and canonicalize them to the quiet NaN value as would be returned by -// __builtin_nan("") on systems implementing the IEEE-754 recommended (but not required) NaN -// signalling/quiet differentiation (such as x86). Unfortunately, some architectures -- in -// particular, MIPS -- represent quiet vs. signalling nans differently than the rest of the world. -// Canonicalizing them makes output consistent (which is important!), but hurts performance -// slightly. -// -// Note that trying to convert MIPS NaNs to standard NaNs without losing data doesn't work. -// Signaling vs. quiet is indicated by a bit, with the meaning being the opposite on MIPS vs. -// everyone else. It would be great if we could just flip that bit, but we can't, because if the -// significand is all-zero, then the value is infinity rather than NaN. This means that on most -// machines, where the bit indicates quietness, there is one more quiet NaN value than signalling -// NaN value, whereas on MIPS there is one more sNaN than qNaN, and thus there is no isomorphic -// mapping that properly preserves quietness. Instead of doing something hacky, we just give up -// and blow away NaN payloads, because no one uses them anyway. -#endif - -namespace capnp { - -#if !CAPNP_LITE -class ClientHook; -#endif // !CAPNP_LITE - -namespace _ { // private - -class PointerBuilder; -class PointerReader; -class StructBuilder; -class StructReader; -class ListBuilder; -class ListReader; -class OrphanBuilder; -struct WirePointer; -struct WireHelpers; -class SegmentReader; -class SegmentBuilder; -class Arena; -class BuilderArena; - -// ============================================================================= - -#if CAPNP_DEBUG_TYPES -typedef kj::UnitRatio, BitLabel, ElementLabel> BitsPerElementTableType; -#else -typedef uint BitsPerElementTableType; -#endif - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType dataBitsPerElement(ElementSize size) { - return _::BITS_PER_ELEMENT_TABLE[static_cast(size)]; -} - -inline constexpr PointersPerElementN<1> pointersPerElement(ElementSize size) { - return size == ElementSize::POINTER - ? PointersPerElementN<1>(ONE * POINTERS / ELEMENTS) - : PointersPerElementN<1>(ZERO * POINTERS / ELEMENTS); -} - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType bitsPerElementIncludingPointers(ElementSize size) { - return _::BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[static_cast(size)]; -} - -template struct ElementSizeForByteSize; -template <> struct ElementSizeForByteSize<1> { static constexpr ElementSize value = ElementSize::BYTE; }; -template <> struct ElementSizeForByteSize<2> { static constexpr ElementSize value = ElementSize::TWO_BYTES; }; -template <> struct ElementSizeForByteSize<4> { static constexpr ElementSize value = ElementSize::FOUR_BYTES; }; -template <> struct ElementSizeForByteSize<8> { static constexpr ElementSize value = ElementSize::EIGHT_BYTES; }; - -template struct ElementSizeForType { - static constexpr ElementSize value = - // Primitive types that aren't special-cased below can be determined from sizeof(). - CAPNP_KIND(T) == Kind::PRIMITIVE ? ElementSizeForByteSize::value : - CAPNP_KIND(T) == Kind::ENUM ? ElementSize::TWO_BYTES : - CAPNP_KIND(T) == Kind::STRUCT ? ElementSize::INLINE_COMPOSITE : - - // Everything else is a pointer. - ElementSize::POINTER; -}; - -// Void and bool are special. -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::VOID; }; -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::BIT; }; - -// Lists and blobs are pointers, not structs. -template struct ElementSizeForType> { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; - -template -inline constexpr ElementSize elementSizeForType() { - return ElementSizeForType::value; -} - -struct MessageSizeCounts { - WordCountN<61, uint64_t> wordCount; // 2^64 bytes - uint capCount; - - MessageSizeCounts& operator+=(const MessageSizeCounts& other) { - // OK to truncate unchecked because this class is used to count actual stuff in memory, and - // we couldn't possibly have anywhere near 2^61 words. - wordCount = assumeBits<61>(wordCount + other.wordCount); - capCount += other.capCount; - return *this; - } - - void addWords(WordCountN<61, uint64_t> other) { - wordCount = assumeBits<61>(wordCount + other); - } - - MessageSize asPublic() { - return MessageSize { unbound(wordCount / WORDS), capCount }; - } -}; - -// ============================================================================= - -template -union AlignedData { - // Useful for declaring static constant data blobs as an array of bytes, but forcing those - // bytes to be word-aligned. - - uint8_t bytes[wordCount * sizeof(word)]; - word words[wordCount]; -}; - -struct StructSize { - StructDataWordCount data; - StructPointerCount pointers; - - inline constexpr WordCountN<17> total() const { return data + pointers * WORDS_PER_POINTER; } - - StructSize() = default; - inline constexpr StructSize(StructDataWordCount data, StructPointerCount pointers) - : data(data), pointers(pointers) {} -}; - -template -inline constexpr StructSize structSize() { - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize( - dataBitsPerElement(elementSizeForType()) * ELEMENTS > ZERO * BITS - ? StructDataWordCount(ONE * WORDS) : StructDataWordCount(ZERO * WORDS), - pointersPerElement(elementSizeForType()) * ELEMENTS); -} - -// ------------------------------------------------------------------- -// Masking of default values - -template struct Mask_; -template struct Mask_ { typedef T Type; }; -template struct Mask_ { typedef uint16_t Type; }; -template <> struct Mask_ { typedef uint32_t Type; }; -template <> struct Mask_ { typedef uint64_t Type; }; - -template struct Mask_ { - // Union discriminants end up here. - static_assert(sizeof(T) == 2, "Don't know how to mask this type."); - typedef uint16_t Type; -}; - -template -using Mask = typename Mask_::Type; - -template -KJ_ALWAYS_INLINE(Mask mask(T value, Mask mask)); -template -KJ_ALWAYS_INLINE(T unmask(Mask value, Mask mask)); - -template -inline Mask mask(T value, Mask mask) { - return static_cast >(value) ^ mask; -} - -template <> -inline uint32_t mask(float value, uint32_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7fc00000u ^ mask; - } -#endif - - uint32_t i; - static_assert(sizeof(i) == sizeof(value), "float is not 32 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template <> -inline uint64_t mask(double value, uint64_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7ff8000000000000ull ^ mask; - } -#endif - - uint64_t i; - static_assert(sizeof(i) == sizeof(value), "double is not 64 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template -inline T unmask(Mask value, Mask mask) { - return static_cast(value ^ mask); -} - -template <> -inline float unmask(uint32_t value, uint32_t mask) { - value ^= mask; - float result; - static_assert(sizeof(result) == sizeof(value), "float is not 32 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -template <> -inline double unmask(uint64_t value, uint64_t mask) { - value ^= mask; - double result; - static_assert(sizeof(result) == sizeof(value), "double is not 64 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -// ------------------------------------------------------------------- - -class CapTableReader { -public: -#if !CAPNP_LITE - virtual kj::Maybe> extractCap(uint index) = 0; - // Extract the capability at the given index. If the index is invalid, returns null. -#endif // !CAPNP_LITE -}; - -class CapTableBuilder: public CapTableReader { -public: -#if !CAPNP_LITE - virtual uint injectCap(kj::Own&& cap) = 0; - // Add the capability to the message and return its index. If the same ClientHook is injected - // twice, this may return the same index both times, but in this case dropCap() needs to be - // called an equal number of times to actually remove the cap. - - virtual void dropCap(uint index) = 0; - // Remove a capability injected earlier. Called when the pointer is overwritten or zero'd out. -#endif // !CAPNP_LITE -}; - -// ------------------------------------------------------------------- - -class PointerBuilder: public kj::DisallowConstCopy { - // Represents a single pointer, usually embedded in a struct or a list. - -public: - inline PointerBuilder(): segment(nullptr), capTable(nullptr), pointer(nullptr) {} - - static inline PointerBuilder getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location); - // Get a PointerBuilder representing a message root located in the given segment at the given - // location. - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructBuilder getStruct(StructSize size, const word* defaultValue); - ListBuilder getList(ElementSize elementSize, const word* defaultValue); - ListBuilder getStructList(StructSize elementSize, const word* defaultValue); - ListBuilder getListAnySize(const word* defaultValue); - template typename T::Builder getBlob( - const void* defaultValue, ByteCount defaultSize); -#if !CAPNP_LITE - kj::Own getCapability(); -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, initialize it to a copy of the default value. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - StructBuilder initStruct(StructSize size); - ListBuilder initList(ElementSize elementSize, ElementCount elementCount); - ListBuilder initStructList(ElementCount elementCount, StructSize size); - template typename T::Builder initBlob(ByteCount size); - // Init methods: Initialize the pointer to a newly-allocated object, discarding the existing - // object. - - void setStruct(const StructReader& value, bool canonical = false); - void setList(const ListReader& value, bool canonical = false); - template void setBlob(typename T::Reader value); -#if !CAPNP_LITE - void setCapability(kj::Own&& cap); -#endif // !CAPNP_LITE - // Set methods: Initialize the pointer to a newly-allocated copy of the given value, discarding - // the existing object. - - void adopt(OrphanBuilder&& orphan); - // Set the pointer to point at the given orphaned value. - - OrphanBuilder disown(); - // Set the pointer to null and return its previous value as an orphan. - - void clear(); - // Clear the pointer to null, discarding its previous value. - - void transferFrom(PointerBuilder other); - // Equivalent to `adopt(other.disown())`. - - void copyFrom(PointerReader other, bool canonical = false); - // Equivalent to `set(other.get())`. - // If you set the canonical flag, it will attempt to lay the target out - // canonically, provided enough space is available. - - PointerReader asReader() const; - - BuilderArena* getArena() const; - // Get the arena containing this pointer. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the pointer resides. - CapTableBuilder* capTable; // Table of capability indexes. - WirePointer* pointer; // Pointer to the pointer. - - inline PointerBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, WirePointer* pointer) - : segment(segment), capTable(capTable), pointer(pointer) {} - - friend class StructBuilder; - friend class ListBuilder; - friend class OrphanBuilder; -}; - -class PointerReader { -public: - inline PointerReader() - : segment(nullptr), capTable(nullptr), pointer(nullptr), nestingLimit(0x7fffffff) {} - - static PointerReader getRoot(SegmentReader* segment, CapTableReader* capTable, - const word* location, int nestingLimit); - // Get a PointerReader representing a message root located in the given segment at the given - // location. - - static inline PointerReader getRootUnchecked(const word* location); - // Get a PointerReader for an unchecked message. - - MessageSizeCounts targetSize() const; - // Return the total size of the target object and everything to which it points. Does not count - // far pointer overhead. This is useful for deciding how much space is needed to copy the object - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructReader getStruct(const word* defaultValue) const; - ListReader getList(ElementSize expectedElementSize, const word* defaultValue) const; - ListReader getListAnySize(const word* defaultValue) const; - template - typename T::Reader getBlob(const void* defaultValue, ByteCount defaultSize) const; -#if !CAPNP_LITE - kj::Own getCapability() const; -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, return the default value instead. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - const word* getUnchecked() const; - // If this is an unchecked message, get a word* pointing at the location of the pointer. This - // word* can actually be passed to readUnchecked() to read the designated sub-object later. If - // this isn't an unchecked message, throws an exception. - - kj::Maybe getArena() const; - // Get the arena containing this pointer. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the pointer resides. - CapTableReader* capTable; // Table of capability indexes. - const WirePointer* pointer; // Pointer to the pointer. null = treat as null pointer. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline PointerReader(SegmentReader* segment, CapTableReader* capTable, - const WirePointer* pointer, int nestingLimit) - : segment(segment), capTable(capTable), pointer(pointer), nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListReader; - friend class PointerBuilder; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class StructBuilder: public kj::DisallowConstCopy { -public: - inline StructBuilder(): segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr) {} - - inline word* getLocation() { return reinterpret_cast(data); } - // Get the object's location. Only valid for independently-allocated objects (i.e. not list - // elements). - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListBuilder getPointerSectionAsList(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset)); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset)); - // Gets the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask)); - // Like getDataField() but applies the given XOR mask to the data on load. Used for reading - // fields with non-zero default values. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, kj::NoInfer value)); - // Sets the data field value at the given offset. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, - kj::NoInfer value, Mask mask)); - // Like setDataField() but applies the given XOR mask before storing. Used for writing fields - // with non-zero default values. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerField(StructPointerOffset ptrIndex)); - // Get a builder for a pointer field given the index within the pointer section. - - void clearAll(); - // Clear all pointers and data. - - void transferContentFrom(StructBuilder other); - // Adopt all pointers from `other`, and also copy all data. If `other`'s sections are larger - // than this, the extra data is not transferred, meaning there is a risk of data loss when - // transferring from messages built with future versions of the protocol. - - void copyContentFrom(StructReader other); - // Copy content from `other`. If `other`'s sections are larger than this, the extra data is not - // copied, meaning there is a risk of data loss when copying from messages built with future - // versions of the protocol. - - StructReader asReader() const; - // Gets a StructReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - StructBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the struct resides. - CapTableBuilder* capTable; // Table of capability indexes. - void* data; // Pointer to the encoded data. - WirePointer* pointers; // Pointer to the encoded pointers. - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - inline StructBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, - void* data, WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount) {} - - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class StructReader { -public: - inline StructReader() - : segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr), - dataSize(ZERO * BITS), pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - inline StructReader(kj::ArrayPtr data) - : segment(nullptr), capTable(nullptr), data(data.begin()), pointers(nullptr), - dataSize(assumeBits(data.size()) * WORDS * BITS_PER_WORD), - pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - - const void* getLocation() const { return data; } - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListReader getPointerSectionAsList(); - - kj::Array canonicalize(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset) const); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset) const); - // Get the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. Returns zero if the offset is past the - // end of the struct's data section. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask) const); - // Like getDataField(offset), but applies the given XOR mask to the result. Used for reading - // fields with non-zero default values. - - KJ_ALWAYS_INLINE(PointerReader getPointerField(StructPointerOffset ptrIndex) const); - // Get a reader for a pointer field given the index within the pointer section. If the index - // is out-of-bounds, returns a null pointer. - - MessageSizeCounts totalSize() const; - // Return the total size of the struct and everything to which it points. Does not count far - // pointer overhead. This is useful for deciding how much space is needed to copy the struct - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - StructReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const word **ptrHead, - bool *dataTrunc, bool *ptrTrunc); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - // - // If this function returns false, the struct is non-canonical. If it - // returns true, then: - // * If it is a composite in a list, it is canonical if at least one struct - // in the list outputs dataTrunc = 1, and at least one outputs ptrTrunc = 1 - // * If it is derived from a struct pointer, it is canonical if - // dataTrunc = 1 AND ptrTrunc = 1 - -private: - SegmentReader* segment; // Memory segment in which the struct resides. - CapTableReader* capTable; // Table of capability indexes. - - const void* data; - const WirePointer* pointers; - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - // TODO(perf): Limit to 16 bits for better packing? - - inline StructReader(SegmentReader* segment, CapTableReader* capTable, - const void* data, const WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount, - int nestingLimit) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount), - nestingLimit(nestingLimit) {} - - friend class ListReader; - friend class StructBuilder; - friend struct WireHelpers; -}; - -// ------------------------------------------------------------------- - -class ListBuilder: public kj::DisallowConstCopy { -public: - inline explicit ListBuilder(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize) {} - - inline word* getLocation() { - // Get the object's location. - - if (elementSize == ElementSize::INLINE_COMPOSITE && ptr != nullptr) { - return reinterpret_cast(ptr) - POINTER_SIZE_IN_WORDS; - } else { - return reinterpret_cast(ptr); - } - } - - inline ElementSize getElementSize() const { return elementSize; } - - inline ListElementCount size() const; - // The number of elements in the list. - - Text::Builder asText(); - Data::Builder asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index)); - // Get the element of the given type at the given index. - - template - KJ_ALWAYS_INLINE(void setDataElement(ElementCount index, kj::NoInfer value)); - // Set the element at the given index. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerElement(ElementCount index)); - - StructBuilder getStructElement(ElementCount index); - - ListReader asReader() const; - // Get a ListReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - ListBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the list resides. - CapTableBuilder* capTable; // Table of capability indexes. - - byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 128 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - inline ListBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, void* ptr, - BitsPerElementN<23> step, ListElementCount size, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(size), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize) {} - - friend class StructBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class ListReader { -public: - inline explicit ListReader(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize), nestingLimit(0x7fffffff) {} - - inline ListElementCount size() const; - // The number of elements in the list. - - inline ElementSize getElementSize() const { return elementSize; } - - Text::Reader asText(); - Data::Reader asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - kj::ArrayPtr asRawBytes(); - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index) const); - // Get the element of the given type at the given index. - - KJ_ALWAYS_INLINE(PointerReader getPointerElement(ElementCount index) const); - - StructReader getStructElement(ElementCount index) const; - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - ListReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const WirePointer* ref); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the list resides. - CapTableReader* capTable; // Table of capability indexes. - - const byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 2 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline ListReader(SegmentReader* segment, CapTableReader* capTable, const void* ptr, - ListElementCount elementCount, BitsPerElementN<23> step, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize, int nestingLimit) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(elementCount), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize), - nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class OrphanBuilder { -public: - inline OrphanBuilder(): segment(nullptr), capTable(nullptr), location(nullptr) { - memset(&tag, 0, sizeof(tag)); - } - OrphanBuilder(const OrphanBuilder& other) = delete; - inline OrphanBuilder(OrphanBuilder&& other) noexcept; - inline ~OrphanBuilder() noexcept(false); - - static OrphanBuilder initStruct(BuilderArena* arena, CapTableBuilder* capTable, StructSize size); - static OrphanBuilder initList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, ElementSize elementSize); - static OrphanBuilder initStructList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, StructSize elementSize); - static OrphanBuilder initText(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - static OrphanBuilder initData(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, StructReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, ListReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, PointerReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Text::Reader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Data::Reader copyFrom); -#if !CAPNP_LITE - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, - kj::Own copyFrom); -#endif // !CAPNP_LITE - - static OrphanBuilder concat(BuilderArena* arena, CapTableBuilder* capTable, - ElementSize expectedElementSize, StructSize expectedStructSize, - kj::ArrayPtr lists); - - static OrphanBuilder referenceExternalData(BuilderArena* arena, Data::Reader data); - - OrphanBuilder& operator=(const OrphanBuilder& other) = delete; - inline OrphanBuilder& operator=(OrphanBuilder&& other); - - inline bool operator==(decltype(nullptr)) const { return location == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return location != nullptr; } - - StructBuilder asStruct(StructSize size); - // Interpret as a struct, or throw an exception if not a struct. - - ListBuilder asList(ElementSize elementSize); - // Interpret as a list, or throw an exception if not a list. elementSize cannot be - // INLINE_COMPOSITE -- use asStructList() instead. - - ListBuilder asStructList(StructSize elementSize); - // Interpret as a struct list, or throw an exception if not a list. - - ListBuilder asListAnySize(); - // For AnyList. - - Text::Builder asText(); - Data::Builder asData(); - // Interpret as a blob, or throw an exception if not a blob. - - StructReader asStructReader(StructSize size) const; - ListReader asListReader(ElementSize elementSize) const; - ListReader asListReaderAnySize() const; -#if !CAPNP_LITE - kj::Own asCapability() const; -#endif // !CAPNP_LITE - Text::Reader asTextReader() const; - Data::Reader asDataReader() const; - - bool truncate(ElementCount size, bool isText) KJ_WARN_UNUSED_RESULT; - // Resize the orphan list to the given size. Returns false if the list is currently empty but - // the requested size is non-zero, in which case the caller will need to allocate a new list. - - void truncate(ElementCount size, ElementSize elementSize); - void truncate(ElementCount size, StructSize elementSize); - void truncateText(ElementCount size); - // Versions of truncate() that know how to allocate a new list if needed. - -private: - static_assert(ONE * POINTERS * WORDS_PER_POINTER == ONE * WORDS, - "This struct assumes a pointer is one word."); - word tag; - // Contains an encoded WirePointer representing this object. WirePointer is defined in - // layout.c++, but fits in a word. - // - // This may be a FAR pointer. Even in that case, `location` points to the eventual destination - // of that far pointer. The reason we keep the far pointer around rather than just making `tag` - // represent the final destination is because if the eventual adopter of the pointer is not in - // the target's segment then it may be useful to reuse the far pointer landing pad. - // - // If `tag` is not a far pointer, its offset is garbage; only `location` points to the actual - // target. - - SegmentBuilder* segment; - // Segment in which the object resides. - - CapTableBuilder* capTable; - // Table of capability indexes. - - word* location; - // Pointer to the object, or nullptr if the pointer is null. For capabilities, we make this - // 0x1 just so that it is non-null for operator==, but it is never used. - - inline OrphanBuilder(const void* tagPtr, SegmentBuilder* segment, - CapTableBuilder* capTable, word* location) - : segment(segment), capTable(capTable), location(location) { - memcpy(&tag, tagPtr, sizeof(tag)); - } - - inline WirePointer* tagAsPtr() { return reinterpret_cast(&tag); } - inline const WirePointer* tagAsPtr() const { return reinterpret_cast(&tag); } - - void euthanize(); - // Erase the target object, zeroing it out and possibly reclaiming the memory. Called when - // the OrphanBuilder is being destroyed or overwritten and it is non-null. - - friend struct WireHelpers; -}; - -// ======================================================================================= -// Internal implementation details... - -// These are defined in the source file. -template <> typename Text::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Text::Reader value); -template <> typename Text::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Text::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -template <> typename Data::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Data::Reader value); -template <> typename Data::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Data::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -inline PointerBuilder PointerBuilder::getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location) { - return PointerBuilder(segment, capTable, reinterpret_cast(location)); -} - -inline PointerReader PointerReader::getRootUnchecked(const word* location) { - return PointerReader(nullptr, nullptr, - reinterpret_cast(location), 0x7fffffff); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructBuilder::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListBuilder StructBuilder::getPointerSectionAsList() { - return _::ListBuilder(segment, capTable, pointers, ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, - pointerCount * (ONE * ELEMENTS / POINTERS), - ZERO * BITS, ONE * POINTERS, ElementSize::POINTER); -} - -template -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return false; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); -} - -template <> -inline bool StructBuilder::getDataField(StructDataOffset offset) { - BitCount32 boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void StructBuilder::getDataField(StructDataOffset offset) { - return VOID; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset, Mask mask) { - return unmask(getDataField >(offset), mask); -} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, kj::NoInfer value) { - reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, float value) { - setDataField(offset, mask(value, 0)); -} -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, double value) { - setDataField(offset, mask(value, 0)); -} -#endif - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, bool value) { - auto boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - uint bitnum = unboundMaxBits<3>(boffset % BITS_PER_BYTE / BITS); - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << bitnum)) - | (static_cast(value) << bitnum); -} - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, Void value) {} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, - kj::NoInfer value, Mask m) { - setDataField >(offset, mask(value, m)); -} - -inline PointerBuilder StructBuilder::getPointerField(StructPointerOffset ptrIndex) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerBuilder(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER)); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructReader::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListReader StructReader::getPointerSectionAsList() { - return _::ListReader(segment, capTable, pointers, pointerCount * (ONE * ELEMENTS / POINTERS), - ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, ZERO * BITS, ONE * POINTERS, - ElementSize::POINTER, nestingLimit); -} - -template -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return false; -} - -template -inline T StructReader::getDataField(StructDataOffset offset) const { - if ((offset + ONE * ELEMENTS) * capnp::bitsPerElement() <= dataSize) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); - } else { - return static_cast(0); - } -} - -template <> -inline bool StructReader::getDataField(StructDataOffset offset) const { - auto boffset = offset * (ONE * BITS / ELEMENTS); - if (boffset < dataSize) { - const byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; - } else { - return false; - } -} - -template <> -inline Void StructReader::getDataField(StructDataOffset offset) const { - return VOID; -} - -template -T StructReader::getDataField(StructDataOffset offset, Mask mask) const { - return unmask(getDataField >(offset), mask); -} - -inline PointerReader StructReader::getPointerField(StructPointerOffset ptrIndex) const { - if (ptrIndex < pointerCount) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerReader(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER), nestingLimit); - } else{ - return PointerReader(); - } -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListBuilder::size() const { return elementCount; } - -template -inline T ListBuilder::getDataElement(ElementCount index) { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); - - // TODO(perf): Benchmark this alternate implementation, which I suspect may make better use of - // the x86 SIB byte. Also use it for all the other getData/setData implementations below, and - // the various non-inline methods that look up pointers. - // Also if using this, consider changing ptr back to void* instead of byte*. -// return reinterpret_cast*>(ptr)[ -// index / ELEMENTS * (step / capnp::bitsPerElement())].get(); -} - -template <> -inline bool ListBuilder::getDataElement(ElementCount index) { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListBuilder::getDataElement(ElementCount index) { - return VOID; -} - -template -inline void ListBuilder::setDataElement(ElementCount index, kj::NoInfer value) { - reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void ListBuilder::setDataElement(ElementCount index, float value) { - setDataElement(index, mask(value, 0)); -} -template <> -inline void ListBuilder::setDataElement(ElementCount index, double value) { - setDataElement(index, mask(value, 0)); -} -#endif - -template <> -inline void ListBuilder::setDataElement(ElementCount index, bool value) { - // Ignore stepBytes for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - auto bitnum = bindex % BITS_PER_BYTE / BITS; - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << unbound(bitnum))) - | (static_cast(value) << unbound(bitnum)); -} - -template <> -inline void ListBuilder::setDataElement(ElementCount index, Void value) {} - -inline PointerBuilder ListBuilder::getPointerElement(ElementCount index) { - return PointerBuilder(segment, capTable, reinterpret_cast(ptr + - upgradeBound(index) * step / BITS_PER_BYTE)); -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListReader::size() const { return elementCount; } - -template -inline T ListReader::getDataElement(ElementCount index) const { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); -} - -template <> -inline bool ListReader::getDataElement(ElementCount index) const { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - const byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListReader::getDataElement(ElementCount index) const { - return VOID; -} - -inline PointerReader ListReader::getPointerElement(ElementCount index) const { - return PointerReader(segment, capTable, reinterpret_cast( - ptr + upgradeBound(index) * step / BITS_PER_BYTE), nestingLimit); -} - -// ------------------------------------------------------------------- - -inline OrphanBuilder::OrphanBuilder(OrphanBuilder&& other) noexcept - : segment(other.segment), capTable(other.capTable), location(other.location) { - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; -} - -inline OrphanBuilder::~OrphanBuilder() noexcept(false) { - if (segment != nullptr) euthanize(); -} - -inline OrphanBuilder& OrphanBuilder::operator=(OrphanBuilder&& other) { - // With normal smart pointers, it's important to handle the case where the incoming pointer - // is actually transitively owned by this one. In this case, euthanize() would destroy `other` - // before we copied it. This isn't possible in the case of `OrphanBuilder` because it only - // owns message objects, and `other` is not itself a message object, therefore cannot possibly - // be transitively owned by `this`. - - if (segment != nullptr) euthanize(); - segment = other.segment; - capTable = other.capTable; - location = other.location; - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; - return *this; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_LAYOUT_H_ diff --git a/external/capnp/include/capnp/list.h b/external/capnp/include/capnp/list.h deleted file mode 100644 index 23e5e6c10e..0000000000 --- a/external/capnp/include/capnp/list.h +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_LIST_H_ -#define CAPNP_LIST_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "orphan.h" -#include -#ifdef KJ_STD_COMPAT -#include -#endif // KJ_STD_COMPAT - -namespace capnp { -namespace _ { // private - -template -class TemporaryPointer { - // This class is a little hack which lets us define operator->() in cases where it needs to - // return a pointer to a temporary value. We instead construct a TemporaryPointer and return that - // (by value). The compiler then invokes operator->() on the TemporaryPointer, which itself is - // able to return a real pointer to its member. - -public: - TemporaryPointer(T&& value): value(kj::mv(value)) {} - TemporaryPointer(const T& value): value(value) {} - - inline T* operator->() { return &value; } -private: - T value; -}; - -template -class IndexingIterator { -public: - IndexingIterator() = default; - - inline Element operator*() const { return (*container)[index]; } - inline TemporaryPointer operator->() const { - return TemporaryPointer((*container)[index]); - } - inline Element operator[]( int off) const { return (*container)[index]; } - inline Element operator[](uint off) const { return (*container)[index]; } - - inline IndexingIterator& operator++() { ++index; return *this; } - inline IndexingIterator operator++(int) { IndexingIterator other = *this; ++index; return other; } - inline IndexingIterator& operator--() { --index; return *this; } - inline IndexingIterator operator--(int) { IndexingIterator other = *this; --index; return other; } - - inline IndexingIterator operator+(uint amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-(uint amount) const { return IndexingIterator(container, index - amount); } - inline IndexingIterator operator+( int amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-( int amount) const { return IndexingIterator(container, index - amount); } - - inline int operator-(const IndexingIterator& other) const { return index - other.index; } - - inline IndexingIterator& operator+=(uint amount) { index += amount; return *this; } - inline IndexingIterator& operator-=(uint amount) { index -= amount; return *this; } - inline IndexingIterator& operator+=( int amount) { index += amount; return *this; } - inline IndexingIterator& operator-=( int amount) { index -= amount; return *this; } - - // STL says comparing iterators of different containers is not allowed, so we only compare - // indices here. - inline bool operator==(const IndexingIterator& other) const { return index == other.index; } - inline bool operator!=(const IndexingIterator& other) const { return index != other.index; } - inline bool operator<=(const IndexingIterator& other) const { return index <= other.index; } - inline bool operator>=(const IndexingIterator& other) const { return index >= other.index; } - inline bool operator< (const IndexingIterator& other) const { return index < other.index; } - inline bool operator> (const IndexingIterator& other) const { return index > other.index; } - -private: - Container* container; - uint index; - - friend Container; - inline IndexingIterator(Container* container, uint index) - : container(container), index(index) {} -}; - -} // namespace _ (private) - -template -struct List { - // List of primitives. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(_::elementSizeForType()) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline T operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.template getDataElement(bounded(index) * ELEMENTS); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(_::elementSizeForType()) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline T operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.template getDataElement(bounded(index) * ELEMENTS); - } - inline void set(uint index, T value) { - // Alas, it is not possible to make operator[] return a reference to which you can assign, - // since the encoded representation does not necessarily match the compiler's representation - // of the type. We can't even return a clever class that implements operator T() and - // operator=() because it will lead to surprising behavior when using type inference (e.g. - // calling a template function with inferred argument types, or using "auto" or "decltype"). - - builder.template setDataElement(bounded(index) * ELEMENTS, value); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(_::elementSizeForType(), bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(_::elementSizeForType(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(_::elementSizeForType(), defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List: public List {}; - -template -struct List { - // List of structs. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::INLINE_COMPOSITE) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - inline void adoptWithCaveats(uint index, Orphan&& orphan) { - // Mostly behaves like you'd expect `adopt` to behave, but with two caveats originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // * This actually performs a shallow copy, effectively adopting each of the orphan's - // children rather than adopting the orphan itself. The orphan ends up being discarded, - // possibly wasting space in the message object. - // * If the orphan is larger than the target struct -- say, because the orphan was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - - KJ_IREQUIRE(index < size()); - - // We pass a zero-valued StructSize to asStruct() because we do not want the struct to be - // expanded under any circumstances. We're just going to throw it away anyway, and - // transferContentFrom() already carefully compares the struct sizes before transferring. - builder.getStructElement(bounded(index) * ELEMENTS).transferContentFrom( - orphan.builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - inline void setWithCaveats(uint index, const typename T::Reader& reader) { - // Mostly behaves like you'd expect `set` to behave, but with a caveat originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // If the source struct is larger than the target struct -- say, because the source was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - // - // Note: If you are trying to concatenate some lists, use Orphanage::newOrphanConcat() to - // do it without losing any data in case the source lists come from a newer version of the - // protocol. (Plus, it's easier to use anyhow.) - - KJ_IREQUIRE(index < size()); - builder.getStructElement(bounded(index) * ELEMENTS).copyContentFrom(reader._reader); - } - - // There are no init(), set(), adopt(), or disown() methods for lists of structs because the - // elements of the list are inlined and are initialized when the list is initialized. This - // means that init() would be redundant, and set() would risk data loss if the input struct - // were from a newer version of the protocol. - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initStructList(bounded(size) * ELEMENTS, _::structSize()); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getStructList(_::structSize(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::INLINE_COMPOSITE, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List, Kind::LIST> { - // List of lists. - - List() = delete; - - class Reader { - public: - typedef List> Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename List::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename List::Reader(_::PointerHelpers>::get( - reader.getPointerElement(bounded(index) * ELEMENTS))); - } - - typedef _::IndexingIterator::Reader> Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List> Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename List::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename List::Builder(_::PointerHelpers>::get( - builder.getPointerElement(bounded(index) * ELEMENTS))); - } - inline typename List::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return typename List::Builder(_::PointerHelpers>::init( - builder.getPointerElement(bounded(index) * ELEMENTS), size)); - } - inline void set(uint index, typename List::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setList(value.reader); - } - void set(uint index, std::initializer_list> value) { - KJ_IREQUIRE(index < size()); - auto l = init(index, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator::Builder> Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - inline void set(uint index, typename T::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).template setBlob(value); - } - inline typename T::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template initBlob(bounded(size) * BYTES); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -} // namespace capnp - -#ifdef KJ_STD_COMPAT -namespace std { - -template -struct iterator_traits> - : public std::iterator {}; - -} // namespace std -#endif // KJ_STD_COMPAT - -#endif // CAPNP_LIST_H_ diff --git a/external/capnp/include/capnp/membrane.h b/external/capnp/include/capnp/membrane.h deleted file mode 100644 index 6fa8a1335d..0000000000 --- a/external/capnp/include/capnp/membrane.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_MEMBRANE_H_ -#define CAPNP_MEMBRANE_H_ -// In capability theory, a "membrane" is a wrapper around a capability which (usually) forwards -// calls but recursively wraps capabilities in those calls in the same membrane. The purpose of a -// membrane is to enforce a barrier between two capabilities that cannot be bypassed by merely -// introducing new objects. -// -// The most common use case for a membrane is revocation: Say Alice wants to give Bob a capability -// to access Carol, but wants to be able to revoke this capability later. Alice can accomplish this -// by wrapping Carol in a revokable wrapper which passes through calls until such a time as Alice -// indicates it should be revoked, after which all calls through the wrapper will throw exceptions. -// However, a naive wrapper approach has a problem: if Bob makes a call to Carol and sends a new -// capability in that call, or if Carol returns a capability to Bob in the response to a call, then -// the two are now able to communicate using this new capability, which Alice cannot revoke. In -// order to avoid this problem, Alice must use not just a wrapper but a "membrane", which -// recursively wraps all objects that pass through it in either direction. Thus, all connections -// formed between Bob and Carol (originating from Alice's original introduction) can be revoked -// together by revoking the membrane. -// -// Note that when a capability is passed into a membrane and then passed back out, the result is -// the original capability, not a double-membraned capability. This means that in our revocation -// example, if Bob uses his capability to Carol to obtain another capability from her, then send -// it back to her, the capability Carol receives back will NOT be revoked when Bob's access to -// Carol is revoked. Thus Bob can create long-term irrevocable connections. In most practical use -// cases, this is what you want. APIs commonly rely on the fact that a capability obtained and then -// passed back can be recognized as the original capability. -// -// Mark Miller on membranes: http://www.eros-os.org/pipermail/e-lang/2003-January/008434.html - -#include "capability.h" - -namespace capnp { - -class MembranePolicy { - // Applications may implement this interface to define a membrane policy, which allows some - // calls crossing the membrane to be blocked or redirected. - -public: - virtual kj::Maybe inboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Given an inbound call (a call originating "outside" the membrane destined for an object - // "inside" the membrane), decides what to do with it. The policy may: - // - // - Return null to indicate that the call should proceed to the destination. All capabilities - // in the parameters or result will be properly wrapped in the same membrane. - // - Return a capability to have the call redirected to that capability. Note that the redirect - // capability will be treated as outside the membrane, so the params and results will not be - // auto-wrapped; however, the callee can easily wrap the returned capability in the membrane - // itself before returning to achieve this effect. - // - Throw an exception to cause the call to fail with that exception. - // - // `target` is the underlying capability (*inside* the membrane) for which the call is destined. - // Generally, the only way you should use `target` is to wrap it in some capability which you - // return as a redirect. The redirect capability may modify the call in some way and send it to - // `target`. Be careful to use `copyIntoMembrane()` and `copyOutOfMembrane()` as appropriate when - // copying parameters or results across the membrane. - // - // Note that since `target` is inside the capability, if you were to directly return it (rather - // than return null), the effect would be that the membrane would be broken: the call would - // proceed directly and any new capabilities introduced through it would not be membraned. You - // generally should not do that. - - virtual kj::Maybe outboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Like `inboundCall()`, but applies to calls originating *inside* the membrane and terminating - // outside. - // - // Note: It is strongly recommended that `outboundCall()` returns null in exactly the same cases - // that `inboundCall()` return null. Conversely, for any case where `inboundCall()` would - // redirect or throw, `outboundCall()` should also redirect or throw. Otherwise, you can run - // into inconsistent behavion when a promise is returned across a membrane, and that promise - // later resolves to a capability on the other side of the membrane: calls on the promise - // will enter and then exit the membrane, but calls on the eventual resolution will not cross - // the membrane at all, so it is important that these two cases behave the same. - - virtual kj::Own addRef() = 0; - // Return a new owned pointer to the same policy. - // - // Typically an implementation of MembranePolicy should also inherit kj::Refcounted and implement - // `addRef()` as `return kj::addRef(*this);`. - // - // Note that the membraning system considers two membranes created with the same MembranePolicy - // object actually to be the *same* membrane. This is relevant when an object passes into the - // membrane and then back out (or out and then back in): instead of double-wrapping the object, - // the wrapping will be removed. -}; - -Capability::Client membrane(Capability::Client inner, kj::Own policy); -// Wrap `inner` in a membrane specified by `policy`. `inner` is considered "inside" the membrane, -// while the returned capability should only be called from outside the membrane. - -Capability::Client reverseMembrane(Capability::Client outer, kj::Own policy); -// Like `membrane` but treat the input capability as "outside" the membrane, and return a -// capability appropriate for use inside. -// -// Applications typically won't use this directly; the membraning code automatically sets up -// reverse membranes where needed. - -template -ClientType membrane(ClientType inner, kj::Own policy); -template -ClientType reverseMembrane(ClientType inner, kj::Own policy); -// Convenience templates which return the same interface type as the input. - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy); -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy); -// Convenience templates which input a capability server type and return the appropriate client -// type. - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Copy a Cap'n Proto object (e.g. struct or list), adding the given membrane to any capabilities -// found within it. `from` is interpreted as "outside" the membrane while `to` is "inside". - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Like copyIntoMembrane() except that `from` is "inside" the membrane and `to` is "outside". - -// ======================================================================================= -// inline implementation details - -template -ClientType membrane(ClientType inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -ClientType reverseMembrane(ClientType inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -namespace _ { // private - -OrphanBuilder copyOutOfMembrane(PointerReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(StructReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(ListReader from, Orphanage to, - kj::Own policy, bool reverse); - -} // namespace _ (private) - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), true); -} - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), false); -} - -} // namespace capnp - -#endif // CAPNP_MEMBRANE_H_ diff --git a/external/capnp/include/capnp/message.h b/external/capnp/include/capnp/message.h deleted file mode 100644 index b4d5e9fc82..0000000000 --- a/external/capnp/include/capnp/message.h +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include -#include -#include -#include -#include "common.h" -#include "layout.h" -#include "any.h" - -#ifndef CAPNP_MESSAGE_H_ -#define CAPNP_MESSAGE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -namespace capnp { - -namespace _ { // private - class ReaderArena; - class BuilderArena; -} - -class StructSchema; -class Orphanage; -template -class Orphan; - -// ======================================================================================= - -struct ReaderOptions { - // Options controlling how data is read. - - uint64_t traversalLimitInWords = 8 * 1024 * 1024; - // Limits how many total words of data are allowed to be traversed. Traversal is counted when - // a new struct or list builder is obtained, e.g. from a get() accessor. This means that calling - // the getter for the same sub-struct multiple times will cause it to be double-counted. Once - // the traversal limit is reached, an error will be reported. - // - // This limit exists for security reasons. It is possible for an attacker to construct a message - // in which multiple pointers point at the same location. This is technically invalid, but hard - // to detect. Using such a message, an attacker could cause a message which is small on the wire - // to appear much larger when actually traversed, possibly exhausting server resources leading to - // denial-of-service. - // - // It makes sense to set a traversal limit that is much larger than the underlying message. - // Together with sensible coding practices (e.g. trying to avoid calling sub-object getters - // multiple times, which is expensive anyway), this should provide adequate protection without - // inconvenience. - // - // The default limit is 64 MiB. This may or may not be a sensible number for any given use case, - // but probably at least prevents easy exploitation while also avoiding causing problems in most - // typical cases. - - int nestingLimit = 64; - // Limits how deeply-nested a message structure can be, e.g. structs containing other structs or - // lists of structs. - // - // Like the traversal limit, this limit exists for security reasons. Since it is common to use - // recursive code to traverse recursive data structures, an attacker could easily cause a stack - // overflow by sending a very-deeply-nested (or even cyclic) message, without the message even - // being very large. The default limit of 64 is probably low enough to prevent any chance of - // stack overflow, yet high enough that it is never a problem in practice. -}; - -class MessageReader { - // Abstract interface for an object used to read a Cap'n Proto message. Subclasses of - // MessageReader are responsible for reading the raw, flat message content. Callers should - // usually call `messageReader.getRoot()` to get a `MyStructType::Reader` - // representing the root of the message, then use that to traverse the message content. - // - // Some common subclasses of `MessageReader` include `SegmentArrayMessageReader`, whose - // constructor accepts pointers to the raw data, and `StreamFdMessageReader` (from - // `serialize.h`), which reads the message from a file descriptor. One might implement other - // subclasses to handle things like reading from shared memory segments, mmap()ed files, etc. - -public: - MessageReader(ReaderOptions options); - // It is suggested that subclasses take ReaderOptions as a constructor parameter, but give it a - // default value of "ReaderOptions()". The base class constructor doesn't have a default value - // in order to remind subclasses that they really need to give the user a way to provide this. - - virtual ~MessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) = 0; - // Gets the segment with the given ID, or returns null if no such segment exists. This method - // will be called at most once for each segment ID. - - inline const ReaderOptions& getOptions(); - // Get the options passed to the constructor. - - template - typename RootType::Reader getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Reader getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - bool isCanonical(); - // Returns whether the message encoded in the reader is in canonical form. - -private: - ReaderOptions options; - - // Space in which we can construct a ReaderArena. We don't use ReaderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a ReaderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - void* arenaSpace[15 + sizeof(kj::MutexGuarded) / sizeof(void*)]; - bool allocatedArena; - - _::ReaderArena* arena() { return reinterpret_cast<_::ReaderArena*>(arenaSpace); } - AnyPointer::Reader getRootInternal(); -}; - -class MessageBuilder { - // Abstract interface for an object used to allocate and build a message. Subclasses of - // MessageBuilder are responsible for allocating the space in which the message will be written. - // The most common subclass is `MallocMessageBuilder`, but other subclasses may be used to do - // tricky things like allocate messages in shared memory or mmap()ed files. - // - // Creating a new message ususually means allocating a new MessageBuilder (ideally on the stack) - // and then calling `messageBuilder.initRoot()` to get a `MyStructType::Builder`. - // That, in turn, can be used to fill in the message content. When done, you can call - // `messageBuilder.getSegmentsForOutput()` to get a list of flat data arrays containing the - // message. - -public: - MessageBuilder(); - virtual ~MessageBuilder() noexcept(false); - KJ_DISALLOW_COPY(MessageBuilder); - - struct SegmentInit { - kj::ArrayPtr space; - - size_t wordsUsed; - // Number of words in `space` which are used; the rest are free space in which additional - // objects may be allocated. - }; - - explicit MessageBuilder(kj::ArrayPtr segments); - // Create a MessageBuilder backed by existing memory. This is an advanced interface that most - // people should not use. THIS METHOD IS INSECURE; see below. - // - // This allows a MessageBuilder to be constructed to modify an in-memory message without first - // making a copy of the content. This is especially useful in conjunction with mmap(). - // - // The contents of each segment must outlive the MessageBuilder, but the SegmentInit array itself - // only need outlive the constructor. - // - // SECURITY: Do not use this in conjunction with untrusted data. This constructor assumes that - // the input message is valid. This constructor is designed to be used with data you control, - // e.g. an mmap'd file which is owned and accessed by only one program. When reading data you - // do not trust, you *must* load it into a Reader and then copy into a Builder as a means of - // validating the content. - // - // WARNING: It is NOT safe to initialize a MessageBuilder in this way from memory that is - // currently in use by another MessageBuilder or MessageReader. Other readers/builders will - // not observe changes to the segment sizes nor newly-allocated segments caused by allocating - // new objects in this message. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) = 0; - // Allocates an array of at least the given number of words, throwing an exception or crashing if - // this is not possible. It is expected that this method will usually return more space than - // requested, and the caller should use that extra space as much as possible before allocating - // more. The returned space remains valid at least until the MessageBuilder is destroyed. - // - // Cap'n Proto will only call this once at a time, so the subclass need not worry about - // thread-safety. - - template - typename RootType::Builder initRoot(); - // Initialize the root struct of the message as the given struct type. - - template - void setRoot(Reader&& value); - // Set the root struct to a deep copy of the given struct. - - template - typename RootType::Builder getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Builder getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - typename RootType::Builder initRoot(SchemaType schema); - // Dynamically init the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - void adoptRoot(Orphan&& orphan); - // Like setRoot() but adopts the orphan without copying. - - kj::ArrayPtr> getSegmentsForOutput(); - // Get the raw data that makes up the message. - - Orphanage getOrphanage(); - - bool isCanonical(); - // Check whether the message builder is in canonical form - -private: - void* arenaSpace[22]; - // Space in which we can construct a BuilderArena. We don't use BuilderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a BuilderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - - bool allocatedArena = false; - // We have to initialize the arena lazily because when we do so we want to allocate the root - // pointer immediately, and this will allocate a segment, which requires a virtual function - // call on the MessageBuilder. We can't do such a call in the constructor since the subclass - // isn't constructed yet. This is kind of annoying because it means that getOrphanage() is - // not thread-safe, but that shouldn't be a huge deal... - - _::BuilderArena* arena() { return reinterpret_cast<_::BuilderArena*>(arenaSpace); } - _::SegmentBuilder* getRootSegment(); - AnyPointer::Builder getRootInternal(); -}; - -template -typename RootType::Reader readMessageUnchecked(const word* data); -// IF THE INPUT IS INVALID, THIS MAY CRASH, CORRUPT MEMORY, CREATE A SECURITY HOLE IN YOUR APP, -// MURDER YOUR FIRST-BORN CHILD, AND/OR BRING ABOUT ETERNAL DAMNATION ON ALL OF HUMANITY. DO NOT -// USE UNLESS YOU UNDERSTAND THE CONSEQUENCES. -// -// Given a pointer to a known-valid message located in a single contiguous memory segment, -// returns a reader for that message. No bounds-checking will be done while traversing this -// message. Use this only if you have already verified that all pointers are valid and in-bounds, -// and there are no far pointers in the message. -// -// To create a message that can be passed to this function, build a message using a MallocAllocator -// whose preferred segment size is larger than the message size. This guarantees that the message -// will be allocated as a single segment, meaning getSegmentsForOutput() returns a single word -// array. That word array is your message; you may pass a pointer to its first word into -// readMessageUnchecked() to read the message. -// -// This can be particularly handy for embedding messages in generated code: you can -// embed the raw bytes (using AlignedData) then make a Reader for it using this. This is the way -// default values are embedded in code generated by the Cap'n Proto compiler. E.g., if you have -// a message MyMessage, you can read its default value like so: -// MyMessage::Reader reader = Message::readMessageUnchecked(MyMessage::DEFAULT.words); -// -// To sanitize a message from an untrusted source such that it can be safely passed to -// readMessageUnchecked(), use copyToUnchecked(). - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer); -// Copy the content of the given reader into the given buffer, such that it can safely be passed to -// readMessageUnchecked(). The buffer's size must be exactly reader.totalSizeInWords() + 1, -// otherwise an exception will be thrown. The buffer must be zero'd before calling. - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data); -// Interprets the given data as a single, data-only struct. Only primitive fields (booleans, -// numbers, and enums) will be readable; all pointers will be null. This is useful if you want -// to use Cap'n Proto as a language/platform-neutral way to pack some bits. -// -// The input is a word array rather than a byte array to enforce alignment. If you have a byte -// array which you know is word-aligned (or if your platform supports unaligned reads and you don't -// mind the performance penalty), then you can use `reinterpret_cast` to convert a byte array into -// a word array: -// -// kj::arrayPtr(reinterpret_cast(bytes.begin()), -// reinterpret_cast(bytes.end())) - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder); -// Given a struct builder, get the underlying data section as a word array, suitable for passing -// to `readDataStruct()`. -// -// Note that you may call `.toBytes()` on the returned value to convert to `ArrayPtr`. - -template -static typename Type::Reader defaultValue(); -// Get a default instance of the given struct or list type. -// -// TODO(cleanup): Find a better home for this function? - -// ======================================================================================= - -class SegmentArrayMessageReader: public MessageReader { - // A simple MessageReader that reads from an array of word arrays representing all segments. - // In particular you can read directly from the output of MessageBuilder::getSegmentsForOutput() - // (although it would probably make more sense to call builder.getRoot().asReader() in that case). - -public: - SegmentArrayMessageReader(kj::ArrayPtr> segments, - ReaderOptions options = ReaderOptions()); - // Creates a message pointing at the given segment array, without taking ownership of the - // segments. All arrays passed in must remain valid until the MessageReader is destroyed. - - KJ_DISALLOW_COPY(SegmentArrayMessageReader); - ~SegmentArrayMessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) override; - -private: - kj::ArrayPtr> segments; -}; - -enum class AllocationStrategy: uint8_t { - FIXED_SIZE, - // The builder will prefer to allocate the same amount of space for each segment with no - // heuristic growth. It will still allocate larger segments when the preferred size is too small - // for some single object. This mode is generally not recommended, but can be particularly useful - // for testing in order to force a message to allocate a predictable number of segments. Note - // that you can force every single object in the message to be located in a separate segment by - // using this mode with firstSegmentWords = 0. - - GROW_HEURISTICALLY - // The builder will heuristically decide how much space to allocate for each segment. Each - // allocated segment will be progressively larger than the previous segments on the assumption - // that message sizes are exponentially distributed. The total number of segments that will be - // allocated for a message of size n is O(log n). -}; - -constexpr uint SUGGESTED_FIRST_SEGMENT_WORDS = 1024; -constexpr AllocationStrategy SUGGESTED_ALLOCATION_STRATEGY = AllocationStrategy::GROW_HEURISTICALLY; - -class MallocMessageBuilder: public MessageBuilder { - // A simple MessageBuilder that uses malloc() (actually, calloc()) to allocate segments. This - // implementation should be reasonable for any case that doesn't require writing the message to - // a specific location in memory. - -public: - explicit MallocMessageBuilder(uint firstSegmentWords = SUGGESTED_FIRST_SEGMENT_WORDS, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // Creates a BuilderContext which allocates at least the given number of words for the first - // segment, and then uses the given strategy to decide how much to allocate for subsequent - // segments. When choosing a value for firstSegmentWords, consider that: - // 1) Reading and writing messages gets slower when multiple segments are involved, so it's good - // if most messages fit in a single segment. - // 2) Unused bytes will not be written to the wire, so generally it is not a big deal to allocate - // more space than you need. It only becomes problematic if you are allocating many messages - // in parallel and thus use lots of memory, or if you allocate so much extra space that just - // zeroing it out becomes a bottleneck. - // The defaults have been chosen to be reasonable for most people, so don't change them unless you - // have reason to believe you need to. - - explicit MallocMessageBuilder(kj::ArrayPtr firstSegment, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // This version always returns the given array for the first segment, and then proceeds with the - // allocation strategy. This is useful for optimization when building lots of small messages in - // a tight loop: you can reuse the space for the first segment. - // - // firstSegment MUST be zero-initialized. MallocMessageBuilder's destructor will write new zeros - // over any space that was used so that it can be reused. - - KJ_DISALLOW_COPY(MallocMessageBuilder); - virtual ~MallocMessageBuilder() noexcept(false); - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - uint nextSize; - AllocationStrategy allocationStrategy; - - bool ownFirstSegment; - bool returnedFirstSegment; - - void* firstSegment; - - struct MoreSegments; - kj::Maybe> moreSegments; -}; - -class FlatMessageBuilder: public MessageBuilder { - // THIS IS NOT THE CLASS YOU'RE LOOKING FOR. - // - // If you want to write a message into already-existing scratch space, use `MallocMessageBuilder` - // and pass the scratch space to its constructor. It will then only fall back to malloc() if - // the scratch space is not large enough. - // - // Do NOT use this class unless you really know what you're doing. This class is problematic - // because it requires advance knowledge of the size of your message, which is usually impossible - // to determine without actually building the message. The class was created primarily to - // implement `copyToUnchecked()`, which itself exists only to support other internal parts of - // the Cap'n Proto implementation. - -public: - explicit FlatMessageBuilder(kj::ArrayPtr array); - KJ_DISALLOW_COPY(FlatMessageBuilder); - virtual ~FlatMessageBuilder() noexcept(false); - - void requireFilled(); - // Throws an exception if the flat array is not exactly full. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - kj::ArrayPtr array; - bool allocated; -}; - -// ======================================================================================= -// implementation details - -inline const ReaderOptions& MessageReader::getOptions() { - return options; -} - -template -inline typename RootType::Reader MessageReader::getRoot() { - return getRootInternal().getAs(); -} - -template -inline typename RootType::Builder MessageBuilder::initRoot() { - return getRootInternal().initAs(); -} - -template -inline void MessageBuilder::setRoot(Reader&& value) { - getRootInternal().setAs>(value); -} - -template -inline typename RootType::Builder MessageBuilder::getRoot() { - return getRootInternal().getAs(); -} - -template -void MessageBuilder::adoptRoot(Orphan&& orphan) { - return getRootInternal().adopt(kj::mv(orphan)); -} - -template -typename RootType::Reader MessageReader::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::initRoot(SchemaType schema) { - return getRootInternal().initAs(schema); -} - -template -typename RootType::Reader readMessageUnchecked(const word* data) { - return AnyPointer::Reader(_::PointerReader::getRootUnchecked(data)).getAs(); -} - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer) { - FlatMessageBuilder builder(uncheckedBuffer); - builder.setRoot(kj::fwd(reader)); - builder.requireFilled(); -} - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data) { - return typename RootType::Reader(_::StructReader(data)); -} - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder) { - auto bytes = _::PointerHelpers>::getInternalBuilder(kj::mv(builder)) - .getDataSectionAsBlob(); - return kj::arrayPtr(reinterpret_cast(bytes.begin()), - reinterpret_cast(bytes.end())); -} - -template -static typename Type::Reader defaultValue() { - return typename Type::Reader(_::StructReader()); -} - -template -kj::Array canonicalize(T&& reader) { - return _::PointerHelpers>::getInternalReader(reader).canonicalize(); -} - -} // namespace capnp - -#endif // CAPNP_MESSAGE_H_ diff --git a/external/capnp/include/capnp/orphan.h b/external/capnp/include/capnp/orphan.h deleted file mode 100644 index 8c8b9a6054..0000000000 --- a/external/capnp/include/capnp/orphan.h +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ORPHAN_H_ -#define CAPNP_ORPHAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -struct DynamicStruct; -struct DynamicList; -namespace _ { struct OrphanageInternal; } - -template -class Orphan { - // Represents an object which is allocated within some message builder but has no pointers - // pointing at it. An Orphan can later be "adopted" by some other object as one of that object's - // fields, without having to copy the orphan. For a field `foo` of pointer type, the generated - // code will define builder methods `void adoptFoo(Orphan)` and `Orphan disownFoo()`. - // Orphans can also be created independently of any parent using an Orphanage. - // - // `Orphan` can be moved but not copied, like `Own`, so that it is impossible for one - // orphan to be adopted multiple times. If an orphan is destroyed without being adopted, its - // contents are zero'd out (and possibly reused, if we ever implement the ability to reuse space - // in a message arena). - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder): builder(kj::mv(builder)) {} - - inline BuilderFor get(); - // Get the underlying builder. If the orphan is null, this will allocate and return a default - // object rather than crash. This is done for security -- otherwise, you might enable a DoS - // attack any time you disown a field and fail to check if it is null. In the case of structs, - // this means that the orphan is no longer null after get() returns. In the case of lists, - // no actual object is allocated since a simple empty ListBuilder can be returned. - - inline ReaderFor getReader() const; - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - - inline void truncate(uint size); - // Resize an object (which must be a list or a blob) to the given size. - // - // If the new size is less than the original, the remaining elements will be discarded. The - // list is never moved in this case. If the list happens to be located at the end of its segment - // (which is always true if the list was the last thing allocated), the removed memory will be - // reclaimed (reducing the messag size), otherwise it is simply zeroed. The reclaiming behavior - // is particularly useful for allocating buffer space when you aren't sure how much space you - // actually need: you can pre-allocate, say, a 4k byte array, read() from a file into it, and - // then truncate it back to the amount of space actually used. - // - // If the new size is greater than the original, the list is extended with default values. If - // the list is the last object in its segment *and* there is enough space left in the segment to - // extend it to cover the new values, then the list is extended in-place. Otherwise, it must be - // moved to a new location, leaving a zero'd hole in the previous space that won't be filled. - // This copy is shallow; sub-objects will simply be reparented, not copied. - // - // Any existing readers or builders pointing at the object are invalidated by this call (even if - // it doesn't move). You must call `get()` or `getReader()` again to get the new, valid pointer. - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - template - friend struct List; - template - friend class Orphan; - friend class Orphanage; - friend class MessageBuilder; -}; - -class Orphanage: private kj::DisallowConstCopy { - // Use to directly allocate Orphan objects, without having a parent object allocate and then - // disown the object. - -public: - inline Orphanage(): arena(nullptr) {} - - template - static Orphanage getForMessageContaining(BuilderType builder); - // Construct an Orphanage that allocates within the message containing the given Builder. This - // allows the constructed Orphans to be adopted by objects within said message. - // - // This constructor takes the builder rather than having the builder have a getOrphanage() method - // because this is an advanced feature and we don't want to pollute the builder APIs with it. - // - // Note that if you have a direct pointer to the `MessageBuilder`, you can simply call its - // `getOrphanage()` method. - - template - Orphan newOrphan() const; - // Allocate a new orphaned struct. - - template - Orphan newOrphan(uint size) const; - // Allocate a new orphaned list or blob. - - Orphan newOrphan(StructSchema schema) const; - // Dynamically create an orphan struct with the given schema. You must - // #include to use this. - - Orphan newOrphan(ListSchema schema, uint size) const; - // Dynamically create an orphan list with the given schema. You must #include - // to use this. - - template - Orphan> newOrphanCopy(Reader copyFrom) const; - // Allocate a new orphaned object (struct, list, or blob) and initialize it as a copy of the - // given object. - - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - // Given an array of List readers, copy and concatenate the lists, creating a new Orphan. - // - // Note that compared to allocating the list yourself and using `setWithCaveats()` to set each - // item, this method avoids the "caveats": the new list will be allocated with the element size - // being the maximum of that from all the input lists. This is particularly important when - // concatenating struct lists: if the lists were created using a newer version of the protocol - // in which some new fields had been added to the struct, using `setWithCaveats()` would - // truncate off those new fields. - - Orphan referenceExternalData(Data::Reader data) const; - // Creates an Orphan that points at an existing region of memory (e.g. from another message) - // without copying it. There are some SEVERE restrictions on how this can be used: - // - The memory must remain valid until the `MessageBuilder` is destroyed (even if the orphan is - // abandoned). - // - Because the data is const, you will not be allowed to obtain a `Data::Builder` - // for this blob. Any call which would return such a builder will throw an exception. You - // can, however, obtain a Reader, e.g. via orphan.getReader() or from a parent Reader (once - // the orphan is adopted). It is your responsibility to make sure your code can deal with - // these problems when using this optimization; if you can't, allocate a copy instead. - // - `data.begin()` must be aligned to a machine word boundary (32-bit or 64-bit depending on - // the CPU). Any pointer returned by malloc() as well as any data blob obtained from another - // Cap'n Proto message satisfies this. - // - If `data.size()` is not a multiple of 8, extra bytes past data.end() up until the next 8-byte - // boundary will be visible in the raw message when it is written out. Thus, there must be no - // secrets in these bytes. Data blobs obtained from other Cap'n Proto messages should be safe - // as these bytes should be zero (unless the sender had the same problem). - // - // The array will actually become one of the message's segments. The data can thus be adopted - // into the message tree without copying it. This is particularly useful when referencing very - // large blobs, such as whole mmap'd files. - -private: - _::BuilderArena* arena; - _::CapTableBuilder* capTable; - - inline explicit Orphanage(_::BuilderArena* arena, _::CapTableBuilder* capTable) - : arena(arena), capTable(capTable) {} - - template - struct GetInnerBuilder; - template - struct GetInnerReader; - template - struct NewOrphanListImpl; - - friend class MessageBuilder; - friend struct _::OrphanageInternal; -}; - -// ======================================================================================= -// Inline implementation details. - -namespace _ { // private - -template -struct OrphanGetImpl; - -template -struct OrphanGetImpl { - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::elementSizeForType()); - } -}; - -template -struct OrphanGetImpl { - static inline typename T::Builder apply(_::OrphanBuilder& builder) { - return typename T::Builder(builder.asStruct(_::structSize())); - } - static inline typename T::Reader applyReader(const _::OrphanBuilder& builder) { - return typename T::Reader(builder.asStructReader(_::structSize())); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::structSize()); - } -}; - -#if !CAPNP_LITE -template -struct OrphanGetImpl { - static inline typename T::Client apply(_::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline typename T::Client applyReader(const _::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; -#endif // !CAPNP_LITE - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asList(_::ElementSizeForType::value)); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asStructList(_::structSize())); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Text::Builder apply(_::OrphanBuilder& builder) { - return Text::Builder(builder.asText()); - } - static inline Text::Reader applyReader(const _::OrphanBuilder& builder) { - return Text::Reader(builder.asTextReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Data::Builder apply(_::OrphanBuilder& builder) { - return Data::Builder(builder.asData()); - } - static inline Data::Reader applyReader(const _::OrphanBuilder& builder) { - return Data::Reader(builder.asDataReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -struct OrphanageInternal { - static inline _::BuilderArena* getArena(Orphanage orphanage) { return orphanage.arena; } - static inline _::CapTableBuilder* getCapTable(Orphanage orphanage) { return orphanage.capTable; } -}; - -} // namespace _ (private) - -template -inline BuilderFor Orphan::get() { - return _::OrphanGetImpl::apply(builder); -} - -template -inline ReaderFor Orphan::getReader() const { - return _::OrphanGetImpl::applyReader(builder); -} - -template -inline void Orphan::truncate(uint size) { - _::OrphanGetImpl>::truncateListOf(builder, bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncateText(bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncate(bounded(size) * ELEMENTS, ElementSize::BYTE); -} - -template -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(typename T::Builder& t) { - return t._builder; - } -}; - -template -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(typename T::Builder& t) { - return t.builder; - } -}; - -template -Orphanage Orphanage::getForMessageContaining(BuilderType builder) { - auto inner = GetInnerBuilder>::apply(builder); - return Orphanage(inner.getArena(), inner.getCapTable()); -} - -template -Orphan Orphanage::newOrphan() const { - return Orphan(_::OrphanBuilder::initStruct(arena, capTable, _::structSize())); -} - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initList( - arena, capTable, bounded(size) * ELEMENTS, _::ElementSizeForType::value); - } -}; - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initStructList( - arena, capTable, bounded(size) * ELEMENTS, _::structSize()); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initText(arena, capTable, bounded(size) * BYTES); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initData(arena, capTable, bounded(size) * BYTES); - } -}; - -template -Orphan Orphanage::newOrphan(uint size) const { - return Orphan(NewOrphanListImpl::apply(arena, capTable, size)); -} - -template -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const typename T::Reader& t) { - return t._reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const typename T::Reader& t) { - return t.reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline const typename T::Reader& apply(const typename T::Reader& t) { - return t; - } -}; - -template -inline Orphan> Orphanage::newOrphanCopy(Reader copyFrom) const { - return Orphan>(_::OrphanBuilder::copy( - arena, capTable, GetInnerReader>::apply(copyFrom))); -} - -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - return newOrphanConcat(kj::implicitCast>(lists)); -} -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - // Optimization / simplification: Rely on List::Reader containing nothing except a - // _::ListReader. - static_assert(sizeof(T) == sizeof(_::ListReader), "lists are not bare readers?"); - kj::ArrayPtr raw( - reinterpret_cast(lists.begin()), lists.size()); - typedef ListElementType> Element; - return Orphan>( - _::OrphanBuilder::concat(arena, capTable, - _::elementSizeForType(), - _::minStructSizeForElement(), raw)); -} - -inline Orphan Orphanage::referenceExternalData(Data::Reader data) const { - return Orphan(_::OrphanBuilder::referenceExternalData(arena, data)); -} - -} // namespace capnp - -#endif // CAPNP_ORPHAN_H_ diff --git a/external/capnp/include/capnp/persistent.capnp b/external/capnp/include/capnp/persistent.capnp deleted file mode 100644 index a13b47168a..0000000000 --- a/external/capnp/include/capnp/persistent.capnp +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb8630836983feed7; - -$import "/capnp/c++.capnp".namespace("capnp"); - -interface Persistent@0xc8cb212fcd9f5691(SturdyRef, Owner) { - # Interface implemented by capabilities that outlive a single connection. A client may save() - # the capability, producing a SturdyRef. The SturdyRef can be stored to disk, then later used to - # obtain a new reference to the capability on a future connection. - # - # The exact format of SturdyRef depends on the "realm" in which the SturdyRef appears. A "realm" - # is an abstract space in which all SturdyRefs have the same format and refer to the same set of - # resources. Every vat is in exactly one realm. All capability clients within that vat must - # produce SturdyRefs of the format appropriate for the realm. - # - # Similarly, every VatNetwork also resides in a particular realm. Usually, a vat's "realm" - # corresponds to the realm of its main VatNetwork. However, a Vat can in fact communicate over - # a VatNetwork in a different realm -- in this case, all SturdyRefs need to be transformed when - # coming or going through said VatNetwork. The RPC system has hooks for registering - # transformation callbacks for this purpose. - # - # Since the format of SturdyRef is realm-dependent, it is not defined here. An application should - # choose an appropriate realm for itself as part of its design. Note that under Sandstorm, every - # application exists in its own realm and is therefore free to define its own SturdyRef format; - # the Sandstorm platform handles translating between realms. - # - # Note that whether a capability is persistent is often orthogonal to its type. In these cases, - # the capability's interface should NOT inherit `Persistent`; instead, just perform a cast at - # runtime. It's not type-safe, but trying to be type-safe in these cases will likely lead to - # tears. In cases where a particular interface only makes sense on persistent capabilities, it - # still should not explicitly inherit Persistent because the `SturdyRef` and `Owner` types will - # vary between realms (they may even be different at the call site than they are on the - # implementation). Instead, mark persistent interfaces with the $persistent annotation (defined - # below). - # - # Sealing - # ------- - # - # As an added security measure, SturdyRefs may be "sealed" to a particular owner, such that - # if the SturdyRef itself leaks to a third party, that party cannot actually restore it because - # they are not the owner. To restore a sealed capability, you must first prove to its host that - # you are the rightful owner. The precise mechanism for this authentication is defined by the - # realm. - # - # Sealing is a defense-in-depth mechanism meant to mitigate damage in the case of catastrophic - # attacks. For example, say an attacker temporarily gains read access to a database full of - # SturdyRefs: it would be unfortunate if it were then necessary to revoke every single reference - # in the database to prevent the attacker from using them. - # - # In general, an "owner" is a course-grained identity. Because capability-based security is still - # the primary mechanism of security, it is not necessary nor desirable to have a separate "owner" - # identity for every single process or object; that is exactly what capabilities are supposed to - # avoid! Instead, it makes sense for an "owner" to literally identify the owner of the machines - # where the capability is stored. If untrusted third parties are able to run arbitrary code on - # said machines, then the sandbox for that code should be designed using Distributed Confinement - # such that the third-party code never sees the bits of the SturdyRefs and cannot directly - # exercise the owner's power to restore refs. See: - # - # http://www.erights.org/elib/capability/dist-confine.html - # - # Resist the urge to represent an Owner as a simple public key. The whole point of sealing is to - # defend against leaked-storage attacks. Such attacks can easily result in the owner's private - # key being stolen as well. A better solution is for `Owner` to contain a simple globally unique - # identifier for the owner, and for everyone to separately maintain a mapping of owner IDs to - # public keys. If an owner's private key is compromised, then humans will need to communicate - # and agree on a replacement public key, then update the mapping. - # - # As a concrete example, an `Owner` could simply contain a domain name, and restoring a SturdyRef - # would require signing a request using the domain's private key. Authenticating this key could - # be accomplished through certificate authorities or web-of-trust techniques. - - save @0 SaveParams -> SaveResults; - # Save a capability persistently so that it can be restored by a future connection. Not all - # capabilities can be saved -- application interfaces should define which capabilities support - # this and which do not. - - struct SaveParams { - sealFor @0 :Owner; - # Seal the SturdyRef so that it can only be restored by the specified Owner. This is meant - # to mitigate damage when a SturdyRef is leaked. See comments above. - # - # Leaving this value null may or may not be allowed; it is up to the realm to decide. If a - # realm does allow a null owner, this should indicate that anyone is allowed to restore the - # ref. - } - struct SaveResults { - sturdyRef @0 :SturdyRef; - } -} - -interface RealmGateway(InternalRef, ExternalRef, InternalOwner, ExternalOwner) { - # Interface invoked when a SturdyRef is about to cross realms. The RPC system supports providing - # a RealmGateway as a callback hook when setting up RPC over some VatNetwork. - - import @0 (cap :Persistent(ExternalRef, ExternalOwner), - params :Persistent(InternalRef, InternalOwner).SaveParams) - -> Persistent(InternalRef, InternalOwner).SaveResults; - # Given an external capability, save it and return an internal reference. Used when someone - # inside the realm tries to save a capability from outside the realm. - - export @1 (cap :Persistent(InternalRef, InternalOwner), - params :Persistent(ExternalRef, ExternalOwner).SaveParams) - -> Persistent(ExternalRef, ExternalOwner).SaveResults; - # Given an internal capability, save it and return an external reference. Used when someone - # outside the realm tries to save a capability from inside the realm. -} - -annotation persistent(interface, field) :Void; -# Apply this annotation to interfaces for objects that will always be persistent, instead of -# extending the Persistent capability, since the correct type parameters to Persistent depend on -# the realm, which is orthogonal to the interface type and therefore should not be defined -# along-side it. -# -# You may also apply this annotation to a capability-typed field which will always contain a -# persistent capability, but where the capability's interface itself is not already marked -# persistent. -# -# Note that absence of the $persistent annotation doesn't mean a capability of that type isn't -# persistent; it just means not *all* such capabilities are persistent. diff --git a/external/capnp/include/capnp/persistent.capnp.h b/external/capnp/include/capnp/persistent.capnp.h deleted file mode 100644 index f9b443220a..0000000000 --- a/external/capnp/include/capnp/persistent.capnp.h +++ /dev/null @@ -1,1328 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: persistent.capnp - -#ifndef CAPNP_INCLUDED_b8630836983feed7_ -#define CAPNP_INCLUDED_b8630836983feed7_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(c8cb212fcd9f5691); -CAPNP_DECLARE_SCHEMA(f76fba59183073a5); -CAPNP_DECLARE_SCHEMA(b76848c18c40efbf); -CAPNP_DECLARE_SCHEMA(84ff286cd00a3ed4); -CAPNP_DECLARE_SCHEMA(f0c2cc1d3909574d); -CAPNP_DECLARE_SCHEMA(ecafa18b482da3aa); -CAPNP_DECLARE_SCHEMA(f622595091cafb67); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -template -struct Persistent { - Persistent() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct SaveParams; - struct SaveResults; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(c8cb212fcd9f5691) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct Persistent::SaveParams { - SaveParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f76fba59183073a5, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct Persistent::SaveResults { - SaveResults() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b76848c18c40efbf, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway { - RealmGateway() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct ImportParams; - struct ExportParams; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(84ff286cd00a3ed4) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct RealmGateway::ImportParams { - ImportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f0c2cc1d3909574d, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway::ExportParams { - ExportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ecafa18b482da3aa, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -#if !CAPNP_LITE -template -class Persistent::Client - : public virtual ::capnp::Capability::Client { -public: - typedef Persistent Calls; - typedef Persistent Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename Persistent::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) saveRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class Persistent::Server - : public virtual ::capnp::Capability::Server { -public: - typedef Persistent Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef ::capnp::CallContext::SaveParams, typename ::capnp::Persistent::SaveResults> SaveContext; - virtual ::kj::Promise save(SaveContext context); - - inline typename ::capnp::Persistent::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::Persistent>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveParams::Reader { -public: - typedef SaveParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Reader asPersistentGeneric() { - return typename Persistent::SaveParams::Reader(_reader); - } - - inline bool hasSealFor() const; - inline ::capnp::ReaderFor getSealFor() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveParams::Builder { -public: - typedef SaveParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Builder asPersistentGeneric() { - return typename Persistent::SaveParams::Builder(_builder); - } - - inline bool hasSealFor(); - inline ::capnp::BuilderFor getSealFor(); - inline void setSealFor( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSealFor(); - inline ::capnp::BuilderFor initSealFor(unsigned int size); - inline void adoptSealFor(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSealFor(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveParams::Pipeline { -public: - typedef SaveParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSealFor(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveResults::Reader { -public: - typedef SaveResults Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Reader asPersistentGeneric() { - return typename Persistent::SaveResults::Reader(_reader); - } - - inline bool hasSturdyRef() const; - inline ::capnp::ReaderFor getSturdyRef() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveResults::Builder { -public: - typedef SaveResults Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Builder asPersistentGeneric() { - return typename Persistent::SaveResults::Builder(_builder); - } - - inline bool hasSturdyRef(); - inline ::capnp::BuilderFor getSturdyRef(); - inline void setSturdyRef( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSturdyRef(); - inline ::capnp::BuilderFor initSturdyRef(unsigned int size); - inline void adoptSturdyRef(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSturdyRef(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveResults::Pipeline { -public: - typedef SaveResults Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSturdyRef(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -class RealmGateway::Client - : public virtual ::capnp::Capability::Client { -public: - typedef RealmGateway Calls; - typedef RealmGateway Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename RealmGateway::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) importRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) exportRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class RealmGateway::Server - : public virtual ::capnp::Capability::Server { -public: - typedef RealmGateway Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef typename ::capnp::RealmGateway::ImportParams ImportParams; - typedef ::capnp::CallContext::SaveResults> ImportContext; - virtual ::kj::Promise import(ImportContext context); - typedef typename ::capnp::RealmGateway::ExportParams ExportParams; - typedef ::capnp::CallContext::SaveResults> ExportContext; - virtual ::kj::Promise export_(ExportContext context); - - inline typename ::capnp::RealmGateway::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::RealmGateway>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ImportParams::Reader { -public: - typedef ImportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ImportParams::Builder { -public: - typedef ImportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ImportParams::Pipeline { -public: - typedef ImportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ExportParams::Reader { -public: - typedef ExportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ExportParams::Builder { -public: - typedef ExportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ExportParams::Pipeline { -public: - typedef ExportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -#if !CAPNP_LITE -template -inline Persistent::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline Persistent::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline Persistent::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline Persistent::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline Persistent::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool Persistent::SaveParams::Reader::hasSealFor() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveParams::Builder::hasSealFor() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveParams::Reader::getSealFor() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::getSealFor() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveParams::Pipeline::getSealFor() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveParams::Builder::setSealFor( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveParams::Builder::adoptSealFor( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveParams::Builder::disownSealFor() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveParams -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveParams::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f76fba59183073a5, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool Persistent::SaveResults::Reader::hasSturdyRef() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveResults::Builder::hasSturdyRef() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveResults::Reader::getSturdyRef() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::getSturdyRef() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveResults::Pipeline::getSturdyRef() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveResults::Builder::setSturdyRef( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveResults::Builder::adoptSturdyRef( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveResults::Builder::disownSturdyRef() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveResults -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveResults::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveResults::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveResults::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveResults::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveResults::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_b76848c18c40efbf, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) -Persistent::Client::saveRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::SaveParams, typename ::capnp::Persistent::SaveResults>( - 0xc8cb212fcd9f5691ull, 0, sizeHint); -} -template -::kj::Promise Persistent::Server::save(SaveContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", "save", - 0xc8cb212fcd9f5691ull, 0); -} -template -::kj::Promise Persistent::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0xc8cb212fcd9f5691ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:Persistent", interfaceId); - } -} -template -::kj::Promise Persistent::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return save(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::Persistent::SaveParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", - 0xc8cb212fcd9f5691ull, methodId); - } -} -#endif // !CAPNP_LITE - -// Persistent -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency Persistent::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema Persistent::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_c8cb212fcd9f5691, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -inline RealmGateway::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline RealmGateway::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline RealmGateway::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline RealmGateway::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline RealmGateway::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool RealmGateway::ImportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ImportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ImportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ImportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ImportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ImportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ImportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ImportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ImportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ImportParams -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ImportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ImportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ImportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ImportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ImportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ImportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f0c2cc1d3909574d, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ExportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ExportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ExportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ExportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ExportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ExportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ExportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ExportParams -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ExportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ExportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ExportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ExportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ExportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ExportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_ecafa18b482da3aa, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::importRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ImportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 0, sizeHint); -} -template -::kj::Promise RealmGateway::Server::import(ImportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "import", - 0x84ff286cd00a3ed4ull, 0); -} -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::exportRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ExportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 1, sizeHint); -} -template -::kj::Promise RealmGateway::Server::export_(ExportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "export", - 0x84ff286cd00a3ed4ull, 1); -} -template -::kj::Promise RealmGateway::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0x84ff286cd00a3ed4ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:RealmGateway", interfaceId); - } -} -template -::kj::Promise RealmGateway::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return import(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ImportParams, typename ::capnp::Persistent::SaveResults>(context)); - case 1: - return export_(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ExportParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", - 0x84ff286cd00a3ed4ull, methodId); - } -} -#endif // !CAPNP_LITE - -// RealmGateway -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::RealmGateway::ImportParams::_capnpPrivate::brand() }, - { 33554433, ::capnp::RealmGateway::ExportParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, - { 50331649, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_84ff286cd00a3ed4, brandScopes, brandDependencies, - 1, 4, nullptr -}; -#endif // !CAPNP_LITE - -} // namespace - -#endif // CAPNP_INCLUDED_b8630836983feed7_ diff --git a/external/capnp/include/capnp/pointer-helpers.h b/external/capnp/include/capnp/pointer-helpers.h deleted file mode 100644 index fe70e5036f..0000000000 --- a/external/capnp/include/capnp/pointer-helpers.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_POINTER_HELPERS_H_ -#define CAPNP_POINTER_HELPERS_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "list.h" - -namespace capnp { -namespace _ { // private - -// PointerHelpers is a template class that assists in wrapping/unwrapping the low-level types in -// layout.h with the high-level public API and generated types. This way, the code generator -// and other templates do not have to specialize on each kind of pointer. - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, const word* defaultValue = nullptr) { - return typename T::Reader(reader.getStruct(defaultValue)); - } - static inline typename T::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename T::Builder(builder.getStruct(structSize(), defaultValue)); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader, true); - } - static inline typename T::Builder init(PointerBuilder builder) { - return typename T::Builder(builder.initStruct(structSize())); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::StructReader getInternalReader(const typename T::Reader& reader) { - return reader._reader; - } - static inline _::StructBuilder getInternalBuilder(typename T::Builder&& builder) { - return builder._builder; - } -}; - -template -struct PointerHelpers, Kind::LIST> { - static inline typename List::Reader get(PointerReader reader, - const word* defaultValue = nullptr) { - return typename List::Reader(List::getFromPointer(reader, defaultValue)); - } - static inline typename List::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename List::Builder(List::getFromPointer(builder, defaultValue)); - } - static inline void set(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader); - } - static inline void setCanonical(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader, true); - } - static void set(PointerBuilder builder, kj::ArrayPtr> value) { - auto l = init(builder, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - static inline typename List::Builder init(PointerBuilder builder, uint size) { - return typename List::Builder(List::initPointer(builder, size)); - } - static inline void adopt(PointerBuilder builder, Orphan>&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan> disown(PointerBuilder builder) { - return Orphan>(builder.disown()); - } - static inline _::ListReader getInternalReader(const typename List::Reader& reader) { - return reader.reader; - } - static inline _::ListBuilder getInternalBuilder(typename List::Builder&& builder) { - return builder.builder; - } -}; - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return reader.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline typename T::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return builder.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline typename T::Builder init(PointerBuilder builder, uint size) { - return builder.initBlob(bounded(size) * BYTES); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -struct UncheckedMessage { - typedef const word* Reader; -}; - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -template <> -struct PointerHelpers { - // Reads an AnyPointer field as an unchecked message pointer. Requires that the containing - // message is itself unchecked. This hack is currently private. It is used to locate default - // values within encoded schemas. - - static inline const word* get(PointerReader reader) { - return reader.getUnchecked(); - } -}; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_POINTER_HELPERS_H_ diff --git a/external/capnp/include/capnp/pretty-print.h b/external/capnp/include/capnp/pretty-print.h deleted file mode 100644 index e6458bca49..0000000000 --- a/external/capnp/include/capnp/pretty-print.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_PRETTY_PRINT_H_ -#define CAPNP_PRETTY_PRINT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "dynamic.h" -#include - -namespace capnp { - -kj::StringTree prettyPrint(DynamicStruct::Reader value); -kj::StringTree prettyPrint(DynamicStruct::Builder value); -kj::StringTree prettyPrint(DynamicList::Reader value); -kj::StringTree prettyPrint(DynamicList::Builder value); -// Print the given Cap'n Proto struct or list with nice indentation. Note that you can pass any -// struct or list reader or builder type to this method, since they can be implicitly converted -// to one of the dynamic types. -// -// If you don't want indentation, just use the value's KJ stringifier (e.g. pass it to kj::str(), -// any of the KJ debug macros, etc.). - -} // namespace capnp - -#endif // PRETTY_PRINT_H_ diff --git a/external/capnp/include/capnp/raw-schema.h b/external/capnp/include/capnp/raw-schema.h deleted file mode 100644 index ed9425a624..0000000000 --- a/external/capnp/include/capnp/raw-schema.h +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RAW_SCHEMA_H_ -#define CAPNP_RAW_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" // for uint and friends - -#if _MSC_VER -#include -#endif - -namespace capnp { -namespace _ { // private - -struct RawSchema; - -struct RawBrandedSchema { - // Represents a combination of a schema and bindings for its generic parameters. - // - // Note that while we generate one `RawSchema` per type, we generate a `RawBrandedSchema` for - // every _instance_ of a generic type -- or, at least, every instance that is actually used. For - // generated-code types, we use template magic to initialize these. - - const RawSchema* generic; - // Generic type which we're branding. - - struct Binding { - uint8_t which; // Numeric value of one of schema::Type::Which. - - bool isImplicitParameter; - // For AnyPointer, true if it's an implicit method parameter. - - uint16_t listDepth; // Number of times to wrap the base type in List(). - - uint16_t paramIndex; - // For AnyPointer. If it's a type parameter (scopeId is non-zero) or it's an implicit parameter - // (isImplicitParameter is true), then this is the parameter index. Otherwise this is a numeric - // value of one of schema::Type::AnyPointer::Unconstrained::Which. - - union { - const RawBrandedSchema* schema; // for struct, enum, interface - uint64_t scopeId; // for AnyPointer, if it's a type parameter - }; - - Binding() = default; - inline constexpr Binding(uint8_t which, uint16_t listDepth, const RawBrandedSchema* schema) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(0), - schema(schema) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, - uint64_t scopeId, uint16_t paramIndex) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(paramIndex), - scopeId(scopeId) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, uint16_t implicitParamIndex) - : which(which), isImplicitParameter(true), listDepth(listDepth), - paramIndex(implicitParamIndex), scopeId(0) {} - }; - - struct Scope { - uint64_t typeId; - // Type ID whose parameters are being bound. - - const Binding* bindings; - uint bindingCount; - // Bindings for those parameters. - - bool isUnbound; - // This scope is unbound, in the sense of SchemaLoader::getUnbound(). - }; - - const Scope* scopes; - // Array of enclosing scopes for which generic variables have been bound, sorted by type ID. - - struct Dependency { - uint location; - const RawBrandedSchema* schema; - }; - - const Dependency* dependencies; - // Map of branded schemas for dependencies of this type, given our brand. Only dependencies that - // are branded are included in this map; if a dependency is missing, use its `defaultBrand`. - - uint32_t scopeCount; - uint32_t dependencyCount; - - enum class DepKind { - // Component of a Dependency::location. Specifies what sort of dependency this is. - - INVALID, - // Mostly defined to ensure that zero is not a valid location. - - FIELD, - // Binding needed for a field's type. The index is the field index (NOT ordinal!). - - METHOD_PARAMS, - // Bindings needed for a method's params type. The index is the method number. - - METHOD_RESULTS, - // Bindings needed for a method's results type. The index is the method ordinal. - - SUPERCLASS, - // Bindings needed for a superclass type. The index is the superclass's index in the - // "extends" list. - - CONST_TYPE - // Bindings needed for the type of a constant. The index is zero. - }; - - static inline uint makeDepLocation(DepKind kind, uint index) { - // Make a number representing the location of a particular dependency within its parent - // schema. - - return (static_cast(kind) << 24) | index; - } - - class Initializer { - public: - virtual void init(const RawBrandedSchema* generic) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - inline bool isUnbound() const; - // Checks if this schema is the result of calling SchemaLoader::getUnbound(), in which case - // binding lookups need to be handled specially. -}; - -struct RawSchema { - // The generated code defines a constant RawSchema for every compiled declaration. - // - // This is an internal structure which could change in the future. - - uint64_t id; - - const word* encodedNode; - // Encoded SchemaNode, readable via readMessageUnchecked(encodedNode). - - uint32_t encodedSize; - // Size of encodedNode, in words. - - const RawSchema* const* dependencies; - // Pointers to other types on which this one depends, sorted by ID. The schemas in this table - // may be uninitialized -- you must call ensureInitialized() on the one you wish to use before - // using it. - // - // TODO(someday): Make this a hashtable. - - const uint16_t* membersByName; - // Indexes of members sorted by name. Used to implement name lookup. - // TODO(someday): Make this a hashtable. - - uint32_t dependencyCount; - uint32_t memberCount; - // Sizes of above tables. - - const uint16_t* membersByDiscriminant; - // List of all member indexes ordered by discriminant value. Those which don't have a - // discriminant value are listed at the end, in order by ordinal. - - const RawSchema* canCastTo; - // Points to the RawSchema of a compiled-in type to which it is safe to cast any DynamicValue - // with this schema. This is null for all compiled-in types; it is only set by SchemaLoader on - // dynamically-loaded types. - - class Initializer { - public: - virtual void init(const RawSchema* schema) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - RawBrandedSchema defaultBrand; - // Specifies the brand to use for this schema if no generic parameters have been bound to - // anything. Generally, in the default brand, all generic parameters are treated as if they were - // bound to `AnyPointer`. -}; - -inline bool RawBrandedSchema::isUnbound() const { - // The unbound schema is the only one that has no scopes but is not the default schema. - return scopeCount == 0 && this != &generic->defaultBrand; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RAW_SCHEMA_H_ diff --git a/external/capnp/include/capnp/rpc-prelude.h b/external/capnp/include/capnp/rpc-prelude.h deleted file mode 100644 index 7d26e39de8..0000000000 --- a/external/capnp/include/capnp/rpc-prelude.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before rpc.h can start. -// We don't define these directly in rpc.h because it makes the file hard to read. - -#ifndef CAPNP_RPC_PRELUDE_H_ -#define CAPNP_RPC_PRELUDE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "persistent.capnp.h" - -namespace capnp { - -class OutgoingRpcMessage; -class IncomingRpcMessage; - -template -class RpcSystem; - -namespace _ { // private - -class VatNetworkBase { - // Non-template version of VatNetwork. Ignore this class; see VatNetwork in rpc.h. - -public: - class Connection; - - struct ConnectionAndProvisionId { - kj::Own connection; - kj::Own firstMessage; - Orphan provisionId; - }; - - class Connection { - public: - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) = 0; - virtual kj::Promise>> receiveIncomingMessage() = 0; - virtual kj::Promise shutdown() = 0; - virtual AnyStruct::Reader baseGetPeerVatId() = 0; - }; - virtual kj::Maybe> baseConnect(AnyStruct::Reader vatId) = 0; - virtual kj::Promise> baseAccept() = 0; -}; - -class SturdyRefRestorerBase { -public: - virtual Capability::Client baseRestore(AnyPointer::Reader ref) = 0; -}; - -class BootstrapFactoryBase { - // Non-template version of BootstrapFactory. Ignore this class; see BootstrapFactory in rpc.h. -public: - virtual Capability::Client baseCreateFor(AnyStruct::Reader clientId) = 0; -}; - -class RpcSystemBase { - // Non-template version of RpcSystem. Ignore this class; see RpcSystem in rpc.h. - -public: - RpcSystemBase(VatNetworkBase& network, kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, BootstrapFactoryBase& bootstrapFactory, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& restorer); - RpcSystemBase(RpcSystemBase&& other) noexcept; - ~RpcSystemBase() noexcept(false); - -private: - class Impl; - kj::Own impl; - - Capability::Client baseBootstrap(AnyStruct::Reader vatId); - Capability::Client baseRestore(AnyStruct::Reader vatId, AnyPointer::Reader objectId); - void baseSetFlowLimit(size_t words); - - template - friend class capnp::RpcSystem; -}; - -template struct InternalRefFromRealmGateway_; -template -struct InternalRefFromRealmGateway_> { - typedef InternalRef Type; -}; -template -using InternalRefFromRealmGateway = typename InternalRefFromRealmGateway_::Type; -template -using InternalRefFromRealmGatewayClient = InternalRefFromRealmGateway; - -template struct ExternalRefFromRealmGateway_; -template -struct ExternalRefFromRealmGateway_> { - typedef ExternalRef Type; -}; -template -using ExternalRefFromRealmGateway = typename ExternalRefFromRealmGateway_::Type; -template -using ExternalRefFromRealmGatewayClient = ExternalRefFromRealmGateway; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RPC_PRELUDE_H_ diff --git a/external/capnp/include/capnp/rpc-twoparty.capnp b/external/capnp/include/capnp/rpc-twoparty.capnp deleted file mode 100644 index 0b670e8ac3..0000000000 --- a/external/capnp/include/capnp/rpc-twoparty.capnp +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xa184c7885cdaf2a1; -# This file defines the "network-specific parameters" in rpc.capnp to support a network consisting -# of two vats. Each of these vats may in fact be in communication with other vats, but any -# capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities -# received from the other end appear to live in a single vat. -# -# Two notable use cases for this model include: -# - Regular client-server communications, where a remote client machine (perhaps living on an end -# user's personal device) connects to a server. The server may be part of a cluster, and may -# call on other servers in the cluster to help service the user's request. It may even obtain -# capabilities from these other servers which it passes on to the user. To simplify network -# common traversal problems (e.g. if the user is behind a firewall), it is probably desirable to -# multiplex all communications between the server cluster and the client over the original -# connection rather than form new ones. This connection should use the two-party protocol, as -# the client has no interest in knowing about additional servers. -# - Applications running in a sandbox. A supervisor process may execute a confined application -# such that all of the confined app's communications with the outside world must pass through -# the supervisor. In this case, the connection between the confined app and the supervisor might -# as well use the two-party protocol, because the confined app is intentionally prevented from -# talking to any other vat anyway. Any external resources will be proxied through the supervisor, -# and so to the contained app will appear as if they were hosted by the supervisor itself. -# -# Since there are only two vats in this network, there is never a need for three-way introductions, -# so level 3 is free. Moreover, because it is never necessary to form new connections, the -# two-party protocol can be used easily anywhere where a two-way byte stream exists, without regard -# to where that byte stream goes or how it was initiated. This makes the two-party runtime library -# highly reusable. -# -# Joins (level 4) _could_ be needed in cases where one or both vats are participating in other -# networks that use joins. For instance, if Alice and Bob are speaking through the two-party -# protocol, and Bob is also participating on another network, Bob may send Alice two or more -# proxied capabilities which, unbeknownst to Bob at the time, are in fact pointing at the same -# remote object. Alice may then request to join these capabilities, at which point Bob will have -# to forward the join to the other network. Note, however, that if Alice is _not_ participating on -# any other network, then Alice will never need to _receive_ a Join, because Alice would always -# know when two locally-hosted capabilities are the same and would never export a redundant alias -# to Bob. So, Alice can respond to all incoming joins with an error, and only needs to implement -# outgoing joins if she herself desires to use this feature. Also, outgoing joins are relatively -# easy to implement in this scenario. -# -# What all this means is that a level 4 implementation of the confined network is barely more -# complicated than a level 2 implementation. However, such an implementation allows the "client" -# or "confined" app to access the server's/supervisor's network with equal functionality to any -# native participant. In other words, an application which implements only the two-party protocol -# can be paired with a proxy app in order to participate in any network. -# -# So, when implementing Cap'n Proto in a new language, it makes sense to implement only the -# two-party protocol initially, and then pair applications with an appropriate proxy written in -# C++, rather than implement other parameterizations of the RPC protocol directly. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc::twoparty"); - -# Note: SturdyRef is not specified here. It is up to the application to define semantics of -# SturdyRefs if desired. - -enum Side { - server @0; - # The object lives on the "server" or "supervisor" end of the connection. Only the - # server/supervisor knows how to interpret the ref; to the client, it is opaque. - # - # Note that containers intending to implement strong confinement should rewrite SturdyRefs - # received from the external network before passing them on to the confined app. The confined - # app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps - # maliciously leak), but instead receives only a thing that it can pass back to the container - # later to restore the ref. See: - # http://www.erights.org/elib/capability/dist-confine.html - - client @1; - # The object lives on the "client" or "confined app" end of the connection. Only the client - # knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not - # actually know how to persist capabilities at all, so use of this is unusual. -} - -struct VatId { - side @0 :Side; -} - -struct ProvisionId { - # Only used for joins, since three-way introductions never happen on a two-party network. - - joinId @0 :UInt32; - # The ID from `JoinKeyPart`. -} - -struct RecipientId {} -# Never used, because there are only two parties. - -struct ThirdPartyCapId {} -# Never used, because there is no third party. - -struct JoinKeyPart { - # Joins in the two-party case are simplified by a few observations. - # - # First, on a two-party network, a Join only ever makes sense if the receiving end is also - # connected to other networks. A vat which is not connected to any other network can safely - # reject all joins. - # - # Second, since a two-party connection bisects the network -- there can be no other connections - # between the networks at either end of the connection -- if one part of a join crosses the - # connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request - # off some other network which needs to be forwarded across the two-party connection can - # collect all the parts on its end and only forward them across the two-party connection when all - # have been received. - # - # For example, imagine that Alice and Bob are vats connected over a two-party connection, and - # each is also connected to other networks. At some point, Alice receives one part of a Join - # request off her network. The request is addressed to a capability that Alice received from - # Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as - # if she hosted the capability locally (this is important so that if not all the Join parts end - # up at Alice, the original sender can detect the failed Join without hanging). As other parts - # trickle in, Alice verifies that each part is addressed to a capability from Bob and continues - # to respond to each one. Once the complete set of join parts is received, Alice checks if they - # were all for the exact same capability. If so, she doesn't need to send anything to Bob at - # all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were - # addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice - # does not forward the Join parts she received herself, but essentially forwards the Join as a - # whole. - # - # On Bob's end, since he knows that Alice will always send all parts of a Join together, he - # simply waits until he's received them all, then performs a join on the respective capabilities - # as if it had been requested locally. - - joinId @0 :UInt32; - # A number identifying this join, chosen by the sender. May be reused once `Finish` messages are - # sent corresponding to all of the `Join` messages. - - partCount @1 :UInt16; - # The number of capabilities to be joined. - - partNum @2 :UInt16; - # Which part this request targets -- a number in the range [0, partCount). -} - -struct JoinResult { - joinId @0 :UInt32; - # Matches `JoinKeyPart`. - - succeeded @1 :Bool; - # All JoinResults in the set will have the same value for `succeeded`. The receiver actually - # implements the join by waiting for all the `JoinKeyParts` and then performing its own join on - # them, then going back and answering all the join requests afterwards. - - cap @2 :AnyPointer; - # One of the JoinResults will have a non-null `cap` which is the joined capability. - # - # TODO(cleanup): Change `AnyPointer` to `Capability` when that is supported. -} diff --git a/external/capnp/include/capnp/rpc-twoparty.capnp.h b/external/capnp/include/capnp/rpc-twoparty.capnp.h deleted file mode 100644 index 9d7820646a..0000000000 --- a/external/capnp/include/capnp/rpc-twoparty.capnp.h +++ /dev/null @@ -1,726 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc-twoparty.capnp - -#ifndef CAPNP_INCLUDED_a184c7885cdaf2a1_ -#define CAPNP_INCLUDED_a184c7885cdaf2a1_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(9fd69ebc87b9719c); -enum class Side_9fd69ebc87b9719c: uint16_t { - SERVER, - CLIENT, -}; -CAPNP_DECLARE_ENUM(Side, 9fd69ebc87b9719c); -CAPNP_DECLARE_SCHEMA(d20b909fee733a8e); -CAPNP_DECLARE_SCHEMA(b88d09a9c5f39817); -CAPNP_DECLARE_SCHEMA(89f389b6fd4082c1); -CAPNP_DECLARE_SCHEMA(b47f4979672cb59d); -CAPNP_DECLARE_SCHEMA(95b29059097fca83); -CAPNP_DECLARE_SCHEMA(9d263a3630b7ebee); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { -namespace twoparty { - -typedef ::capnp::schemas::Side_9fd69ebc87b9719c Side; - -struct VatId { - VatId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d20b909fee733a8e, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ProvisionId { - ProvisionId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b88d09a9c5f39817, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct RecipientId { - RecipientId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(89f389b6fd4082c1, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapId { - ThirdPartyCapId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b47f4979672cb59d, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinKeyPart { - JoinKeyPart() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95b29059097fca83, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinResult { - JoinResult() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9d263a3630b7ebee, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class VatId::Reader { -public: - typedef VatId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class VatId::Builder { -public: - typedef VatId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide(); - inline void setSide( ::capnp::rpc::twoparty::Side value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class VatId::Pipeline { -public: - typedef VatId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ProvisionId::Reader { -public: - typedef ProvisionId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ProvisionId::Builder { -public: - typedef ProvisionId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ProvisionId::Pipeline { -public: - typedef ProvisionId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class RecipientId::Reader { -public: - typedef RecipientId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class RecipientId::Builder { -public: - typedef RecipientId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class RecipientId::Pipeline { -public: - typedef RecipientId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapId::Reader { -public: - typedef ThirdPartyCapId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapId::Builder { -public: - typedef ThirdPartyCapId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapId::Pipeline { -public: - typedef ThirdPartyCapId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinKeyPart::Reader { -public: - typedef JoinKeyPart Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline ::uint16_t getPartCount() const; - - inline ::uint16_t getPartNum() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinKeyPart::Builder { -public: - typedef JoinKeyPart Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline ::uint16_t getPartCount(); - inline void setPartCount( ::uint16_t value); - - inline ::uint16_t getPartNum(); - inline void setPartNum( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinKeyPart::Pipeline { -public: - typedef JoinKeyPart Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinResult::Reader { -public: - typedef JoinResult Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline bool getSucceeded() const; - - inline bool hasCap() const; - inline ::capnp::AnyPointer::Reader getCap() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinResult::Builder { -public: - typedef JoinResult Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline bool getSucceeded(); - inline void setSucceeded(bool value); - - inline bool hasCap(); - inline ::capnp::AnyPointer::Builder getCap(); - inline ::capnp::AnyPointer::Builder initCap(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinResult::Pipeline { -public: - typedef JoinResult Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::twoparty::Side VatId::Reader::getSide() const { - return _reader.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::twoparty::Side VatId::Builder::getSide() { - return _builder.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void VatId::Builder::setSide( ::capnp::rpc::twoparty::Side value) { - _builder.setDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t ProvisionId::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ProvisionId::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ProvisionId::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinKeyPart::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinKeyPart::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartNum() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartNum() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinResult::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinResult::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::getSucceeded() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool JoinResult::Builder::getSucceeded() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setSucceeded(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JoinResult::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader JoinResult::Reader::getCap() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::getCap() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::initCap() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -} // namespace -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a184c7885cdaf2a1_ diff --git a/external/capnp/include/capnp/rpc-twoparty.h b/external/capnp/include/capnp/rpc-twoparty.h deleted file mode 100644 index 093c1fecdf..0000000000 --- a/external/capnp/include/capnp/rpc-twoparty.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_TWOPARTY_H_ -#define CAPNP_RPC_TWOPARTY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" -#include -#include - -namespace capnp { - -namespace rpc { - namespace twoparty { - typedef VatId SturdyRefHostId; // For backwards-compatibility with version 0.4. - } -} - -typedef VatNetwork - TwoPartyVatNetworkBase; - -class TwoPartyVatNetwork: public TwoPartyVatNetworkBase, - private TwoPartyVatNetworkBase::Connection { - // A `VatNetwork` that consists of exactly two parties communicating over an arbitrary byte - // stream. This is used to implement the common case of a client/server network. - // - // See `ez-rpc.h` for a simple interface for setting up two-party clients and servers. - // Use `TwoPartyVatNetwork` only if you need the advanced features. - -public: - TwoPartyVatNetwork(kj::AsyncIoStream& stream, rpc::twoparty::Side side, - ReaderOptions receiveOptions = ReaderOptions()); - KJ_DISALLOW_COPY(TwoPartyVatNetwork); - - kj::Promise onDisconnect() { return disconnectPromise.addBranch(); } - // Returns a promise that resolves when the peer disconnects. - - rpc::twoparty::Side getSide() { return side; } - - // implements VatNetwork ----------------------------------------------------- - - kj::Maybe> connect( - rpc::twoparty::VatId::Reader ref) override; - kj::Promise> accept() override; - -private: - class OutgoingMessageImpl; - class IncomingMessageImpl; - - kj::AsyncIoStream& stream; - rpc::twoparty::Side side; - MallocMessageBuilder peerVatId; - ReaderOptions receiveOptions; - bool accepted = false; - - kj::Maybe> previousWrite; - // Resolves when the previous write completes. This effectively serves as the write queue. - // Becomes null when shutdown() is called. - - kj::Own>> acceptFulfiller; - // Fulfiller for the promise returned by acceptConnectionAsRefHost() on the client side, or the - // second call on the server side. Never fulfilled, because there is only one connection. - - kj::ForkedPromise disconnectPromise = nullptr; - - class FulfillerDisposer: public kj::Disposer { - // Hack: TwoPartyVatNetwork is both a VatNetwork and a VatNetwork::Connection. When the RPC - // system detects (or initiates) a disconnection, it drops its reference to the Connection. - // When all references have been dropped, then we want disconnectPromise to be fulfilled. - // So we hand out Owns with this disposer attached, so that we can detect when - // they are dropped. - - public: - mutable kj::Own> fulfiller; - mutable uint refcount = 0; - - void disposeImpl(void* pointer) const override; - }; - FulfillerDisposer disconnectFulfiller; - - kj::Own asConnection(); - // Returns a pointer to this with the disposer set to disconnectFulfiller. - - // implements Connection ----------------------------------------------------- - - rpc::twoparty::VatId::Reader getPeerVatId() override; - kj::Own newOutgoingMessage(uint firstSegmentWordSize) override; - kj::Promise>> receiveIncomingMessage() override; - kj::Promise shutdown() override; -}; - -class TwoPartyServer: private kj::TaskSet::ErrorHandler { - // Convenience class which implements a simple server which accepts connections on a listener - // socket and serices them as two-party connections. - -public: - explicit TwoPartyServer(Capability::Client bootstrapInterface); - - void accept(kj::Own&& connection); - // Accepts the connection for servicing. - - kj::Promise listen(kj::ConnectionReceiver& listener); - // Listens for connections on the given listener. The returned promise never resolves unless an - // exception is thrown while trying to accept. You may discard the returned promise to cancel - // listening. - -private: - Capability::Client bootstrapInterface; - kj::TaskSet tasks; - - struct AcceptedConnection; - - void taskFailed(kj::Exception&& exception) override; -}; - -class TwoPartyClient { - // Convenience class which implements a simple client. - -public: - explicit TwoPartyClient(kj::AsyncIoStream& connection); - TwoPartyClient(kj::AsyncIoStream& connection, Capability::Client bootstrapInterface, - rpc::twoparty::Side side = rpc::twoparty::Side::CLIENT); - - Capability::Client bootstrap(); - // Get the server's bootstrap interface. - - inline kj::Promise onDisconnect() { return network.onDisconnect(); } - -private: - TwoPartyVatNetwork network; - RpcSystem rpcSystem; -}; - -} // namespace capnp - -#endif // CAPNP_RPC_TWOPARTY_H_ diff --git a/external/capnp/include/capnp/rpc.capnp b/external/capnp/include/capnp/rpc.capnp deleted file mode 100644 index cd808b39f7..0000000000 --- a/external/capnp/include/capnp/rpc.capnp +++ /dev/null @@ -1,1399 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb312981b2552a250; -# Recall that Cap'n Proto RPC allows messages to contain references to remote objects that -# implement interfaces. These references are called "capabilities", because they both designate -# the remote object to use and confer permission to use it. -# -# Recall also that Cap'n Proto RPC has the feature that when a method call itself returns a -# capability, the caller can begin calling methods on that capability _before the first call has -# returned_. The caller essentially sends a message saying "Hey server, as soon as you finish -# that previous call, do this with the result!". Cap'n Proto's RPC protocol makes this possible. -# -# The protocol is significantly more complicated than most RPC protocols. However, this is -# implementation complexity that underlies an easy-to-grasp higher-level model of object oriented -# programming. That is, just like TCP is a surprisingly complicated protocol that implements a -# conceptually-simple byte stream abstraction, Cap'n Proto is a surprisingly complicated protocol -# that implements a conceptually-simple object abstraction. -# -# Cap'n Proto RPC is based heavily on CapTP, the object-capability protocol used by the E -# programming language: -# http://www.erights.org/elib/distrib/captp/index.html -# -# Cap'n Proto RPC takes place between "vats". A vat hosts some set of objects and talks to other -# vats through direct bilateral connections. Typically, there is a 1:1 correspondence between vats -# and processes (in the unix sense of the word), although this is not strictly always true (one -# process could run multiple vats, or a distributed virtual vat might live across many processes). -# -# Cap'n Proto does not distinguish between "clients" and "servers" -- this is up to the application. -# Either end of any connection can potentially hold capabilities pointing to the other end, and -# can call methods on those capabilities. In the doc comments below, we use the words "sender" -# and "receiver". These refer to the sender and receiver of an instance of the struct or field -# being documented. Sometimes we refer to a "third-party" that is neither the sender nor the -# receiver. Documentation is generally written from the point of view of the sender. -# -# It is generally up to the vat network implementation to securely verify that connections are made -# to the intended vat as well as to encrypt transmitted data for privacy and integrity. See the -# `VatNetwork` example interface near the end of this file. -# -# When a new connection is formed, the only interesting things that can be done are to send a -# `Bootstrap` (level 0) or `Accept` (level 3) message. -# -# Unless otherwise specified, messages must be delivered to the receiving application in the same -# order in which they were initiated by the sending application. The goal is to support "E-Order", -# which states that two calls made on the same reference must be delivered in the order which they -# were made: -# http://erights.org/elib/concurrency/partial-order.html -# -# Since the full protocol is complicated, we define multiple levels of support that an -# implementation may target. For many applications, level 1 support will be sufficient. -# Comments in this file indicate which level requires the corresponding feature to be -# implemented. -# -# * **Level 0:** The implementation does not support object references. Only the bootstrap interface -# can be called. At this level, the implementation does not support object-oriented protocols and -# is similar in complexity to JSON-RPC or Protobuf services. This level should be considered only -# a temporary stepping-stone toward level 1 as the lack of object references drastically changes -# how protocols are designed. Applications _should not_ attempt to design their protocols around -# the limitations of level 0 implementations. -# -# * **Level 1:** The implementation supports simple bilateral interaction with object references -# and promise pipelining, but interactions between three or more parties are supported only via -# proxying of objects. E.g. if Alice (in Vat A) wants to send Bob (in Vat B) a capability -# pointing to Carol (in Vat C), Alice must create a proxy of Carol within Vat A and send Bob a -# reference to that; Bob cannot form a direct connection to Carol. Level 1 implementations do -# not support checking if two capabilities received from different vats actually point to the -# same object ("join"), although they should be able to do this check on capabilities received -# from the same vat. -# -# * **Level 2:** The implementation supports saving persistent capabilities -- i.e. capabilities -# that remain valid even after disconnect, and can be restored on a future connection. When a -# capability is saved, the requester receives a `SturdyRef`, which is a token that can be used -# to restore the capability later. -# -# * **Level 3:** The implementation supports three-way interactions. That is, if Alice (in Vat A) -# sends Bob (in Vat B) a capability pointing to Carol (in Vat C), then Vat B will automatically -# form a direct connection to Vat C rather than have requests be proxied through Vat A. -# -# * **Level 4:** The entire protocol is implemented, including joins (checking if two capabilities -# are equivalent). -# -# Note that an implementation must also support specific networks (transports), as described in -# the "Network-specific Parameters" section below. An implementation might have different levels -# depending on the network used. -# -# New implementations of Cap'n Proto should start out targeting the simplistic two-party network -# type as defined in `rpc-twoparty.capnp`. With this network type, level 3 is irrelevant and -# levels 2 and 4 are much easier than usual to implement. When such an implementation is paired -# with a container proxy, the contained app effectively gets to make full use of the proxy's -# network at level 4. And since Cap'n Proto IPC is extremely fast, it may never make sense to -# bother implementing any other vat network protocol -- just use the correct container type and get -# it for free. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc"); - -# ======================================================================================== -# The Four Tables -# -# Cap'n Proto RPC connections are stateful (although an application built on Cap'n Proto could -# export a stateless interface). As in CapTP, for each open connection, a vat maintains four state -# tables: questions, answers, imports, and exports. See the diagram at: -# http://www.erights.org/elib/distrib/captp/4tables.html -# -# The question table corresponds to the other end's answer table, and the imports table corresponds -# to the other end's exports table. -# -# The entries in each table are identified by ID numbers (defined below as 32-bit integers). These -# numbers are always specific to the connection; a newly-established connection starts with no -# valid IDs. Since low-numbered IDs will pack better, it is suggested that IDs be assigned like -# Unix file descriptors -- prefer the lowest-number ID that is currently available. -# -# IDs in the questions/answers tables are chosen by the questioner and generally represent method -# calls that are in progress. -# -# IDs in the imports/exports tables are chosen by the exporter and generally represent objects on -# which methods may be called. Exports may be "settled", meaning the exported object is an actual -# object living in the exporter's vat, or they may be "promises", meaning the exported object is -# the as-yet-unknown result of an ongoing operation and will eventually be resolved to some other -# object once that operation completes. Calls made to a promise will be forwarded to the eventual -# target once it is known. The eventual replacement object does *not* get the same ID as the -# promise, as it may turn out to be an object that is already exported (so already has an ID) or -# may even live in a completely different vat (and so won't get an ID on the same export table -# at all). -# -# IDs can be reused over time. To make this safe, we carefully define the lifetime of IDs. Since -# messages using the ID could be traveling in both directions simultaneously, we must define the -# end of life of each ID _in each direction_. The ID is only safe to reuse once it has been -# released by both sides. -# -# When a Cap'n Proto connection is lost, everything on the four tables is lost. All questions are -# canceled and throw exceptions. All imports become broken (all future calls to them throw -# exceptions). All exports and answers are implicitly released. The only things not lost are -# persistent capabilities (`SturdyRef`s). The application must plan for this and should respond by -# establishing a new connection and restoring from these persistent capabilities. - -using QuestionId = UInt32; -# **(level 0)** -# -# Identifies a question in the sender's question table (which corresponds to the receiver's answer -# table). The questioner (caller) chooses an ID when making a call. The ID remains valid in -# caller -> callee messages until a Finish message is sent, and remains valid in callee -> caller -# messages until a Return message is sent. - -using AnswerId = QuestionId; -# **(level 0)** -# -# Identifies an answer in the sender's answer table (which corresponds to the receiver's question -# table). -# -# AnswerId is physically equivalent to QuestionId, since the question and answer tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. - -using ExportId = UInt32; -# **(level 1)** -# -# Identifies an exported capability or promise in the sender's export table (which corresponds -# to the receiver's import table). The exporter chooses an ID before sending a capability over the -# wire. If the capability is already in the table, the exporter should reuse the same ID. If the -# ID is a promise (as opposed to a settled capability), this must be indicated at the time the ID -# is introduced (e.g. by using `senderPromise` instead of `senderHosted` in `CapDescriptor`); in -# this case, the importer shall expect a later `Resolve` message that replaces the promise. -# -# ExportId/ImportIds are subject to reference counting. Whenever an `ExportId` is sent over the -# wire (from the exporter to the importer), the export's reference count is incremented (unless -# otherwise specified). The reference count is later decremented by a `Release` message. Since -# the `Release` message can specify an arbitrary number by which to reduce the reference count, the -# importer should usually batch reference decrements and only send a `Release` when it believes the -# reference count has hit zero. Of course, it is possible that a new reference to the export is -# in-flight at the time that the `Release` message is sent, so it is necessary for the exporter to -# keep track of the reference count on its end as well to avoid race conditions. -# -# When a connection is lost, all exports are implicitly released. It is not possible to restore -# a connection state after disconnect (although a transport layer could implement a concept of -# persistent connections if it is transparent to the RPC layer). - -using ImportId = ExportId; -# **(level 1)** -# -# Identifies an imported capability or promise in the sender's import table (which corresponds to -# the receiver's export table). -# -# ImportId is physically equivalent to ExportId, since the export and import tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. -# -# An `ImportId` remains valid in importer -> exporter messages until the importer has sent -# `Release` messages that (it believes) have reduced the reference count to zero. - -# ======================================================================================== -# Messages - -struct Message { - # An RPC connection is a bi-directional stream of Messages. - - union { - unimplemented @0 :Message; - # The sender previously received this message from the peer but didn't understand it or doesn't - # yet implement the functionality that was requested. So, the sender is echoing the message - # back. In some cases, the receiver may be able to recover from this by pretending the sender - # had taken some appropriate "null" action. - # - # For example, say `resolve` is received by a level 0 implementation (because a previous call - # or return happened to contain a promise). The level 0 implementation will echo it back as - # `unimplemented`. The original sender can then simply release the cap to which the promise - # had resolved, thus avoiding a leak. - # - # For any message type that introduces a question, if the message comes back unimplemented, - # the original sender may simply treat it as if the question failed with an exception. - # - # In cases where there is no sensible way to react to an `unimplemented` message (without - # resource leaks or other serious problems), the connection may need to be aborted. This is - # a gray area; different implementations may take different approaches. - - abort @1 :Exception; - # Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. - # because the sender received an invalid or nonsensical message (`isCallersFault` is true) or - # because the sender had an internal error (`isCallersFault` is false). The sender will shut - # down the outgoing half of the connection after `abort` and will completely close the - # connection shortly thereafter (it's up to the sender how much of a time buffer they want to - # offer for the client to receive the `abort` before the connection is reset). - - # Level 0 features ----------------------------------------------- - - bootstrap @8 :Bootstrap; # Request the peer's bootstrap interface. - call @2 :Call; # Begin a method call. - return @3 :Return; # Complete a method call. - finish @4 :Finish; # Release a returned answer / cancel a call. - - # Level 1 features ----------------------------------------------- - - resolve @5 :Resolve; # Resolve a previously-sent promise. - release @6 :Release; # Release a capability so that the remote object can be deallocated. - disembargo @13 :Disembargo; # Lift an embargo used to enforce E-order over promise resolution. - - # Level 2 features ----------------------------------------------- - - obsoleteSave @7 :AnyPointer; - # Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced - # by the `Persistent` interface defined in `persistent.capnp`. This operation was never - # implemented. - - obsoleteDelete @9 :AnyPointer; - # Obsolete way to delete a SturdyRef. This operation was never implemented. - - # Level 3 features ----------------------------------------------- - - provide @10 :Provide; # Provide a capability to a third party. - accept @11 :Accept; # Accept a capability provided by a third party. - - # Level 4 features ----------------------------------------------- - - join @12 :Join; # Directly connect to the common root of two or more proxied caps. - } -} - -# Level 0 message types ---------------------------------------------- - -struct Bootstrap { - # **(level 0)** - # - # Get the "bootstrap" interface exported by the remote vat. - # - # For level 0, 1, and 2 implementations, the "bootstrap" interface is simply the main interface - # exported by a vat. If the vat acts as a server fielding connections from clients, then the - # bootstrap interface defines the basic functionality available to a client when it connects. - # The exact interface definition obviously depends on the application. - # - # We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would - # never be used. In such a world, any time you connect to a new vat, you do so because you - # received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message - # you send is `Accept`, and further communications derive from there. `Bootstrap` is not used. - # - # In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would - # actually return a new Cap'n Proto capability, thus introducing you to the target system via - # level 3 RPC. Applications would receive the capability to talk to DNS in the first place as - # an initial endowment or part of a Powerbox interaction. Therefore, an app can form arbitrary - # connections without ever using `Bootstrap`. - # - # Of course, in the real world, DNS is not Cap'n-Proto-based, and we don't want Cap'n Proto to - # require a whole new internet infrastructure to be useful. Therefore, we offer bootstrap - # interfaces as a way to get up and running without a level 3 introduction. Thus, bootstrap - # interfaces are used to "bootstrap" from other, non-Cap'n-Proto-based means of service discovery, - # such as legacy DNS. - # - # Note that a vat need not provide a bootstrap interface, and in fact many vats (especially those - # acting as clients) do not. In this case, the vat should either reply to `Bootstrap` with a - # `Return` indicating an exception, or should return a dummy capability with no methods. - - questionId @0 :QuestionId; - # A new question ID identifying this request, which will eventually receive a Return message - # containing the restored capability. - - deprecatedObjectId @1 :AnyPointer; - # ** DEPRECATED ** - # - # A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies - # which one to return. If this pointer is null, then the default bootstrap interface is returned. - # - # As of verison 0.5, use of this field is deprecated. If a service wants to export multiple - # bootstrap interfaces, it should instead define a single bootstarp interface that has methods - # that return each of the other interfaces. - # - # **History** - # - # In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. - # At the time, it was thought that this would eventually serve as the way to restore SturdyRefs - # (level 2). Meanwhile, an application could offer its "main" interface on a well-known - # (non-secret) SturdyRef. - # - # Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only - # used to obtain the main interface. Since most applications had only one main interface that - # they wanted to restore, they tended to designate this with a null `objectId`. - # - # Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting - # multiple main interfaces by allowing them to be exported under string names. In this case, - # `objectId` was a Text value specifying the name. - # - # All of this proved problematic for several reasons: - # - # - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what - # machine to connect to and would be able to immediately restore a SturdyRef on connection. - # However, in practice, the ability to restore SturdyRefs is itself a capability that may - # require going through an authentication process to obtain. Thus, it makes more sense to - # define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is - # offered as the vat's bootstrap interface, then this is equivalent to the old arrangement. - # - # - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the - # practice of exporting singleton services with string names. If singleton services are desired, - # it is better to have one main interface that has methods that can be used to obtain each - # service, in order to get all the usual benefits of schemas and type checking. - # - # - Overloading "Restore" also had a security problem: Often, "main" or "well-known" - # capabilities exported by a vat are in fact not public: they are intended to be accessed only - # by clients who are capable of forming a connection to the vat. This can lead to trouble if - # the client itself has other clients and wishes to foward some `Restore` requests from those - # external clients -- it has to be very careful not to allow through `Restore` requests - # addressing the default capability. - # - # For example, consider the case of a sandboxed Sandstorm application and its supervisor. The - # application exports a default capability to its supervisor that provides access to - # functionality that only the supervisor is supposed to access. Meanwhile, though, applications - # may publish other capabilities that may be persistent, in which case the application needs - # to field `Restore` requests that could come from anywhere. These requests of course have to - # pass through the supervisor, as all communications with the outside world must. But, the - # supervisor has to be careful not to honor an external request addressing the application's - # default capability, since this capability is privileged. Unfortunately, the default - # capability cannot be given an unguessable name, because then the supervisor itself would not - # be able to address it! - # - # As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for - # use in restoring SturdyRefs. - # - # Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a - # SturdyRef, but indicated that the client would not restore the ref again in the future. This - # operation was never implemented, so it was removed entirely. If a "delete" operation is desired, - # it should exist as a method on the same interface that handles restoring SturdyRefs. However, - # the utility of such an operation is questionable. You wouldn't be able to rely on it for - # garbage collection since a client could always disappear permanently without remembering to - # delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to - # design systems such that SturdyRefs never represent "owned" pointers. - # - # For example, say a SturdyRef points to an image file hosted on some server. That image file - # should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by - # a user who can delete the image at any time. If the user deletes the image, the SturdyRef - # stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the - # existence of the image in its collection. -} - -struct Call { - # **(level 0)** - # - # Message type initiating a method call on a capability. - - questionId @0 :QuestionId; - # A number, chosen by the caller, that identifies this call in future messages. This number - # must be different from all other calls originating from the same end of the connection (but - # may overlap with question IDs originating from the opposite end). A fine strategy is to use - # sequential question IDs, but the recipient should not assume this. - # - # A question ID can be reused once both: - # - A matching Return has been received from the callee. - # - A matching Finish has been sent from the caller. - - target @1 :MessageTarget; - # The object that should receive this call. - - interfaceId @2 :UInt64; - # The type ID of the interface being called. Each capability may implement multiple interfaces. - - methodId @3 :UInt16; - # The ordinal number of the method to call within the requested interface. - - allowThirdPartyTailCall @8 :Bool = false; - # Indicates whether or not the receiver is allowed to send a `Return` containing - # `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee - # will have to proxy the return in the case of a tail call to a third-party vat. - - params @4 :Payload; - # The call parameters. `params.content` is a struct whose fields correspond to the parameters of - # the method. - - sendResultsTo :union { - # Where should the return message be sent? - - caller @5 :Void; - # Send the return message back to the caller (the usual). - - yourself @6 :Void; - # **(level 1)** - # - # Don't actually return the results to the sender. Instead, hold on to them and await - # instructions from the sender regarding what to do with them. In particular, the sender - # may subsequently send a `Return` for some other call (which the receiver had previously made - # to the sender) with `takeFromOtherQuestion` set. The results from this call are then used - # as the results of the other call. - # - # When `yourself` is used, the receiver must still send a `Return` for the call, but sets the - # field `resultsSentElsewhere` in that `Return` rather than including the results. - # - # This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up - # returning the result of a call from Vat B back to Vat A. - # - # In particular, the most common use case for this feature is when Vat A makes a call to a - # promise in Vat B, and then that promise ends up resolving to a capability back in Vat A. - # Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself` - # in the calls so that the results need not pass back through Vat B. - # - # For example: - # - Alice, in Vat A, call foo() on Bob in Vat B. - # - Alice makes a pipelined call bar() on the promise returned by foo(). - # - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next - # to Alice). - # - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'(). - # Notice that bar() and bar'() are travelling in opposite directions on the same network - # link. - # - The `Call` for bar'() has `sendResultsTo` set to `yourself`, with the value being the - # question ID originally assigned to the bar() call. - # - Vat A receives bar'() and delivers it to Carol. - # - When bar'() returns, Vat A immediately takes the results and returns them from bar(). - # - Meanwhile, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere` set in - # place of results. - # - Vat A sends a `Finish` for that call to Vat B. - # - Vat B receives the `Return` for bar'() and sends a `Return` for bar(), with - # `receivedFromYourself` set in place of the results. - # - Vat B receives the `Finish` for bar() and sends a `Finish` to bar'(). - - thirdParty @7 :RecipientId; - # **(level 3)** - # - # The call's result should be returned to a different vat. The receiver (the callee) expects - # to receive an `Accept` message from the indicated vat, and should return the call's result - # to it, rather than to the sender of the `Call`. - # - # This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` - # messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from - # Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends - # an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C - # also sends a `Return` to Vat B with `resultsSentElsewhere`. - } -} - -struct Return { - # **(level 0)** - # - # Message type sent from callee to caller indicating that the call has completed. - - answerId @0 :AnswerId; - # Equal to the QuestionId of the corresponding `Call` message. - - releaseParamCaps @1 :Bool = true; - # If true, all capabilities that were in the params should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # to set it to false they'll quickly get errors. - - union { - results @2 :Payload; - # The result. - # - # For regular method calls, `results.content` points to the result struct. - # - # For a `Return` in response to an `Accept`, `results` contains a single capability (rather - # than a struct), and `results.content` is just a capability pointer with index 0. A `Finish` - # is still required in this case. - - exception @3 :Exception; - # Indicates that the call failed and explains why. - - canceled @4 :Void; - # Indicates that the call was canceled due to the caller sending a Finish message - # before the call had completed. - - resultsSentElsewhere @5 :Void; - # This is set when returning from a `Call` that had `sendResultsTo` set to something other - # than `caller`. - - takeFromOtherQuestion @6 :QuestionId; - # The sender has also sent (before this message) a `Call` with the given question ID and with - # `sendResultsTo.yourself` set, and the results of that other call should be used as the - # results here. - - acceptFromThirdParty @7 :ThirdPartyCapId; - # **(level 3)** - # - # The caller should contact a third-party vat to pick up the results. An `Accept` message - # sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`. - # It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set. - } -} - -struct Finish { - # **(level 0)** - # - # Message type sent from the caller to the callee to indicate: - # 1) The questionId will no longer be used in any messages sent by the callee (no further - # pipelined requests). - # 2) If the call has not returned yet, the caller no longer cares about the result. If nothing - # else cares about the result either (e.g. there are no other outstanding calls pipelined on - # the result of this one) then the callee may wish to immediately cancel the operation and - # send back a Return message with "canceled" set. However, implementations are not required - # to support premature cancellation -- instead, the implementation may wait until the call - # actually completes and send a normal `Return` message. - # - # TODO(someday): Should we separate (1) and implicitly releasing result capabilities? It would be - # possible and useful to notify the server that it doesn't need to keep around the response to - # service pipeline requests even though the caller still wants to receive it / hasn't yet - # finished processing it. It could also be useful to notify the server that it need not marshal - # the results because the caller doesn't want them anyway, even if the caller is still sending - # pipelined calls, although this seems less useful (just saving some bytes on the wire). - - questionId @0 :QuestionId; - # ID of the call whose result is to be released. - - releaseResultCaps @1 :Bool = true; - # If true, all capabilities that were in the results should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # set it false they'll quickly get errors. -} - -# Level 1 message types ---------------------------------------------- - -struct Resolve { - # **(level 1)** - # - # Message type sent to indicate that a previously-sent promise has now been resolved to some other - # object (possibly another promise) -- or broken, or canceled. - # - # Keep in mind that it's possible for a `Resolve` to be sent to a level 0 implementation that - # doesn't implement it. For example, a method call or return might contain a capability in the - # payload. Normally this is fine even if the receiver is level 0, because they will implicitly - # release all such capabilities on return / finish. But if the cap happens to be a promise, then - # a follow-up `Resolve` may be sent regardless of this release. The level 0 receiver will reply - # with an `unimplemented` message, and the sender (of the `Resolve`) can respond to this as if the - # receiver had immediately released any capability to which the promise resolved. - # - # When implementing promise resolution, it's important to understand how embargos work and the - # tricky case of the Tribble 4-way race condition. See the comments for the Disembargo message, - # below. - - promiseId @0 :ExportId; - # The ID of the promise to be resolved. - # - # Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does - # _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver - # will release the export soon after receiving `Resolve`, and the sender will not send this - # `ExportId` again until it has been released and recycled. - # - # When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise, - # this indicates that the sender will follow up at some point with a `Resolve` message. If the - # same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the - # same ID is sent again later _after_ a `Resolve`, it can only be because the export's - # reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore - # this later promise does _not_ correspond to the earlier `Resolve`. - # - # If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve` - # message may or may not still be sent (the `Resolve` may have already been in-flight when - # `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer - # any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which - # the receiver has no knowledge, because it already released it earlier. In this case, the - # receiver should simply release the capability to which the promise resolved. - - union { - cap @1 :CapDescriptor; - # The object to which the promise resolved. - # - # The sender promises that from this point forth, until `promiseId` is released, it shall - # simply forward all messages to the capability designated by `cap`. This is true even if - # `cap` itself happens to desigate another promise, and that other promise later resolves -- - # messages sent to `promiseId` shall still go to that other promise, not to its resolution. - # This is important in the case that the receiver of the `Resolve` ends up sending a - # `Disembargo` message towards `promiseId` in order to control message ordering -- that - # `Disembargo` really needs to reflect back to exactly the object designated by `cap` even - # if that object is itself a promise. - - exception @2 :Exception; - # Indicates that the promise was broken. - } -} - -struct Release { - # **(level 1)** - # - # Message type sent to indicate that the sender is done with the given capability and the receiver - # can free resources allocated to it. - - id @0 :ImportId; - # What to release. - - referenceCount @1 :UInt32; - # The amount by which to decrement the reference count. The export is only actually released - # when the reference count reaches zero. -} - -struct Disembargo { - # **(level 1)** - # - # Message sent to indicate that an embargo on a recently-resolved promise may now be lifted. - # - # Embargos are used to enforce E-order in the presence of promise resolution. That is, if an - # application makes two calls foo() and bar() on the same capability reference, in that order, - # the calls should be delivered in the order in which they were made. But if foo() is called - # on a promise, and that promise happens to resolve before bar() is called, then the two calls - # may travel different paths over the network, and thus could arrive in the wrong order. In - # this case, the call to `bar()` must be embargoed, and a `Disembargo` message must be sent along - # the same path as `foo()` to ensure that the `Disembargo` arrives after `foo()`. Once the - # `Disembargo` arrives, `bar()` can then be delivered. - # - # There are two particular cases where embargos are important. Consider object Alice, in Vat A, - # who holds a promise P, pointing towards Vat B, that eventually resolves to Carol. The two - # cases are: - # - Carol lives in Vat A, i.e. next to Alice. In this case, Vat A needs to send a `Disembargo` - # message that echos through Vat B and back, to ensure that all pipelined calls on the promise - # have been delivered. - # - Carol lives in a different Vat C. When the promise resolves, a three-party handoff occurs - # (see `Provide` and `Accept`, which constitute level 3 of the protocol). In this case, we - # piggyback on the state that has already been set up to handle the handoff: the `Accept` - # message (from Vat A to Vat C) is embargoed, as are all pipelined messages sent to it, while - # a `Disembargo` message is sent from Vat A through Vat B to Vat C. See `Accept.embargo` for - # an example. - # - # Note that in the case where Carol actually lives in Vat B (i.e., the same vat that the promise - # already pointed at), no embargo is needed, because the pipelined calls are delivered over the - # same path as the later direct calls. - # - # Keep in mind that promise resolution happens both in the form of Resolve messages as well as - # Return messages (which resolve PromisedAnswers). Embargos apply in both cases. - # - # An alternative strategy for enforcing E-order over promise resolution could be for Vat A to - # implement the embargo internally. When Vat A is notified of promise resolution, it could - # send a dummy no-op call to promise P and wait for it to complete. Until that call completes, - # all calls to the capability are queued locally. This strategy works, but is pessimistic: - # in the three-party case, it requires an A -> B -> C -> B -> A round trip before calls can start - # being delivered directly to from Vat A to Vat C. The `Disembargo` message allows latency to be - # reduced. (In the two-party loopback case, the `Disembargo` message is just a more explicit way - # of accomplishing the same thing as a no-op call, but isn't any faster.) - # - # *The Tribble 4-way Race Condition* - # - # Any implementation of promise resolution and embargos must be aware of what we call the - # "Tribble 4-way race condition", after Dean Tribble, who explained the problem in a lively - # Friam meeting. - # - # Embargos are designed to work in the case where a two-hop path is being shortened to one hop. - # But sometimes there are more hops. Imagine that Alice has a reference to a remote promise P1 - # that eventually resolves to _another_ remote promise P2 (in a third vat), which _at the same - # time_ happens to resolve to Bob (in a fourth vat). In this case, we're shortening from a 3-hop - # path (with four parties) to a 1-hop path (Alice -> Bob). - # - # Extending the embargo/disembargo protocol to be able to shorted multiple hops at once seems - # difficult. Instead, we make a rule that prevents this case from coming up: - # - # One a promise P has been resolved to a remove object reference R, then all further messages - # received addressed to P will be forwarded strictly to R. Even if it turns out later that R is - # itself a promise, and has resolved to some other object Q, messages sent to P will still be - # forwarded to R, not directly to Q (R will of course further forward the messages to Q). - # - # This rule does not cause a significant performance burden because once P has resolved to R, it - # is expected that people sending messages to P will shortly start sending them to R instead and - # drop P. P is at end-of-life anyway, so it doesn't matter if it ignores chances to further - # optimize its path. - - target @0 :MessageTarget; - # What is to be disembargoed. - - using EmbargoId = UInt32; - # Used in `senderLoopback` and `receiverLoopback`, below. - - context :union { - senderLoopback @1 :EmbargoId; - # The sender is requesting a disembargo on a promise that is known to resolve back to a - # capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls - # on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback` - # set to the same value as `senderLoopback`. This value is chosen by the sender, and since - # it is also consumed be the sender, the sender can use whatever strategy it wants to make sure - # the value is unambiguous. - # - # The receiver must verify that the target capability actually resolves back to the sender's - # vat. Otherwise, the sender has committed a protocol error and should be disconnected. - - receiverLoopback @2 :EmbargoId; - # The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to - # this capability, and that Disembargo is now being echoed back. - - accept @3 :Void; - # **(level 3)** - # - # The sender is requesting a disembargo on a promise that is known to resolve to a third-party - # capability that the sender is currently in the process of accepting (using `Accept`). - # The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The - # receiver should now send a `Disembargo` with `provide` set to the question ID of that - # `Provide` message. - # - # See `Accept.embargo` for an example. - - provide @4 :QuestionId; - # **(level 3)** - # - # The sender is requesting a disembargo on a capability currently being provided to a third - # party. The question ID identifies the `Provide` message previously sent by the sender to - # this capability. On receipt, the receiver (the capability host) shall release the embargo - # on the `Accept` message that it has received from the third party. See `Accept.embargo` for - # an example. - } -} - -# Level 2 message types ---------------------------------------------- - -# See persistent.capnp. - -# Level 3 message types ---------------------------------------------- - -struct Provide { - # **(level 3)** - # - # Message type sent to indicate that the sender wishes to make a particular capability implemented - # by the receiver available to a third party for direct access (without the need for the third - # party to proxy through the sender). - # - # (In CapTP, `Provide` and `Accept` are methods of the global `NonceLocator` object exported by - # every vat. In Cap'n Proto, we bake this into the core protocol.) - - questionId @0 :QuestionId; - # Question ID to be held open until the recipient has received the capability. A result will be - # returned once the third party has successfully received the capability. The sender must at some - # point send a `Finish` message as with any other call, and that message can be used to cancel the - # whole operation. - - target @1 :MessageTarget; - # What is to be provided to the third party. - - recipient @2 :RecipientId; - # Identity of the third party that is expected to pick up the capability. -} - -struct Accept { - # **(level 3)** - # - # Message type sent to pick up a capability hosted by the receiving vat and provided by a third - # party. The third party previously designated the capability using `Provide`. - # - # This message is also used to pick up a redirected return -- see `Return.redirect`. - - questionId @0 :QuestionId; - # A new question ID identifying this accept message, which will eventually receive a Return - # message containing the provided capability (or the call result in the case of a redirected - # return). - - provision @1 :ProvisionId; - # Identifies the provided object to be picked up. - - embargo @2 :Bool; - # If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent, - # and any pipelined calls will not be delivered, until the embargo is released. The receiver - # (the capability host) will expect the provider (the vat that sent the `Provide` message) to - # eventually send a `Disembargo` message with the field `context.provide` set to the question ID - # of the original `Provide` message. At that point, the embargo is released and the queued - # messages are delivered. - # - # For example: - # - Alice, in Vat A, holds a promise P, which currently points toward Vat B. - # - Alice calls foo() on P. The `Call` message is sent to Vat B. - # - The promise P in Vat B ends up resolving to Carol, in Vat C. - # - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient. - # - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a - # `ThirdPartyCapId` identifying Carol in Vat C. - # - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that - # it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept` - # message. - # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set. - # - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't - # know anything about the mechanics of promise resolution happening under the hood, but she - # expects that bar() will be delivered after foo() because that is the order in which she - # initiated the calls. - # - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which - # hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability - # are embargoed, Vat C does not deliver the call yet. - # - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C. - # - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the - # question ID of the `Provide` message it had sent previously. - # - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo() - # before delivering bar(). - # - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from - # Vat A, as well as deliver bar(). -} - -# Level 4 message types ---------------------------------------------- - -struct Join { - # **(level 4)** - # - # Message type sent to implement E.join(), which, given a number of capabilities that are - # expected to be equivalent, finds the underlying object upon which they all agree and forms a - # direct connection to it, skipping any proxies that may have been constructed by other vats - # while transmitting the capability. See: - # http://erights.org/elib/equality/index.html - # - # Note that this should only serve to bypass fully-transparent proxies -- proxies that were - # created merely for convenience, without any intention of hiding the underlying object. - # - # For example, say Bob holds two capabilities hosted by Alice and Carol, but he expects that both - # are simply proxies for a capability hosted elsewhere. He then issues a join request, which - # operates as follows: - # - Bob issues Join requests on both Alice and Carol. Each request contains a different piece - # of the JoinKey. - # - Alice is proxying a capability hosted by Dana, so forwards the request to Dana's cap. - # - Dana receives the first request and sees that the JoinKeyPart is one of two. She notes that - # she doesn't have the other part yet, so she records the request and responds with a - # JoinResult. - # - Alice relays the JoinAswer back to Bob. - # - Carol is also proxying a capability from Dana, and so forwards her Join request to Dana as - # well. - # - Dana receives Carol's request and notes that she now has both parts of a JoinKey. She - # combines them in order to form information needed to form a secure connection to Bob. She - # also responds with another JoinResult. - # - Bob receives the responses from Alice and Carol. He uses the returned JoinResults to - # determine how to connect to Dana and attempts to form the connection. Since Bob and Dana now - # agree on a secret key that neither Alice nor Carol ever saw, this connection can be made - # securely even if Alice or Carol is conspiring against the other. (If Alice and Carol are - # conspiring _together_, they can obviously reproduce the key, but this doesn't matter because - # the whole point of the join is to verify that Alice and Carol agree on what capability they - # are proxying.) - # - # If the two capabilities aren't actually proxies of the same object, then the join requests - # will come back with conflicting `hostId`s and the join will fail before attempting to form any - # connection. - - questionId @0 :QuestionId; - # Question ID used to respond to this Join. (Note that this ID only identifies one part of the - # request for one hop; each part has a different ID and relayed copies of the request have - # (probably) different IDs still.) - # - # The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult` - # is relayed from the joined object's host, possibly with transformation applied as needed - # by the network. - # - # Like any return, the result must be released using a `Finish`. However, this release - # should not occur until the joiner has either successfully connected to the joined object. - # Vats relaying a `Join` message similarly must not release the result they receive until the - # return they relayed back towards the joiner has itself been released. This allows the - # joined object's host to detect when the Join operation is canceled before completing -- if - # it receives a `Finish` for one of the join results before the joiner successfully - # connects. It can then free any resources it had allocated as part of the join. - - target @1 :MessageTarget; - # The capability to join. - - keyPart @2 :JoinKeyPart; - # A part of the join key. These combine to form the complete join key, which is used to establish - # a direct connection. - - # TODO(before implementing): Change this so that multiple parts can be sent in a single Join - # message, so that if multiple join parts are going to cross the same connection they can be sent - # together, so that the receive can potentially optimize its handling of them. In the case where - # all parts are bundled together, should the recipient be expected to simply return a cap, so - # that the caller can immediately start pipelining to it? -} - -# ======================================================================================== -# Common structures used in messages - -struct MessageTarget { - # The target of a `Call` or other messages that target a capability. - - union { - importedCap @0 :ImportId; - # This message is to a capability or promise previously imported by the caller (exported by - # the receiver). - - promisedAnswer @1 :PromisedAnswer; - # This message is to a capability that is expected to be returned by another call that has not - # yet been completed. - # - # At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so - # that initial startup doesn't require a round trip. - } -} - -struct Payload { - # Represents some data structure that might contain capabilities. - - content @0 :AnyPointer; - # Some Cap'n Proto data structure. Capability pointers embedded in this structure index into - # `capTable`. - - capTable @1 :List(CapDescriptor); - # Descriptors corresponding to the cap pointers in `content`. -} - -struct CapDescriptor { - # **(level 1)** - # - # When an application-defined type contains an interface pointer, that pointer contains an index - # into the message's capability table -- i.e. the `capTable` part of the `Payload`. Each - # capability in the table is represented as a `CapDescriptor`. The runtime API should not reveal - # the CapDescriptor directly to the application, but should instead wrap it in some kind of - # callable object with methods corresponding to the interface that the capability implements. - # - # Keep in mind that `ExportIds` in a `CapDescriptor` are subject to reference counting. See the - # description of `ExportId`. - - union { - none @0 :Void; - # There is no capability here. This `CapDescriptor` should not appear in the payload content. - # A `none` CapDescriptor can be generated when an application inserts a capability into a - # message and then later changes its mind and removes it -- rewriting all of the other - # capability pointers may be hard, so instead a tombstone is left, similar to the way a removed - # struct or list instance is zeroed out of the message but the space is not reclaimed. - # Hopefully this is unusual. - - senderHosted @1 :ExportId; - # A capability newly exported by the sender. This is the ID of the new capability in the - # sender's export table (receiver's import table). - - senderPromise @2 :ExportId; - # A promise that the sender will resolve later. The sender will send exactly one Resolve - # message at a future point in time to replace this promise. Note that even if the same - # `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of - # them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this - # `CapDescriptor`) may choose not to send the `Resolve` at all. - - receiverHosted @3 :ImportId; - # A capability (or promise) previously exported by the receiver (imported by the sender). - - receiverAnswer @4 :PromisedAnswer; - # A capability expected to be returned in the results of a currently-outstanding call posed - # by the sender. - - thirdPartyHosted @5 :ThirdPartyCapDescriptor; - # **(level 3)** - # - # A capability that lives in neither the sender's nor the receiver's vat. The sender needs - # to form a direct connection to a third party to pick up the capability. - # - # Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its - # `vine` instead. - } -} - -struct PromisedAnswer { - # **(mostly level 1)** - # - # Specifies how to derive a promise from an unanswered question, by specifying the path of fields - # to follow from the root of the eventual result struct to get to the desired capability. Used - # to address method calls to a not-yet-returned capability or to pass such a capability as an - # input to some other method call. - # - # Level 0 implementations must support `PromisedAnswer` only for the case where the answer is - # to a `Bootstrap` message. In this case, `path` is always empty since `Bootstrap` always returns - # a raw capability. - - questionId @0 :QuestionId; - # ID of the question (in the sender's question table / receiver's answer table) whose answer is - # expected to contain the capability. - - transform @1 :List(Op); - # Operations / transformations to apply to the result in order to get the capability actually - # being addressed. E.g. if the result is a struct and you want to call a method on a capability - # pointed to by a field of the struct, you need a `getPointerField` op. - - struct Op { - union { - noop @0 :Void; - # Does nothing. This member is mostly defined so that we can make `Op` a union even - # though (as of this writing) only one real operation is defined. - - getPointerField @1 :UInt16; - # Get a pointer field within a struct. The number is an index into the pointer section, NOT - # a field ordinal, so that the receiver does not need to understand the schema. - - # TODO(someday): We could add: - # - For lists, the ability to address every member of the list, or a slice of the list, the - # result of which would be another list. This is useful for implementing the equivalent of - # a SQL table join (not to be confused with the `Join` message type). - # - Maybe some ability to test a union. - # - Probably not a good idea: the ability to specify an arbitrary script to run on the - # result. We could define a little stack-based language where `Op` specifies one - # "instruction" or transformation to apply. Although this is not a good idea - # (over-engineered), any narrower additions to `Op` should be designed as if this - # were the eventual goal. - } - } -} - -struct ThirdPartyCapDescriptor { - # **(level 3)** - # - # Identifies a capability in a third-party vat that the sender wants the receiver to pick up. - - id @0 :ThirdPartyCapId; - # Identifies the third-party host and the specific capability to accept from it. - - vineId @1 :ExportId; - # A proxy for the third-party object exported by the sender. In CapTP terminology this is called - # a "vine", because it is an indirect reference to the third-party object that snakes through the - # sender vat. This serves two purposes: - # - # * Level 1 and 2 implementations that don't understand how to connect to a third party may - # simply send calls to the vine. Such calls will be forwarded to the third-party by the - # sender. - # - # * Level 3 implementations must release the vine once they have successfully picked up the - # object from the third party. This ensures that the capability is not released by the sender - # prematurely. - # - # The sender will close the `Provide` request that it has sent to the third party as soon as - # it receives either a `Call` or a `Release` message directed at the vine. -} - -struct Exception { - # **(level 0)** - # - # Describes an arbitrary error that prevented an operation (e.g. a call) from completing. - # - # Cap'n Proto exceptions always indicate that something went wrong. In other words, in a fantasy - # world where everything always works as expected, no exceptions would ever be thrown. Clients - # should only ever catch exceptions as a means to implement fault-tolerance, where "fault" can - # mean: - # - Bugs. - # - Invalid input. - # - Configuration errors. - # - Network problems. - # - Insufficient resources. - # - Version skew (unimplemented functionality). - # - Other logistical problems. - # - # Exceptions should NOT be used to flag application-specific conditions that a client is expected - # to handle in an application-specific way. Put another way, in the Cap'n Proto world, - # "checked exceptions" (where an interface explicitly defines the exceptions it throws and - # clients are forced by the type system to handle those exceptions) do NOT make sense. - - reason @0 :Text; - # Human-readable failure description. - - type @3 :Type; - # The type of the error. The purpose of this enum is not to describe the error itself, but - # rather to describe how the client might want to respond to the error. - - enum Type { - failed @0; - # A generic problem occurred, and it is believed that if the operation were repeated without - # any change in the state of the world, the problem would occur again. - # - # A client might respond to this error by logging it for investigation by the developer and/or - # displaying it to the user. - - overloaded @1; - # The request was rejected due to a temporary lack of resources. - # - # Examples include: - # - There's not enough CPU time to keep up with incoming requests, so some are rejected. - # - The server ran out of RAM or disk space during the request. - # - The operation timed out (took significantly longer than it should have). - # - # A client might respond to this error by scheduling to retry the operation much later. The - # client should NOT retry again immediately since this would likely exacerbate the problem. - - disconnected @2; - # The method failed because a connection to some necessary capability was lost. - # - # Examples include: - # - The client introduced the server to a third-party capability, the connection to that third - # party was subsequently lost, and then the client requested that the server use the dead - # capability for something. - # - The client previously requested that the server obtain a capability from some third party. - # The server returned a capability to an object wrapping the third-party capability. Later, - # the server's connection to the third party was lost. - # - The capability has been revoked. Revocation does not necessarily mean that the client is - # no longer authorized to use the capability; it is often used simply as a way to force the - # client to repeat the setup process, perhaps to efficiently move them to a new back-end or - # get them to recognize some other change that has occurred. - # - # A client should normally respond to this error by releasing all capabilities it is currently - # holding related to the one it called and then re-creating them by restoring SturdyRefs and/or - # repeating the method calls used to create them originally. In other words, disconnect and - # start over. This should in turn cause the server to obtain a new copy of the capability that - # it lost, thus making everything work. - # - # If the client receives another `disconnencted` error in the process of rebuilding the - # capability and retrying the call, it should treat this as an `overloaded` error: the network - # is currently unreliable, possibly due to load or other temporary issues. - - unimplemented @3; - # The server doesn't implement the requested method. If there is some other method that the - # client could call (perhaps an older and/or slower interface), it should try that instead. - # Otherwise, this should be treated like `failed`. - } - - obsoleteIsCallersFault @1 :Bool; - # OBSOLETE. Ignore. - - obsoleteDurability @2 :UInt16; - # OBSOLETE. See `type` instead. -} - -# ======================================================================================== -# Network-specific Parameters -# -# Some parts of the Cap'n Proto RPC protocol are not specified here because different vat networks -# may wish to use different approaches to solving them. For example, on the public internet, you -# may want to authenticate vats using public-key cryptography, but on a local intranet with trusted -# infrastructure, you may be happy to authenticate based on network address only, or some other -# lightweight mechanism. -# -# To accommodate this, we specify several "parameter" types. Each type is defined here as an -# alias for `AnyPointer`, but a specific network will want to define a specific set of types to use. -# All vats in a vat network must agree on these parameters in order to be able to communicate. -# Inter-network communication can be accomplished through "gateways" that perform translation -# between the primitives used on each network; these gateways may need to be deeply stateful, -# depending on the translations they perform. -# -# For interaction over the global internet between parties with no other prior arrangement, a -# particular set of bindings for these types is defined elsewhere. (TODO(someday): Specify where -# these common definitions live.) -# -# Another common network type is the two-party network, in which one of the parties typically -# interacts with the outside world entirely through the other party. In such a connection between -# Alice and Bob, all objects that exist on Bob's other networks appear to Alice as if they were -# hosted by Bob himself, and similarly all objects on Alice's network (if she even has one) appear -# to Bob as if they were hosted by Alice. This network type is interesting because from the point -# of view of a simple application that communicates with only one other party via the two-party -# protocol, there are no three-party interactions at all, and joins are unusually simple to -# implement, so implementing at level 4 is barely more complicated than implementing at level 1. -# Moreover, if you pair an app implementing the two-party network with a container that implements -# some other network, the app can then participate on the container's network just as if it -# implemented that network directly. The types used by the two-party network are defined in -# `rpc-twoparty.capnp`. -# -# The things that we need to parameterize are: -# - How to store capabilities long-term without holding a connection open (mostly level 2). -# - How to authenticate vats in three-party introductions (level 3). -# - How to implement `Join` (level 4). -# -# Persistent references -# --------------------- -# -# **(mostly level 2)** -# -# We want to allow some capabilities to be stored long-term, even if a connection is lost and later -# recreated. ExportId is a short-term identifier that is specific to a connection, so it doesn't -# help here. We need a way to specify long-term identifiers, as well as a strategy for -# reconnecting to a referenced capability later. -# -# Three-party interactions -# ------------------------ -# -# **(level 3)** -# -# In cases where more than two vats are interacting, we have situations where VatA holds a -# capability hosted by VatB and wants to send that capability to VatC. This can be accomplished -# by VatA proxying requests on the new capability, but doing so has two big problems: -# - It's inefficient, requiring an extra network hop. -# - If VatC receives another capability to the same object from VatD, it is difficult for VatC to -# detect that the two capabilities are really the same and to implement the E "join" operation, -# which is necessary for certain four-or-more-party interactions, such as the escrow pattern. -# See: http://www.erights.org/elib/equality/grant-matcher/index.html -# -# Instead, we want a way for VatC to form a direct, authenticated connection to VatB. -# -# Join -# ---- -# -# **(level 4)** -# -# The `Join` message type and corresponding operation arranges for a direct connection to be formed -# between the joiner and the host of the joined object, and this connection must be authenticated. -# Thus, the details are network-dependent. - -using SturdyRef = AnyPointer; -# **(level 2)** -# -# Identifies a persisted capability that can be restored in the future. How exactly a SturdyRef -# is restored to a live object is specified along with the SturdyRef definition (i.e. not by -# rpc.capnp). -# -# Generally a SturdyRef needs to specify three things: -# - How to reach the vat that can restore the ref (e.g. a hostname or IP address). -# - How to authenticate the vat after connecting (e.g. a public key fingerprint). -# - The identity of a specific object hosted by the vat. Generally, this is an opaque pointer whose -# format is defined by the specific vat -- the client has no need to inspect the object ID. -# It is important that the objec ID be unguessable if the object is not public (and objects -# should almost never be public). -# -# The above are only suggestions. Some networks might work differently. For example, a private -# network might employ a special restorer service whose sole purpose is to restore SturdyRefs. -# In this case, the entire contents of SturdyRef might be opaque, because they are intended only -# to be forwarded to the restorer service. - -using ProvisionId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in an `Accept` message to identify the object being accepted. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the provider vat along with the question ID used in the `Provide` message sent from -# that provider. - -using RecipientId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in a `Provide` message to identify the recipient of the -# capability. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the recipient. (CapTP also calls for a nonce to identify the object. In our -# case, the `Provide` message's `questionId` can serve as the nonce.) - -using ThirdPartyCapId = AnyPointer; -# **(level 3)** -# -# The information needed to connect to a third party and accept a capability from it. -# -# In a network where each vat has a public/private key pair, this could be a combination of the -# third party's public key fingerprint, hints on how to connect to the third party (e.g. an IP -# address), and the question ID used in the corresponding `Provide` message sent to that third party -# (used to identify which capability to pick up). - -using JoinKeyPart = AnyPointer; -# **(level 4)** -# -# A piece of a secret key. One piece is sent along each path that is expected to lead to the same -# place. Once the pieces are combined, a direct connection may be formed between the sender and -# the receiver, bypassing any men-in-the-middle along the paths. See the `Join` message type. -# -# The motivation for Joins is discussed under "Supporting Equality" in the "Unibus" protocol -# sketch: http://www.erights.org/elib/distrib/captp/unibus.html -# -# In a network where each vat has a public/private key pair and each vat forms no more than one -# connection to each other vat, Joins will rarely -- perhaps never -- be needed, as objects never -# need to be transparently proxied and references to the same object sent over the same connection -# have the same export ID. Thus, a successful join requires only checking that the two objects -# come from the same connection and have the same ID, and then completes immediately. -# -# However, in networks where two vats may form more than one connection between each other, or -# where proxying of objects occurs, joins are necessary. -# -# Typically, each JoinKeyPart would include a fixed-length data value such that all value parts -# XOR'd together forms a shared secret that can be used to form an encrypted connection between -# the joiner and the joined object's host. Each JoinKeyPart should also include an indication of -# how many parts to expect and a hash of the shared secret (used to match up parts). - -using JoinResult = AnyPointer; -# **(level 4)** -# -# Information returned as the result to a `Join` message, needed by the joiner in order to form a -# direct connection to a joined object. This might simply be the address of the joined object's -# host vat, since the `JoinKey` has already been communicated so the two vats already have a shared -# secret to use to authenticate each other. -# -# The `JoinResult` should also contain information that can be used to detect when the Join -# requests ended up reaching different objects, so that this situation can be detected easily. -# This could be a simple matter of including a sequence number -- if the joiner receives two -# `JoinResult`s with sequence number 0, then they must have come from different objects and the -# whole join is a failure. - -# ======================================================================================== -# Network interface sketch -# -# The interfaces below are meant to be pseudo-code to illustrate how the details of a particular -# vat network might be abstracted away. They are written like Cap'n Proto interfaces, but in -# practice you'd probably define these interfaces manually in the target programming language. A -# Cap'n Proto RPC implementation should be able to use these interfaces without knowing the -# definitions of the various network-specific parameters defined above. - -# interface VatNetwork { -# # Represents a vat network, with the ability to connect to particular vats and receive -# # connections from vats. -# # -# # Note that methods returning a `Connection` may return a pre-existing `Connection`, and the -# # caller is expected to find and share state with existing users of the connection. -# -# # Level 0 features ----------------------------------------------- -# -# connect(vatId :VatId) :Connection; -# # Connect to the given vat. The transport should return a promise that does not -# # resolve until authentication has completed, but allows messages to be pipelined in before -# # that; the transport either queues these messages until authenticated, or sends them encrypted -# # such that only the authentic vat would be able to decrypt them. The latter approach avoids a -# # round trip for authentication. -# -# accept() :Connection; -# # Wait for the next incoming connection and return it. Only connections formed by -# # connect() are returned by this method. -# -# # Level 4 features ----------------------------------------------- -# -# newJoiner(count :UInt32) :NewJoinerResponse; -# # Prepare a new Join operation, which will eventually lead to forming a new direct connection -# # to the host of the joined capability. `count` is the number of capabilities to join. -# -# struct NewJoinerResponse { -# joinKeyParts :List(JoinKeyPart); -# # Key parts to send in Join messages to each capability. -# -# joiner :Joiner; -# # Used to establish the final connection. -# } -# -# interface Joiner { -# addJoinResult(result :JoinResult) :Void; -# # Add a JoinResult received in response to one of the `Join` messages. All `JoinResult`s -# # returned from all paths must be added before trying to connect. -# -# connect() :ConnectionAndProvisionId; -# # Try to form a connection to the joined capability's host, verifying that it has received -# # all of the JoinKeyParts. Once the connection is formed, the caller should send an `Accept` -# # message on it with the specified `ProvisionId` in order to receive the final capability. -# } -# -# acceptConnectionFromJoiner(parts :List(JoinKeyPart), paths :List(VatPath)) -# :ConnectionAndProvisionId; -# # Called on a joined capability's host to receive the connection from the joiner, once all -# # key parts have arrived. The caller should expect to receive an `Accept` message over the -# # connection with the given ProvisionId. -# } -# -# interface Connection { -# # Level 0 features ----------------------------------------------- -# -# send(message :Message) :Void; -# # Send the message. Returns successfully when the message (and all preceding messages) has -# # been acknowledged by the recipient. -# -# receive() :Message; -# # Receive the next message, and acknowledges receipt to the sender. Messages are received in -# # the order in which they are sent. -# -# # Level 3 features ----------------------------------------------- -# -# introduceTo(recipient :Connection) :IntroductionInfo; -# # Call before starting a three-way introduction, assuming a `Provide` message is to be sent on -# # this connection and a `ThirdPartyCapId` is to be sent to `recipient`. -# -# struct IntroductionInfo { -# sendToRecipient :ThirdPartyCapId; -# sendToTarget :RecipientId; -# } -# -# connectToIntroduced(capId :ThirdPartyCapId) :ConnectionAndProvisionId; -# # Given a ThirdPartyCapId received over this connection, connect to the third party. The -# # caller should then send an `Accept` message over the new connection. -# -# acceptIntroducedConnection(recipientId :RecipientId) :Connection; -# # Given a RecipientId received in a `Provide` message on this `Connection`, wait for the -# # recipient to connect, and return the connection formed. Usually, the first message received -# # on the new connection will be an `Accept` message. -# } -# -# struct ConnectionAndProvisionId { -# # **(level 3)** -# -# connection :Connection; -# # Connection on which to issue `Accept` message. -# -# provision :ProvisionId; -# # `ProvisionId` to send in the `Accept` message. -# } diff --git a/external/capnp/include/capnp/rpc.capnp.h b/external/capnp/include/capnp/rpc.capnp.h deleted file mode 100644 index 0a440397fc..0000000000 --- a/external/capnp/include/capnp/rpc.capnp.h +++ /dev/null @@ -1,4898 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc.capnp - -#ifndef CAPNP_INCLUDED_b312981b2552a250_ -#define CAPNP_INCLUDED_b312981b2552a250_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(91b79f1f808db032); -CAPNP_DECLARE_SCHEMA(e94ccf8031176ec4); -CAPNP_DECLARE_SCHEMA(836a53ce789d4cd4); -CAPNP_DECLARE_SCHEMA(dae8b0f61aab5f99); -CAPNP_DECLARE_SCHEMA(9e19b28d3db3573a); -CAPNP_DECLARE_SCHEMA(d37d2eb2c2f80e63); -CAPNP_DECLARE_SCHEMA(bbc29655fa89086e); -CAPNP_DECLARE_SCHEMA(ad1a6c0d7dd07497); -CAPNP_DECLARE_SCHEMA(f964368b0fbd3711); -CAPNP_DECLARE_SCHEMA(d562b4df655bdd4d); -CAPNP_DECLARE_SCHEMA(9c6a046bfbc1ac5a); -CAPNP_DECLARE_SCHEMA(d4c9b56290554016); -CAPNP_DECLARE_SCHEMA(fbe1980490e001af); -CAPNP_DECLARE_SCHEMA(95bc14545813fbc1); -CAPNP_DECLARE_SCHEMA(9a0e61223d96743b); -CAPNP_DECLARE_SCHEMA(8523ddc40b86b8b0); -CAPNP_DECLARE_SCHEMA(d800b1d6cd6f1ca0); -CAPNP_DECLARE_SCHEMA(f316944415569081); -CAPNP_DECLARE_SCHEMA(d37007fde1f0027d); -CAPNP_DECLARE_SCHEMA(d625b7063acf691a); -CAPNP_DECLARE_SCHEMA(b28c96e23f4cbd58); -enum class Type_b28c96e23f4cbd58: uint16_t { - FAILED, - OVERLOADED, - DISCONNECTED, - UNIMPLEMENTED, -}; -CAPNP_DECLARE_ENUM(Type, b28c96e23f4cbd58); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { - -struct Message { - Message() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNIMPLEMENTED, - ABORT, - CALL, - RETURN, - FINISH, - RESOLVE, - RELEASE, - OBSOLETE_SAVE, - BOOTSTRAP, - OBSOLETE_DELETE, - PROVIDE, - ACCEPT, - JOIN, - DISEMBARGO, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(91b79f1f808db032, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Bootstrap { - Bootstrap() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e94ccf8031176ec4, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - struct SendResultsTo; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(836a53ce789d4cd4, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call::SendResultsTo { - SendResultsTo() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CALLER, - YOURSELF, - THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(dae8b0f61aab5f99, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Return { - Return() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - RESULTS, - EXCEPTION, - CANCELED, - RESULTS_SENT_ELSEWHERE, - TAKE_FROM_OTHER_QUESTION, - ACCEPT_FROM_THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e19b28d3db3573a, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Finish { - Finish() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37d2eb2c2f80e63, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Resolve { - Resolve() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CAP, - EXCEPTION, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bbc29655fa89086e, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Release { - Release() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ad1a6c0d7dd07497, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo { - Disembargo() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Context; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f964368b0fbd3711, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo::Context { - Context() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SENDER_LOOPBACK, - RECEIVER_LOOPBACK, - ACCEPT, - PROVIDE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d562b4df655bdd4d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Provide { - Provide() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9c6a046bfbc1ac5a, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Accept { - Accept() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d4c9b56290554016, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Join { - Join() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(fbe1980490e001af, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct MessageTarget { - MessageTarget() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPORTED_CAP, - PROMISED_ANSWER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95bc14545813fbc1, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Payload { - Payload() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9a0e61223d96743b, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CapDescriptor { - CapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NONE, - SENDER_HOSTED, - SENDER_PROMISE, - RECEIVER_HOSTED, - RECEIVER_ANSWER, - THIRD_PARTY_HOSTED, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8523ddc40b86b8b0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer { - PromisedAnswer() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Op; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d800b1d6cd6f1ca0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer::Op { - Op() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NOOP, - GET_POINTER_FIELD, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f316944415569081, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapDescriptor { - ThirdPartyCapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37007fde1f0027d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Exception { - Exception() = delete; - - class Reader; - class Builder; - class Pipeline; - typedef ::capnp::schemas::Type_b28c96e23f4cbd58 Type; - - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d625b7063acf691a, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Message::Reader { -public: - typedef Message Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnimplemented() const; - inline bool hasUnimplemented() const; - inline ::capnp::rpc::Message::Reader getUnimplemented() const; - - inline bool isAbort() const; - inline bool hasAbort() const; - inline ::capnp::rpc::Exception::Reader getAbort() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::rpc::Call::Reader getCall() const; - - inline bool isReturn() const; - inline bool hasReturn() const; - inline ::capnp::rpc::Return::Reader getReturn() const; - - inline bool isFinish() const; - inline bool hasFinish() const; - inline ::capnp::rpc::Finish::Reader getFinish() const; - - inline bool isResolve() const; - inline bool hasResolve() const; - inline ::capnp::rpc::Resolve::Reader getResolve() const; - - inline bool isRelease() const; - inline bool hasRelease() const; - inline ::capnp::rpc::Release::Reader getRelease() const; - - inline bool isObsoleteSave() const; - inline bool hasObsoleteSave() const; - inline ::capnp::AnyPointer::Reader getObsoleteSave() const; - - inline bool isBootstrap() const; - inline bool hasBootstrap() const; - inline ::capnp::rpc::Bootstrap::Reader getBootstrap() const; - - inline bool isObsoleteDelete() const; - inline bool hasObsoleteDelete() const; - inline ::capnp::AnyPointer::Reader getObsoleteDelete() const; - - inline bool isProvide() const; - inline bool hasProvide() const; - inline ::capnp::rpc::Provide::Reader getProvide() const; - - inline bool isAccept() const; - inline bool hasAccept() const; - inline ::capnp::rpc::Accept::Reader getAccept() const; - - inline bool isJoin() const; - inline bool hasJoin() const; - inline ::capnp::rpc::Join::Reader getJoin() const; - - inline bool isDisembargo() const; - inline bool hasDisembargo() const; - inline ::capnp::rpc::Disembargo::Reader getDisembargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Message::Builder { -public: - typedef Message Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnimplemented(); - inline bool hasUnimplemented(); - inline ::capnp::rpc::Message::Builder getUnimplemented(); - inline void setUnimplemented( ::capnp::rpc::Message::Reader value); - inline ::capnp::rpc::Message::Builder initUnimplemented(); - inline void adoptUnimplemented(::capnp::Orphan< ::capnp::rpc::Message>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Message> disownUnimplemented(); - - inline bool isAbort(); - inline bool hasAbort(); - inline ::capnp::rpc::Exception::Builder getAbort(); - inline void setAbort( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initAbort(); - inline void adoptAbort(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownAbort(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::rpc::Call::Builder getCall(); - inline void setCall( ::capnp::rpc::Call::Reader value); - inline ::capnp::rpc::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::rpc::Call>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Call> disownCall(); - - inline bool isReturn(); - inline bool hasReturn(); - inline ::capnp::rpc::Return::Builder getReturn(); - inline void setReturn( ::capnp::rpc::Return::Reader value); - inline ::capnp::rpc::Return::Builder initReturn(); - inline void adoptReturn(::capnp::Orphan< ::capnp::rpc::Return>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Return> disownReturn(); - - inline bool isFinish(); - inline bool hasFinish(); - inline ::capnp::rpc::Finish::Builder getFinish(); - inline void setFinish( ::capnp::rpc::Finish::Reader value); - inline ::capnp::rpc::Finish::Builder initFinish(); - inline void adoptFinish(::capnp::Orphan< ::capnp::rpc::Finish>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Finish> disownFinish(); - - inline bool isResolve(); - inline bool hasResolve(); - inline ::capnp::rpc::Resolve::Builder getResolve(); - inline void setResolve( ::capnp::rpc::Resolve::Reader value); - inline ::capnp::rpc::Resolve::Builder initResolve(); - inline void adoptResolve(::capnp::Orphan< ::capnp::rpc::Resolve>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Resolve> disownResolve(); - - inline bool isRelease(); - inline bool hasRelease(); - inline ::capnp::rpc::Release::Builder getRelease(); - inline void setRelease( ::capnp::rpc::Release::Reader value); - inline ::capnp::rpc::Release::Builder initRelease(); - inline void adoptRelease(::capnp::Orphan< ::capnp::rpc::Release>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Release> disownRelease(); - - inline bool isObsoleteSave(); - inline bool hasObsoleteSave(); - inline ::capnp::AnyPointer::Builder getObsoleteSave(); - inline ::capnp::AnyPointer::Builder initObsoleteSave(); - - inline bool isBootstrap(); - inline bool hasBootstrap(); - inline ::capnp::rpc::Bootstrap::Builder getBootstrap(); - inline void setBootstrap( ::capnp::rpc::Bootstrap::Reader value); - inline ::capnp::rpc::Bootstrap::Builder initBootstrap(); - inline void adoptBootstrap(::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> disownBootstrap(); - - inline bool isObsoleteDelete(); - inline bool hasObsoleteDelete(); - inline ::capnp::AnyPointer::Builder getObsoleteDelete(); - inline ::capnp::AnyPointer::Builder initObsoleteDelete(); - - inline bool isProvide(); - inline bool hasProvide(); - inline ::capnp::rpc::Provide::Builder getProvide(); - inline void setProvide( ::capnp::rpc::Provide::Reader value); - inline ::capnp::rpc::Provide::Builder initProvide(); - inline void adoptProvide(::capnp::Orphan< ::capnp::rpc::Provide>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Provide> disownProvide(); - - inline bool isAccept(); - inline bool hasAccept(); - inline ::capnp::rpc::Accept::Builder getAccept(); - inline void setAccept( ::capnp::rpc::Accept::Reader value); - inline ::capnp::rpc::Accept::Builder initAccept(); - inline void adoptAccept(::capnp::Orphan< ::capnp::rpc::Accept>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Accept> disownAccept(); - - inline bool isJoin(); - inline bool hasJoin(); - inline ::capnp::rpc::Join::Builder getJoin(); - inline void setJoin( ::capnp::rpc::Join::Reader value); - inline ::capnp::rpc::Join::Builder initJoin(); - inline void adoptJoin(::capnp::Orphan< ::capnp::rpc::Join>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Join> disownJoin(); - - inline bool isDisembargo(); - inline bool hasDisembargo(); - inline ::capnp::rpc::Disembargo::Builder getDisembargo(); - inline void setDisembargo( ::capnp::rpc::Disembargo::Reader value); - inline ::capnp::rpc::Disembargo::Builder initDisembargo(); - inline void adoptDisembargo(::capnp::Orphan< ::capnp::rpc::Disembargo>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Disembargo> disownDisembargo(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Message::Pipeline { -public: - typedef Message Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Bootstrap::Reader { -public: - typedef Bootstrap Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasDeprecatedObjectId() const; - inline ::capnp::AnyPointer::Reader getDeprecatedObjectId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Bootstrap::Builder { -public: - typedef Bootstrap Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder getDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder initDeprecatedObjectId(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Bootstrap::Pipeline { -public: - typedef Bootstrap Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline ::uint64_t getInterfaceId() const; - - inline ::uint16_t getMethodId() const; - - inline bool hasParams() const; - inline ::capnp::rpc::Payload::Reader getParams() const; - - inline typename SendResultsTo::Reader getSendResultsTo() const; - - inline bool getAllowThirdPartyTailCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline ::uint64_t getInterfaceId(); - inline void setInterfaceId( ::uint64_t value); - - inline ::uint16_t getMethodId(); - inline void setMethodId( ::uint16_t value); - - inline bool hasParams(); - inline ::capnp::rpc::Payload::Builder getParams(); - inline void setParams( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initParams(); - inline void adoptParams(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownParams(); - - inline typename SendResultsTo::Builder getSendResultsTo(); - inline typename SendResultsTo::Builder initSendResultsTo(); - - inline bool getAllowThirdPartyTailCall(); - inline void setAllowThirdPartyTailCall(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline ::capnp::rpc::Payload::Pipeline getParams(); - inline typename SendResultsTo::Pipeline getSendResultsTo(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::SendResultsTo::Reader { -public: - typedef SendResultsTo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isCaller() const; - inline ::capnp::Void getCaller() const; - - inline bool isYourself() const; - inline ::capnp::Void getYourself() const; - - inline bool isThirdParty() const; - inline bool hasThirdParty() const; - inline ::capnp::AnyPointer::Reader getThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::SendResultsTo::Builder { -public: - typedef SendResultsTo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isCaller(); - inline ::capnp::Void getCaller(); - inline void setCaller( ::capnp::Void value = ::capnp::VOID); - - inline bool isYourself(); - inline ::capnp::Void getYourself(); - inline void setYourself( ::capnp::Void value = ::capnp::VOID); - - inline bool isThirdParty(); - inline bool hasThirdParty(); - inline ::capnp::AnyPointer::Builder getThirdParty(); - inline ::capnp::AnyPointer::Builder initThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::SendResultsTo::Pipeline { -public: - typedef SendResultsTo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Return::Reader { -public: - typedef Return Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getAnswerId() const; - - inline bool getReleaseParamCaps() const; - - inline bool isResults() const; - inline bool hasResults() const; - inline ::capnp::rpc::Payload::Reader getResults() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - - inline bool isCanceled() const; - inline ::capnp::Void getCanceled() const; - - inline bool isResultsSentElsewhere() const; - inline ::capnp::Void getResultsSentElsewhere() const; - - inline bool isTakeFromOtherQuestion() const; - inline ::uint32_t getTakeFromOtherQuestion() const; - - inline bool isAcceptFromThirdParty() const; - inline bool hasAcceptFromThirdParty() const; - inline ::capnp::AnyPointer::Reader getAcceptFromThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Return::Builder { -public: - typedef Return Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getAnswerId(); - inline void setAnswerId( ::uint32_t value); - - inline bool getReleaseParamCaps(); - inline void setReleaseParamCaps(bool value); - - inline bool isResults(); - inline bool hasResults(); - inline ::capnp::rpc::Payload::Builder getResults(); - inline void setResults( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initResults(); - inline void adoptResults(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownResults(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - - inline bool isCanceled(); - inline ::capnp::Void getCanceled(); - inline void setCanceled( ::capnp::Void value = ::capnp::VOID); - - inline bool isResultsSentElsewhere(); - inline ::capnp::Void getResultsSentElsewhere(); - inline void setResultsSentElsewhere( ::capnp::Void value = ::capnp::VOID); - - inline bool isTakeFromOtherQuestion(); - inline ::uint32_t getTakeFromOtherQuestion(); - inline void setTakeFromOtherQuestion( ::uint32_t value); - - inline bool isAcceptFromThirdParty(); - inline bool hasAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder getAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder initAcceptFromThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Return::Pipeline { -public: - typedef Return Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Finish::Reader { -public: - typedef Finish Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool getReleaseResultCaps() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Finish::Builder { -public: - typedef Finish Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool getReleaseResultCaps(); - inline void setReleaseResultCaps(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Finish::Pipeline { -public: - typedef Finish Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Resolve::Reader { -public: - typedef Resolve Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getPromiseId() const; - - inline bool isCap() const; - inline bool hasCap() const; - inline ::capnp::rpc::CapDescriptor::Reader getCap() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Resolve::Builder { -public: - typedef Resolve Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getPromiseId(); - inline void setPromiseId( ::uint32_t value); - - inline bool isCap(); - inline bool hasCap(); - inline ::capnp::rpc::CapDescriptor::Builder getCap(); - inline void setCap( ::capnp::rpc::CapDescriptor::Reader value); - inline ::capnp::rpc::CapDescriptor::Builder initCap(); - inline void adoptCap(::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> disownCap(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Resolve::Pipeline { -public: - typedef Resolve Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Release::Reader { -public: - typedef Release Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getId() const; - - inline ::uint32_t getReferenceCount() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Release::Builder { -public: - typedef Release Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getId(); - inline void setId( ::uint32_t value); - - inline ::uint32_t getReferenceCount(); - inline void setReferenceCount( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Release::Pipeline { -public: - typedef Release Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Reader { -public: - typedef Disembargo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline typename Context::Reader getContext() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Builder { -public: - typedef Disembargo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline typename Context::Builder getContext(); - inline typename Context::Builder initContext(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Pipeline { -public: - typedef Disembargo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline typename Context::Pipeline getContext(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Context::Reader { -public: - typedef Context Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isSenderLoopback() const; - inline ::uint32_t getSenderLoopback() const; - - inline bool isReceiverLoopback() const; - inline ::uint32_t getReceiverLoopback() const; - - inline bool isAccept() const; - inline ::capnp::Void getAccept() const; - - inline bool isProvide() const; - inline ::uint32_t getProvide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Context::Builder { -public: - typedef Context Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isSenderLoopback(); - inline ::uint32_t getSenderLoopback(); - inline void setSenderLoopback( ::uint32_t value); - - inline bool isReceiverLoopback(); - inline ::uint32_t getReceiverLoopback(); - inline void setReceiverLoopback( ::uint32_t value); - - inline bool isAccept(); - inline ::capnp::Void getAccept(); - inline void setAccept( ::capnp::Void value = ::capnp::VOID); - - inline bool isProvide(); - inline ::uint32_t getProvide(); - inline void setProvide( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Context::Pipeline { -public: - typedef Context Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Provide::Reader { -public: - typedef Provide Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasRecipient() const; - inline ::capnp::AnyPointer::Reader getRecipient() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Provide::Builder { -public: - typedef Provide Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasRecipient(); - inline ::capnp::AnyPointer::Builder getRecipient(); - inline ::capnp::AnyPointer::Builder initRecipient(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Provide::Pipeline { -public: - typedef Provide Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Accept::Reader { -public: - typedef Accept Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasProvision() const; - inline ::capnp::AnyPointer::Reader getProvision() const; - - inline bool getEmbargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Accept::Builder { -public: - typedef Accept Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasProvision(); - inline ::capnp::AnyPointer::Builder getProvision(); - inline ::capnp::AnyPointer::Builder initProvision(); - - inline bool getEmbargo(); - inline void setEmbargo(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Accept::Pipeline { -public: - typedef Accept Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Join::Reader { -public: - typedef Join Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasKeyPart() const; - inline ::capnp::AnyPointer::Reader getKeyPart() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Join::Builder { -public: - typedef Join Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasKeyPart(); - inline ::capnp::AnyPointer::Builder getKeyPart(); - inline ::capnp::AnyPointer::Builder initKeyPart(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Join::Pipeline { -public: - typedef Join Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class MessageTarget::Reader { -public: - typedef MessageTarget Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImportedCap() const; - inline ::uint32_t getImportedCap() const; - - inline bool isPromisedAnswer() const; - inline bool hasPromisedAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getPromisedAnswer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class MessageTarget::Builder { -public: - typedef MessageTarget Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImportedCap(); - inline ::uint32_t getImportedCap(); - inline void setImportedCap( ::uint32_t value); - - inline bool isPromisedAnswer(); - inline bool hasPromisedAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getPromisedAnswer(); - inline void setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initPromisedAnswer(); - inline void adoptPromisedAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownPromisedAnswer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class MessageTarget::Pipeline { -public: - typedef MessageTarget Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Payload::Reader { -public: - typedef Payload Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasContent() const; - inline ::capnp::AnyPointer::Reader getContent() const; - - inline bool hasCapTable() const; - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader getCapTable() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Payload::Builder { -public: - typedef Payload Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasContent(); - inline ::capnp::AnyPointer::Builder getContent(); - inline ::capnp::AnyPointer::Builder initContent(); - - inline bool hasCapTable(); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder getCapTable(); - inline void setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder initCapTable(unsigned int size); - inline void adoptCapTable(::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> disownCapTable(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Payload::Pipeline { -public: - typedef Payload Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapDescriptor::Reader { -public: - typedef CapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNone() const; - inline ::capnp::Void getNone() const; - - inline bool isSenderHosted() const; - inline ::uint32_t getSenderHosted() const; - - inline bool isSenderPromise() const; - inline ::uint32_t getSenderPromise() const; - - inline bool isReceiverHosted() const; - inline ::uint32_t getReceiverHosted() const; - - inline bool isReceiverAnswer() const; - inline bool hasReceiverAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getReceiverAnswer() const; - - inline bool isThirdPartyHosted() const; - inline bool hasThirdPartyHosted() const; - inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader getThirdPartyHosted() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapDescriptor::Builder { -public: - typedef CapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNone(); - inline ::capnp::Void getNone(); - inline void setNone( ::capnp::Void value = ::capnp::VOID); - - inline bool isSenderHosted(); - inline ::uint32_t getSenderHosted(); - inline void setSenderHosted( ::uint32_t value); - - inline bool isSenderPromise(); - inline ::uint32_t getSenderPromise(); - inline void setSenderPromise( ::uint32_t value); - - inline bool isReceiverHosted(); - inline ::uint32_t getReceiverHosted(); - inline void setReceiverHosted( ::uint32_t value); - - inline bool isReceiverAnswer(); - inline bool hasReceiverAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getReceiverAnswer(); - inline void setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initReceiverAnswer(); - inline void adoptReceiverAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownReceiverAnswer(); - - inline bool isThirdPartyHosted(); - inline bool hasThirdPartyHosted(); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder getThirdPartyHosted(); - inline void setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder initThirdPartyHosted(); - inline void adoptThirdPartyHosted(::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> disownThirdPartyHosted(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapDescriptor::Pipeline { -public: - typedef CapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Reader { -public: - typedef PromisedAnswer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTransform() const; - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader getTransform() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Builder { -public: - typedef PromisedAnswer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTransform(); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder getTransform(); - inline void setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder initTransform(unsigned int size); - inline void adoptTransform(::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> disownTransform(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Pipeline { -public: - typedef PromisedAnswer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Op::Reader { -public: - typedef Op Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNoop() const; - inline ::capnp::Void getNoop() const; - - inline bool isGetPointerField() const; - inline ::uint16_t getGetPointerField() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Op::Builder { -public: - typedef Op Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNoop(); - inline ::capnp::Void getNoop(); - inline void setNoop( ::capnp::Void value = ::capnp::VOID); - - inline bool isGetPointerField(); - inline ::uint16_t getGetPointerField(); - inline void setGetPointerField( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Op::Pipeline { -public: - typedef Op Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapDescriptor::Reader { -public: - typedef ThirdPartyCapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasId() const; - inline ::capnp::AnyPointer::Reader getId() const; - - inline ::uint32_t getVineId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapDescriptor::Builder { -public: - typedef ThirdPartyCapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasId(); - inline ::capnp::AnyPointer::Builder getId(); - inline ::capnp::AnyPointer::Builder initId(); - - inline ::uint32_t getVineId(); - inline void setVineId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapDescriptor::Pipeline { -public: - typedef ThirdPartyCapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Exception::Reader { -public: - typedef Exception Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasReason() const; - inline ::capnp::Text::Reader getReason() const; - - inline bool getObsoleteIsCallersFault() const; - - inline ::uint16_t getObsoleteDurability() const; - - inline ::capnp::rpc::Exception::Type getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Exception::Builder { -public: - typedef Exception Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasReason(); - inline ::capnp::Text::Builder getReason(); - inline void setReason( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initReason(unsigned int size); - inline void adoptReason(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownReason(); - - inline bool getObsoleteIsCallersFault(); - inline void setObsoleteIsCallersFault(bool value); - - inline ::uint16_t getObsoleteDurability(); - inline void setObsoleteDurability( ::uint16_t value); - - inline ::capnp::rpc::Exception::Type getType(); - inline void setType( ::capnp::rpc::Exception::Type value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Exception::Pipeline { -public: - typedef Exception Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::Message::Which Message::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Message::Which Message::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Message::Reader::isUnimplemented() const { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Builder::isUnimplemented() { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Reader::hasUnimplemented() const { - if (which() != Message::UNIMPLEMENTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasUnimplemented() { - if (which() != Message::UNIMPLEMENTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Message::Reader Message::Reader::getUnimplemented() const { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Message::Builder Message::Builder::getUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setUnimplemented( ::capnp::rpc::Message::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Message::Builder Message::Builder::initUnimplemented() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptUnimplemented( - ::capnp::Orphan< ::capnp::rpc::Message>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Message> Message::Builder::disownUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAbort() const { - return which() == Message::ABORT; -} -inline bool Message::Builder::isAbort() { - return which() == Message::ABORT; -} -inline bool Message::Reader::hasAbort() const { - if (which() != Message::ABORT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAbort() { - if (which() != Message::ABORT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Message::Reader::getAbort() const { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::getAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAbort( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::initAbort() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAbort( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Message::Builder::disownAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isCall() const { - return which() == Message::CALL; -} -inline bool Message::Builder::isCall() { - return which() == Message::CALL; -} -inline bool Message::Reader::hasCall() const { - if (which() != Message::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasCall() { - if (which() != Message::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Call::Reader Message::Reader::getCall() const { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Call::Builder Message::Builder::getCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setCall( ::capnp::rpc::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Call::Builder Message::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptCall( - ::capnp::Orphan< ::capnp::rpc::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Call> Message::Builder::disownCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isReturn() const { - return which() == Message::RETURN; -} -inline bool Message::Builder::isReturn() { - return which() == Message::RETURN; -} -inline bool Message::Reader::hasReturn() const { - if (which() != Message::RETURN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasReturn() { - if (which() != Message::RETURN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Return::Reader Message::Reader::getReturn() const { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Return::Builder Message::Builder::getReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setReturn( ::capnp::rpc::Return::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Return::Builder Message::Builder::initReturn() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptReturn( - ::capnp::Orphan< ::capnp::rpc::Return>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Return> Message::Builder::disownReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isFinish() const { - return which() == Message::FINISH; -} -inline bool Message::Builder::isFinish() { - return which() == Message::FINISH; -} -inline bool Message::Reader::hasFinish() const { - if (which() != Message::FINISH) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasFinish() { - if (which() != Message::FINISH) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Finish::Reader Message::Reader::getFinish() const { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::getFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setFinish( ::capnp::rpc::Finish::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::initFinish() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptFinish( - ::capnp::Orphan< ::capnp::rpc::Finish>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Finish> Message::Builder::disownFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isResolve() const { - return which() == Message::RESOLVE; -} -inline bool Message::Builder::isResolve() { - return which() == Message::RESOLVE; -} -inline bool Message::Reader::hasResolve() const { - if (which() != Message::RESOLVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasResolve() { - if (which() != Message::RESOLVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Resolve::Reader Message::Reader::getResolve() const { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::getResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setResolve( ::capnp::rpc::Resolve::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::initResolve() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptResolve( - ::capnp::Orphan< ::capnp::rpc::Resolve>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Resolve> Message::Builder::disownResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isRelease() const { - return which() == Message::RELEASE; -} -inline bool Message::Builder::isRelease() { - return which() == Message::RELEASE; -} -inline bool Message::Reader::hasRelease() const { - if (which() != Message::RELEASE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasRelease() { - if (which() != Message::RELEASE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Release::Reader Message::Reader::getRelease() const { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Release::Builder Message::Builder::getRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setRelease( ::capnp::rpc::Release::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Release::Builder Message::Builder::initRelease() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptRelease( - ::capnp::Orphan< ::capnp::rpc::Release>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Release> Message::Builder::disownRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteSave() const { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Builder::isObsoleteSave() { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Reader::hasObsoleteSave() const { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteSave() { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteSave() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteSave() { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteSave() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_SAVE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isBootstrap() const { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Builder::isBootstrap() { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Reader::hasBootstrap() const { - if (which() != Message::BOOTSTRAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasBootstrap() { - if (which() != Message::BOOTSTRAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Bootstrap::Reader Message::Reader::getBootstrap() const { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::getBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setBootstrap( ::capnp::rpc::Bootstrap::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::initBootstrap() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptBootstrap( - ::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> Message::Builder::disownBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteDelete() const { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Builder::isObsoleteDelete() { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Reader::hasObsoleteDelete() const { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteDelete() { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteDelete() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteDelete() { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteDelete() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_DELETE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isProvide() const { - return which() == Message::PROVIDE; -} -inline bool Message::Builder::isProvide() { - return which() == Message::PROVIDE; -} -inline bool Message::Reader::hasProvide() const { - if (which() != Message::PROVIDE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasProvide() { - if (which() != Message::PROVIDE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Provide::Reader Message::Reader::getProvide() const { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::getProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setProvide( ::capnp::rpc::Provide::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::initProvide() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptProvide( - ::capnp::Orphan< ::capnp::rpc::Provide>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Provide> Message::Builder::disownProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAccept() const { - return which() == Message::ACCEPT; -} -inline bool Message::Builder::isAccept() { - return which() == Message::ACCEPT; -} -inline bool Message::Reader::hasAccept() const { - if (which() != Message::ACCEPT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAccept() { - if (which() != Message::ACCEPT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Accept::Reader Message::Reader::getAccept() const { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::getAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAccept( ::capnp::rpc::Accept::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::initAccept() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAccept( - ::capnp::Orphan< ::capnp::rpc::Accept>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Accept> Message::Builder::disownAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isJoin() const { - return which() == Message::JOIN; -} -inline bool Message::Builder::isJoin() { - return which() == Message::JOIN; -} -inline bool Message::Reader::hasJoin() const { - if (which() != Message::JOIN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasJoin() { - if (which() != Message::JOIN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Join::Reader Message::Reader::getJoin() const { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Join::Builder Message::Builder::getJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setJoin( ::capnp::rpc::Join::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Join::Builder Message::Builder::initJoin() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptJoin( - ::capnp::Orphan< ::capnp::rpc::Join>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Join> Message::Builder::disownJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isDisembargo() const { - return which() == Message::DISEMBARGO; -} -inline bool Message::Builder::isDisembargo() { - return which() == Message::DISEMBARGO; -} -inline bool Message::Reader::hasDisembargo() const { - if (which() != Message::DISEMBARGO) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasDisembargo() { - if (which() != Message::DISEMBARGO) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Disembargo::Reader Message::Reader::getDisembargo() const { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::getDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setDisembargo( ::capnp::rpc::Disembargo::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::initDisembargo() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptDisembargo( - ::capnp::Orphan< ::capnp::rpc::Disembargo>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Disembargo> Message::Builder::disownDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Bootstrap::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Bootstrap::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Bootstrap::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Bootstrap::Reader::hasDeprecatedObjectId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Bootstrap::Builder::hasDeprecatedObjectId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Bootstrap::Reader::getDeprecatedObjectId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::getDeprecatedObjectId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::initDeprecatedObjectId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Call::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Call::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Call::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Call::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Call::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Call::Reader::getInterfaceId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Call::Builder::getInterfaceId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setInterfaceId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Call::Reader::getMethodId() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Call::Builder::getMethodId() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setMethodId( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::Payload::Pipeline Call::Pipeline::getParams() { - return ::capnp::rpc::Payload::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setParams( ::capnp::rpc::Payload::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::initParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline typename Call::SendResultsTo::Reader Call::Reader::getSendResultsTo() const { - return typename Call::SendResultsTo::Reader(_reader); -} -inline typename Call::SendResultsTo::Builder Call::Builder::getSendResultsTo() { - return typename Call::SendResultsTo::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Call::SendResultsTo::Pipeline Call::Pipeline::getSendResultsTo() { - return typename Call::SendResultsTo::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Call::SendResultsTo::Builder Call::Builder::initSendResultsTo() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<3>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - return typename Call::SendResultsTo::Builder(_builder); -} -inline bool Call::Reader::getAllowThirdPartyTailCall() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Call::Builder::getAllowThirdPartyTailCall() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setAllowThirdPartyTailCall(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline bool Call::SendResultsTo::Reader::isCaller() const { - return which() == Call::SendResultsTo::CALLER; -} -inline bool Call::SendResultsTo::Builder::isCaller() { - return which() == Call::SendResultsTo::CALLER; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getCaller() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getCaller() { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setCaller( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::CALLER); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isYourself() const { - return which() == Call::SendResultsTo::YOURSELF; -} -inline bool Call::SendResultsTo::Builder::isYourself() { - return which() == Call::SendResultsTo::YOURSELF; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getYourself() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getYourself() { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setYourself( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::YOURSELF); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isThirdParty() const { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Builder::isThirdParty() { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Reader::hasThirdParty() const { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::SendResultsTo::Builder::hasThirdParty() { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Call::SendResultsTo::Reader::getThirdParty() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::getThirdParty() { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::initThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::Return::Which Return::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Return::Which Return::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Reader::getAnswerId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getAnswerId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setAnswerId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::getReleaseParamCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Return::Builder::getReleaseParamCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Return::Builder::setReleaseParamCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline bool Return::Reader::isResults() const { - return which() == Return::RESULTS; -} -inline bool Return::Builder::isResults() { - return which() == Return::RESULTS; -} -inline bool Return::Reader::hasResults() const { - if (which() != Return::RESULTS) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasResults() { - if (which() != Return::RESULTS) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Return::Reader::getResults() const { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::getResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setResults( ::capnp::rpc::Payload::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::initResults() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptResults( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Return::Builder::disownResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isException() const { - return which() == Return::EXCEPTION; -} -inline bool Return::Builder::isException() { - return which() == Return::EXCEPTION; -} -inline bool Return::Reader::hasException() const { - if (which() != Return::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasException() { - if (which() != Return::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Return::Reader::getException() const { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::getException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Return::Builder::disownException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isCanceled() const { - return which() == Return::CANCELED; -} -inline bool Return::Builder::isCanceled() { - return which() == Return::CANCELED; -} -inline ::capnp::Void Return::Reader::getCanceled() const { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getCanceled() { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setCanceled( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::CANCELED); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isResultsSentElsewhere() const { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline bool Return::Builder::isResultsSentElsewhere() { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline ::capnp::Void Return::Reader::getResultsSentElsewhere() const { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getResultsSentElsewhere() { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setResultsSentElsewhere( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS_SENT_ELSEWHERE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isTakeFromOtherQuestion() const { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline bool Return::Builder::isTakeFromOtherQuestion() { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline ::uint32_t Return::Reader::getTakeFromOtherQuestion() const { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getTakeFromOtherQuestion() { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setTakeFromOtherQuestion( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::TAKE_FROM_OTHER_QUESTION); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isAcceptFromThirdParty() const { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Builder::isAcceptFromThirdParty() { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Reader::hasAcceptFromThirdParty() const { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasAcceptFromThirdParty() { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Return::Reader::getAcceptFromThirdParty() const { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::getAcceptFromThirdParty() { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::initAcceptFromThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::ACCEPT_FROM_THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Finish::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Finish::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Finish::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Finish::Reader::getReleaseResultCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Finish::Builder::getReleaseResultCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Finish::Builder::setReleaseResultCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline ::capnp::rpc::Resolve::Which Resolve::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Resolve::Which Resolve::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Reader::getPromiseId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Builder::getPromiseId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Resolve::Builder::setPromiseId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Resolve::Reader::isCap() const { - return which() == Resolve::CAP; -} -inline bool Resolve::Builder::isCap() { - return which() == Resolve::CAP; -} -inline bool Resolve::Reader::hasCap() const { - if (which() != Resolve::CAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasCap() { - if (which() != Resolve::CAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::CapDescriptor::Reader Resolve::Reader::getCap() const { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::getCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setCap( ::capnp::rpc::CapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::initCap() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptCap( - ::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> Resolve::Builder::disownCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Resolve::Reader::isException() const { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Builder::isException() { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Reader::hasException() const { - if (which() != Resolve::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasException() { - if (which() != Resolve::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Resolve::Reader::getException() const { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::getException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Resolve::Builder::disownException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Release::Reader::getId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Release::Reader::getReferenceCount() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getReferenceCount() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setReferenceCount( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Disembargo::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Disembargo::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Disembargo::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Disembargo::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Disembargo::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Disembargo::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline typename Disembargo::Context::Reader Disembargo::Reader::getContext() const { - return typename Disembargo::Context::Reader(_reader); -} -inline typename Disembargo::Context::Builder Disembargo::Builder::getContext() { - return typename Disembargo::Context::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Disembargo::Context::Pipeline Disembargo::Pipeline::getContext() { - return typename Disembargo::Context::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Disembargo::Context::Builder Disembargo::Builder::initContext() { - _builder.setDataField< ::uint32_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Disembargo::Context::Builder(_builder); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool Disembargo::Context::Reader::isSenderLoopback() const { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isSenderLoopback() { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getSenderLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getSenderLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setSenderLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::SENDER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isReceiverLoopback() const { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isReceiverLoopback() { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getReceiverLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getReceiverLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setReceiverLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::RECEIVER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isAccept() const { - return which() == Disembargo::Context::ACCEPT; -} -inline bool Disembargo::Context::Builder::isAccept() { - return which() == Disembargo::Context::ACCEPT; -} -inline ::capnp::Void Disembargo::Context::Reader::getAccept() const { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Disembargo::Context::Builder::getAccept() { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setAccept( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::ACCEPT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isProvide() const { - return which() == Disembargo::Context::PROVIDE; -} -inline bool Disembargo::Context::Builder::isProvide() { - return which() == Disembargo::Context::PROVIDE; -} -inline ::uint32_t Disembargo::Context::Reader::getProvide() const { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getProvide() { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setProvide( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::PROVIDE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Provide::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Provide::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Provide::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Provide::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Provide::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Provide::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Provide::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Provide::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Provide::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Provide::Reader::hasRecipient() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasRecipient() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Provide::Reader::getRecipient() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::getRecipient() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::initRecipient() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Accept::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Accept::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Accept::Reader::hasProvision() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Accept::Builder::hasProvision() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Accept::Reader::getProvision() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::getProvision() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::initProvision() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Accept::Reader::getEmbargo() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool Accept::Builder::getEmbargo() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setEmbargo(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Join::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Join::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Join::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Join::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Join::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Join::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Join::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Join::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Join::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Join::Reader::hasKeyPart() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasKeyPart() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Join::Reader::getKeyPart() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::getKeyPart() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::initKeyPart() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool MessageTarget::Reader::isImportedCap() const { - return which() == MessageTarget::IMPORTED_CAP; -} -inline bool MessageTarget::Builder::isImportedCap() { - return which() == MessageTarget::IMPORTED_CAP; -} -inline ::uint32_t MessageTarget::Reader::getImportedCap() const { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t MessageTarget::Builder::getImportedCap() { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void MessageTarget::Builder::setImportedCap( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::IMPORTED_CAP); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool MessageTarget::Reader::isPromisedAnswer() const { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Builder::isPromisedAnswer() { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Reader::hasPromisedAnswer() const { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool MessageTarget::Builder::hasPromisedAnswer() { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader MessageTarget::Reader::getPromisedAnswer() const { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::getPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::initPromisedAnswer() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::adoptPromisedAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> MessageTarget::Builder::disownPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Payload::Reader::hasContent() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasContent() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Payload::Reader::getContent() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::getContent() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::initContent() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Payload::Reader::hasCapTable() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasCapTable() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader Payload::Reader::getCapTable() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::getCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Payload::Builder::setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::initCapTable(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Payload::Builder::adoptCapTable( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> Payload::Builder::disownCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool CapDescriptor::Reader::isNone() const { - return which() == CapDescriptor::NONE; -} -inline bool CapDescriptor::Builder::isNone() { - return which() == CapDescriptor::NONE; -} -inline ::capnp::Void CapDescriptor::Reader::getNone() const { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void CapDescriptor::Builder::getNone() { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setNone( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::NONE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderHosted() const { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline bool CapDescriptor::Builder::isSenderHosted() { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getSenderHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderHosted() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderPromise() const { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline bool CapDescriptor::Builder::isSenderPromise() { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline ::uint32_t CapDescriptor::Reader::getSenderPromise() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderPromise() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderPromise( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_PROMISE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverHosted() const { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline bool CapDescriptor::Builder::isReceiverHosted() { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getReceiverHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getReceiverHosted() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setReceiverHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverAnswer() const { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Builder::isReceiverAnswer() { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Reader::hasReceiverAnswer() const { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasReceiverAnswer() { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader CapDescriptor::Reader::getReceiverAnswer() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::getReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::initReceiverAnswer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptReceiverAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> CapDescriptor::Builder::disownReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CapDescriptor::Reader::isThirdPartyHosted() const { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Builder::isThirdPartyHosted() { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Reader::hasThirdPartyHosted() const { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasThirdPartyHosted() { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader CapDescriptor::Reader::getThirdPartyHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::getThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::initThirdPartyHosted() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptThirdPartyHosted( - ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> CapDescriptor::Builder::disownThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t PromisedAnswer::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t PromisedAnswer::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Reader::hasTransform() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool PromisedAnswer::Builder::hasTransform() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader PromisedAnswer::Reader::getTransform() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::getTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void PromisedAnswer::Builder::setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::initTransform(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void PromisedAnswer::Builder::adoptTransform( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> PromisedAnswer::Builder::disownTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool PromisedAnswer::Op::Reader::isNoop() const { - return which() == PromisedAnswer::Op::NOOP; -} -inline bool PromisedAnswer::Op::Builder::isNoop() { - return which() == PromisedAnswer::Op::NOOP; -} -inline ::capnp::Void PromisedAnswer::Op::Reader::getNoop() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void PromisedAnswer::Op::Builder::getNoop() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setNoop( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::NOOP); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Op::Reader::isGetPointerField() const { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline bool PromisedAnswer::Op::Builder::isGetPointerField() { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline ::uint16_t PromisedAnswer::Op::Reader::getGetPointerField() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t PromisedAnswer::Op::Builder::getGetPointerField() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setGetPointerField( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::GET_POINTER_FIELD); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool ThirdPartyCapDescriptor::Reader::hasId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool ThirdPartyCapDescriptor::Builder::hasId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader ThirdPartyCapDescriptor::Reader::getId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::getId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::initId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t ThirdPartyCapDescriptor::Reader::getVineId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ThirdPartyCapDescriptor::Builder::getVineId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ThirdPartyCapDescriptor::Builder::setVineId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Exception::Reader::hasReason() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Exception::Builder::hasReason() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Exception::Reader::getReason() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Exception::Builder::getReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Exception::Builder::setReason( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Exception::Builder::initReason(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Exception::Builder::adoptReason( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Exception::Builder::disownReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Exception::Reader::getObsoleteIsCallersFault() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Exception::Builder::getObsoleteIsCallersFault() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteIsCallersFault(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Exception::Reader::getObsoleteDurability() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Exception::Builder::getObsoleteDurability() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteDurability( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Exception::Type Exception::Reader::getType() const { - return _reader.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::Exception::Type Exception::Builder::getType() { - return _builder.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setType( ::capnp::rpc::Exception::Type value) { - _builder.setDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_b312981b2552a250_ diff --git a/external/capnp/include/capnp/rpc.h b/external/capnp/include/capnp/rpc.h deleted file mode 100644 index d84ed982e7..0000000000 --- a/external/capnp/include/capnp/rpc.h +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_H_ -#define CAPNP_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "rpc-prelude.h" - -namespace capnp { - -template -class VatNetwork; -template -class SturdyRefRestorer; - -template -class BootstrapFactory: public _::BootstrapFactoryBase { - // Interface that constructs per-client bootstrap interfaces. Use this if you want each client - // who connects to see a different bootstrap interface based on their (authenticated) VatId. - // This allows an application to bootstrap off of the authentication performed at the VatNetwork - // level. (Typically VatId is some sort of public key.) - // - // This is only useful for multi-party networks. For TwoPartyVatNetwork, there's no reason to - // use a BootstrapFactory; just specify a single bootstrap capability in this case. - -public: - virtual Capability::Client createFor(typename VatId::Reader clientId) = 0; - // Create a bootstrap capability appropriate for exposing to the given client. VatNetwork will - // have authenticated the client VatId before this is called. - -private: - Capability::Client baseCreateFor(AnyStruct::Reader clientId) override; -}; - -template -class RpcSystem: public _::RpcSystemBase { - // Represents the RPC system, which is the portal to objects available on the network. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // See `makeRpcServer()` and `makeRpcClient()` below for convenient syntax for setting up an - // `RpcSystem` given a `VatNetwork`. - // - // See `ez-rpc.h` for an even simpler interface for setting up RPC in a typical two-party - // client/server scenario. - -public: - template - RpcSystem( - VatNetwork& network, - kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer); - - RpcSystem(RpcSystem&& other) = default; - - Capability::Client bootstrap(typename VatId::Reader vatId); - // Connect to the given vat and return its bootstrap interface. - - Capability::Client restore(typename VatId::Reader hostId, AnyPointer::Reader objectId) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); - // ** DEPRECATED ** - // - // Restores the given SturdyRef from the network and return the capability representing it. - // - // `hostId` identifies the host from which to request the ref, in the format specified by the - // `VatNetwork` in use. `objectId` is the object ID in whatever format is expected by said host. - // - // This method will be removed in a future version of Cap'n Proto. Instead, please transition - // to using bootstrap(), which is equivalent to calling restore() with a null `objectId`. - // You may emulate the old concept of object IDs by exporting a bootstrap interface which has - // methods that can be used to obtain other capabilities by ID. - - void setFlowLimit(size_t words); - // Sets the incoming call flow limit. If more than `words` worth of call messages have not yet - // received responses, the RpcSystem will not read further messages from the stream. This can be - // used as a crude way to prevent a resource exhaustion attack (or bug) in which a peer makes an - // excessive number of simultaneous calls that consume the receiver's RAM. - // - // There are some caveats. When over the flow limit, all messages are blocked, including returns. - // If the outstanding calls are themselves waiting on calls going in the opposite direction, the - // flow limit may prevent those calls from completing, leading to deadlock. However, a - // sufficiently high limit should make this unlikely. - // - // Note that a call's parameter size counts against the flow limit until the call returns, even - // if the recipient calls releaseParams() to free the parameter memory early. This is because - // releaseParams() may simply indicate that the parameters have been forwarded to another - // machine, but are still in-memory there. For illustration, say that Alice made a call to Bob - // who forwarded the call to Carol. Bob has imposed a flow limit on Alice. Alice's calls are - // being forwarded to Carol, so Bob never keeps the parameters in-memory for more than a brief - // period. However, the flow limit counts all calls that haven't returned, even if Bob has - // already freed the memory they consumed. You might argue that the right solution here is - // instead for Carol to impose her own flow limit on Bob. This has a serious problem, though: - // Bob might be forwarding requests to Carol on behalf of many different parties, not just Alice. - // If Alice can pump enough data to hit the Bob -> Carol flow limit, then those other parties - // will be disrupted. Thus, we can only really impose the limit on the Alice -> Bob link, which - // only affects Alice. We need that one flow limit to limit Alice's impact on the whole system, - // so it has to count all in-flight calls. - // - // In Sandstorm, flow limits are imposed by the supervisor on calls coming out of a grain, in - // order to prevent a grain from inundating the system with in-flight calls. In practice, the - // main time this happens is when a grain is pushing a large file download and doesn't implement - // proper cooperative flow control. -}; - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface); -// Make an RPC server. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// MyMainInterface::Client bootstrap = makeMain(); -// auto server = makeRpcServer(network, bootstrap); -// kj::NEVER_DONE.wait(waitScope); // run forever -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway); -// Make an RPC server for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface and communicates with a different realm than the application is in via a -// RealmGateway. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); -// ** DEPRECATED ** -// -// Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object -// can be used to look up objects by ID. -// -// Please transition to exporting only one interface, which is known as the "bootstrap" interface. -// For backwards-compatibility with old clients, continue to implement SturdyRefRestorer, but -// return the new bootstrap interface when the request object ID is null. When new clients connect -// and request the bootstrap interface, they will get that interface. Eventually, once all clients -// are updated to request only the bootstrap interface, stop implementing SturdyRefRestorer and -// switch to passing the bootstrap capability itself as the second parameter to `makeRpcServer()`. - -template -RpcSystem makeRpcClient( - VatNetwork& network); -// Make an RPC client. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// auto client = makeRpcClient(network); -// MyCapability::Client cap = client.restore(hostId, objId).castAs(); -// auto response = cap.fooRequest().send().wait(waitScope); -// handleMyResponse(response); -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway); -// Make an RPC client for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -class SturdyRefRestorer: public _::SturdyRefRestorerBase { - // ** DEPRECATED ** - // - // In Cap'n Proto 0.4.x, applications could export multiple main interfaces identified by - // object IDs. The callback used to map object IDs to objects was `SturdyRefRestorer`, as we - // imagined this would eventually be used for restoring SturdyRefs as well. In practice, it was - // never used for real SturdyRefs, only for exporting singleton objects under well-known names. - // - // The new preferred strategy is to export only a _single_ such interface, called the - // "bootstrap interface". That interface can itself have methods for obtaining other objects, of - // course, but that is up to the app. `SturdyRefRestorer` exists for backwards-compatibility. - // - // Hint: Use SturdyRefRestorer to define a server that exports services under - // string names. - -public: - virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) - KJ_DEPRECATED( - "Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0; - // Restore the given object, returning a capability representing it. - -private: - Capability::Client baseRestore(AnyPointer::Reader ref) override final; -}; - -// ======================================================================================= -// VatNetwork - -class OutgoingRpcMessage { - // A message to be sent by a `VatNetwork`. - -public: - virtual AnyPointer::Builder getBody() = 0; - // Get the message body, which the caller may fill in any way it wants. (The standard RPC - // implementation initializes it as a Message as defined in rpc.capnp.) - - virtual void send() = 0; - // Send the message, or at least put it in a queue to be sent later. Note that the builder - // returned by `getBody()` remains valid at least until the `OutgoingRpcMessage` is destroyed. -}; - -class IncomingRpcMessage { - // A message received from a `VatNetwork`. - -public: - virtual AnyPointer::Reader getBody() = 0; - // Get the message body, to be interpreted by the caller. (The standard RPC implementation - // interprets it as a Message as defined in rpc.capnp.) -}; - -template -class VatNetwork: public _::VatNetworkBase { - // Cap'n Proto RPC operates between vats, where a "vat" is some sort of host of objects. - // Typically one Cap'n Proto process (in the Unix sense) is one vat. The RPC system is what - // allows calls between objects hosted in different vats. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // The most common implementation of VatNetwork is TwoPartyVatNetwork (rpc-twoparty.h). Most - // simple client-server apps will want to use it. (You may even want to use the EZ RPC - // interfaces in `ez-rpc.h` and avoid all of this.) - // - // TODO(someday): Provide a standard implementation for the public internet. - -public: - class Connection; - - struct ConnectionAndProvisionId { - // Result of connecting to a vat introduced by another vat. - - kj::Own connection; - // Connection to the new vat. - - kj::Own firstMessage; - // An already-allocated `OutgoingRpcMessage` associated with `connection`. The RPC system will - // construct this as an `Accept` message and send it. - - Orphan provisionId; - // A `ProvisionId` already allocated inside `firstMessage`, which the RPC system will use to - // build the `Accept` message. - }; - - class Connection: public _::VatNetworkBase::Connection { - // A two-way RPC connection. - // - // This object may represent a connection that doesn't exist yet, but is expected to exist - // in the future. In this case, sent messages will automatically be queued and sent once the - // connection is ready, so that the caller doesn't need to know the difference. - - public: - // Level 0 features ---------------------------------------------- - - virtual typename VatId::Reader getPeerVatId() = 0; - // Returns the connected vat's authenticated VatId. It is the VatNetwork's responsibility to - // authenticate this, so that the caller can be assured that they are really talking to the - // identified vat and not an imposter. - - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) override = 0; - // Allocate a new message to be sent on this connection. - // - // If `firstSegmentWordSize` is non-zero, it should be treated as a hint suggesting how large - // to make the first segment. This is entirely a hint and the connection may adjust it up or - // down. If it is zero, the connection should choose the size itself. - - virtual kj::Promise>> receiveIncomingMessage() override = 0; - // Wait for a message to be received and return it. If the read stream cleanly terminates, - // return null. If any other problem occurs, throw an exception. - - virtual kj::Promise shutdown() override KJ_WARN_UNUSED_RESULT = 0; - // Waits until all outgoing messages have been sent, then shuts down the outgoing stream. The - // returned promise resolves after shutdown is complete. - - private: - AnyStruct::Reader baseGetPeerVatId() override; - }; - - // Level 0 features ------------------------------------------------ - - virtual kj::Maybe> connect(typename VatId::Reader hostId) = 0; - // Connect to a VatId. Note that this method immediately returns a `Connection`, even - // if the network connection has not yet been established. Messages can be queued to this - // connection and will be delivered once it is open. The caller must attempt to read from the - // connection to verify that it actually succeeded; the read will fail if the connection - // couldn't be opened. Some network implementations may actually start sending messages before - // hearing back from the server at all, to avoid a round trip. - // - // Returns nullptr if `hostId` refers to the local host. - - virtual kj::Promise> accept() = 0; - // Wait for the next incoming connection and return it. - - // Level 4 features ------------------------------------------------ - // TODO(someday) - -private: - kj::Maybe> - baseConnect(AnyStruct::Reader hostId) override final; - kj::Promise> baseAccept() override final; -}; - -// ======================================================================================= -// *************************************************************************************** -// Inline implementation details start here -// *************************************************************************************** -// ======================================================================================= - -template -Capability::Client BootstrapFactory::baseCreateFor(AnyStruct::Reader clientId) { - return createFor(clientId.as()); -} - -template -kj::Maybe> - VatNetwork:: - baseConnect(AnyStruct::Reader ref) { - auto maybe = connect(ref.as()); - return maybe.map([](kj::Own& conn) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(conn); - }); -} - -template -kj::Promise> - VatNetwork::baseAccept() { - return accept().then( - [](kj::Own&& connection) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(connection); - }); -} - -template -AnyStruct::Reader VatNetwork< - SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>:: - Connection::baseGetPeerVatId() { - return getPeerVatId(); -} - -template -Capability::Client SturdyRefRestorer::baseRestore(AnyPointer::Reader ref) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return restore(ref.getAs()); -#pragma GCC diagnostic pop -} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - kj::Maybe bootstrap, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, kj::mv(bootstrap), kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, bootstrapFactory, kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer) - : _::RpcSystemBase(network, restorer) {} - -template -Capability::Client RpcSystem::bootstrap(typename VatId::Reader vatId) { - return baseBootstrap(_::PointerHelpers::getInternalReader(vatId)); -} - -template -Capability::Client RpcSystem::restore( - typename VatId::Reader hostId, AnyPointer::Reader objectId) { - return baseRestore(_::PointerHelpers::getInternalReader(hostId), objectId); -} - -template -inline void RpcSystem::setFlowLimit(size_t words) { - baseSetFlowLimit(words); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface) { - return RpcSystem(network, kj::mv(bootstrapInterface)); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway) { - return RpcSystem(network, kj::mv(bootstrapInterface), - gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory) { - return RpcSystem(network, bootstrapFactory); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway) { - return RpcSystem(network, bootstrapFactory, gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) { - return RpcSystem(network, restorer); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network) { - return RpcSystem(network, nullptr); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway) { - return RpcSystem(network, nullptr, gateway.template castAs>()); -} - -} // namespace capnp - -#endif // CAPNP_RPC_H_ diff --git a/external/capnp/include/capnp/schema-lite.h b/external/capnp/include/capnp/schema-lite.h deleted file mode 100644 index 58a8c14c05..0000000000 --- a/external/capnp/include/capnp/schema-lite.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LITE_H_ -#define CAPNP_SCHEMA_LITE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -template -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(CapnpPrivate::encodedSchema()); -} - -template ::typeId> -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(schemas::EnumInfo::encodedSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LITE_H_ diff --git a/external/capnp/include/capnp/schema-loader.h b/external/capnp/include/capnp/schema-loader.h deleted file mode 100644 index 0e34cba77f..0000000000 --- a/external/capnp/include/capnp/schema-loader.h +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LOADER_H_ -#define CAPNP_SCHEMA_LOADER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include -#include - -namespace capnp { - -class SchemaLoader { - // Class which can be used to construct Schema objects from schema::Nodes as defined in - // schema.capnp. - // - // It is a bad idea to use this class on untrusted input with exceptions disabled -- you may - // be exposing yourself to denial-of-service attacks, as attackers can easily construct schemas - // that are subtly inconsistent in a way that causes exceptions to be thrown either by - // SchemaLoader or by the dynamic API when the schemas are subsequently used. If you enable and - // properly catch exceptions, you should be OK -- assuming no bugs in the Cap'n Proto - // implementation, of course. - -public: - class LazyLoadCallback { - public: - virtual void load(const SchemaLoader& loader, uint64_t id) const = 0; - // Request that the schema node with the given ID be loaded into the given SchemaLoader. If - // the callback is able to find a schema for this ID, it should invoke `loadOnce()` on - // `loader` to load it. If no such node exists, it should simply do nothing and return. - // - // The callback is allowed to load schema nodes other than the one requested, e.g. because it - // expects they will be needed soon. - // - // If the `SchemaLoader` is used from multiple threads, the callback must be thread-safe. - // In particular, it's possible for multiple threads to invoke `load()` with the same ID. - // If the callback performs a large amount of work to look up IDs, it should be sure to - // de-dup these requests. - }; - - SchemaLoader(); - - SchemaLoader(const LazyLoadCallback& callback); - // Construct a SchemaLoader which will invoke the given callback when a schema node is requested - // that isn't already loaded. - - ~SchemaLoader() noexcept(false); - KJ_DISALLOW_COPY(SchemaLoader); - - Schema get(uint64_t id, schema::Brand::Reader brand = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Gets the schema for the given ID, throwing an exception if it isn't present. - // - // The returned schema may be invalidated if load() is called with a new schema for the same ID. - // In general, you should not call load() while a schema from this loader is in-use. - // - // `brand` and `scope` are used to determine brand bindings where relevant. `brand` gives - // parameter bindings for the target type's brand parameters that were specified at the reference - // site. `scope` specifies the scope in which the type ID appeared -- if `brand` itself contains - // parameter references or indicates that some parameters will be inherited, these will be - // interpreted within / inherited from `scope`. - - kj::Maybe tryGet(uint64_t id, schema::Brand::Reader bindings = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Like get() but doesn't throw. - - Schema getUnbound(uint64_t id) const; - // Gets a special version of the schema in which all brand parameters are "unbound". This means - // that if you look up a type via the Schema API, and it resolves to a brand parameter, the - // returned Type's getBrandParameter() method will return info about that parameter. Otherwise, - // normally, all brand parameters that aren't otherwise bound are assumed to simply be - // "AnyPointer". - - Type getType(schema::Type::Reader type, Schema scope = Schema()) const; - // Convenience method which interprets a schema::Type to produce a Type object. Implemented in - // terms of get(). - - Schema load(const schema::Node::Reader& reader); - // Loads the given schema node. Validates the node and throws an exception if invalid. This - // makes a copy of the schema, so the object passed in can be destroyed after this returns. - // - // If the node has any dependencies which are not already loaded, they will be initialized as - // stubs -- empty schemas of whichever kind is expected. - // - // If another schema for the given reader has already been seen, the loader will inspect both - // schemas to determine which one is newer, and use that that one. If the two versions are - // found to be incompatible, an exception is thrown. If the two versions differ but are - // compatible and the loader cannot determine which is newer (e.g., the only changes are renames), - // the existing schema will be preferred. Note that in any case, the loader will end up keeping - // around copies of both schemas, so you shouldn't repeatedly reload schemas into the same loader. - // - // The following properties of the schema node are validated: - // - Struct size and preferred list encoding are valid and consistent. - // - Struct members are fields or unions. - // - Union members are fields. - // - Field offsets are in-bounds. - // - Ordinals and codeOrders are sequential starting from zero. - // - Values are of the right union case to match their types. - // - // You should assume anything not listed above is NOT validated. In particular, things that are - // not validated now, but could be in the future, include but are not limited to: - // - Names. - // - Annotation values. (This is hard because the annotation declaration is not always - // available.) - // - Content of default/constant values of pointer type. (Validating these would require knowing - // their schema, but even if the schemas are available at validation time, they could be - // updated by a subsequent load(), invalidating existing values. Instead, these values are - // validated at the time they are used, as usual for Cap'n Proto objects.) - // - // Also note that unknown types are not considered invalid. Instead, the dynamic API returns - // a DynamicValue with type UNKNOWN for these. - - Schema loadOnce(const schema::Node::Reader& reader) const; - // Like `load()` but does nothing if a schema with the same ID is already loaded. In contrast, - // `load()` would attempt to compare the schemas and take the newer one. `loadOnce()` is safe - // to call even while concurrently using schemas from this loader. It should be considered an - // error to call `loadOnce()` with two non-identical schemas that share the same ID, although - // this error may or may not actually be detected by the implementation. - - template - void loadCompiledTypeAndDependencies(); - // Load the schema for the given compiled-in type and all of its dependencies. - // - // If you want to be able to cast a DynamicValue built from this SchemaLoader to the compiled-in - // type using as(), you must call this method before constructing the DynamicValue. Otherwise, - // as() will throw an exception complaining about type mismatch. - - kj::Array getAllLoaded() const; - // Get a complete list of all loaded schema nodes. It is particularly useful to call this after - // loadCompiledTypeAndDependencies() in order to get a flat list of all of T's transitive - // dependencies. - -private: - class Validator; - class CompatibilityChecker; - class Impl; - class InitializerImpl; - class BrandedInitializerImpl; - kj::MutexGuarded> impl; - - void loadNative(const _::RawSchema* nativeSchema); -}; - -template -inline void SchemaLoader::loadCompiledTypeAndDependencies() { - loadNative(&_::rawSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LOADER_H_ diff --git a/external/capnp/include/capnp/schema-parser.h b/external/capnp/include/capnp/schema-parser.h deleted file mode 100644 index 3322bbfbfb..0000000000 --- a/external/capnp/include/capnp/schema-parser.h +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_PARSER_H_ -#define CAPNP_SCHEMA_PARSER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema-loader.h" -#include - -namespace capnp { - -class ParsedSchema; -class SchemaFile; - -class SchemaParser { - // Parses `.capnp` files to produce `Schema` objects. - // - // This class is thread-safe, hence all its methods are const. - -public: - SchemaParser(); - ~SchemaParser() noexcept(false); - - ParsedSchema parseDiskFile(kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath) const; - // Parse a file located on disk. Throws an exception if the file dosen't exist. - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. (If the file has - // already been parsed, this will be ignored and the display name from the first time it was - // parsed will be kept.) - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). Must remain valid until the SchemaParser is destroyed. - // (If the file has already been parsed, this will be ignored and the import path from the - // first time it was parsed will be kept.) - // - // This method is a shortcut, equivalent to: - // parser.parseFile(SchemaFile::newDiskFile(displayName, diskPath, importPath))`; - // - // This method throws an exception if any errors are encountered in the file or in anything the - // file depends on. Note that merely importing another file does not count as a dependency on - // anything in the imported file -- only the imported types which are actually used are - // "dependencies". - - ParsedSchema parseFile(kj::Own&& file) const; - // Advanced interface for parsing a file that may or may not be located in any global namespace. - // Most users will prefer `parseDiskFile()`. - // - // If the file has already been parsed (that is, a SchemaFile that compares equal to this one - // was parsed previously), the existing schema will be returned again. - // - // This method reports errors by calling SchemaFile::reportError() on the file where the error - // is located. If that call does not throw an exception, `parseFile()` may in fact return - // normally. In this case, the result is a best-effort attempt to compile the schema, but it - // may be invalid or corrupt, and using it for anything may cause exceptions to be thrown. - - template - inline void loadCompiledTypeAndDependencies() { - // See SchemaLoader::loadCompiledTypeAndDependencies(). - getLoader().loadCompiledTypeAndDependencies(); - } - -private: - struct Impl; - class ModuleImpl; - kj::Own impl; - mutable bool hadErrors = false; - - ModuleImpl& getModuleImpl(kj::Own&& file) const; - SchemaLoader& getLoader(); - - friend class ParsedSchema; -}; - -class ParsedSchema: public Schema { - // ParsedSchema is an extension of Schema which also has the ability to look up nested nodes - // by name. See `SchemaParser`. - -public: - inline ParsedSchema(): parser(nullptr) {} - - kj::Maybe findNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or returns null if there is no such nested - // declaration. - - ParsedSchema getNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or throws an exception if there is no such nested - // declaration. - -private: - inline ParsedSchema(Schema inner, const SchemaParser& parser): Schema(inner), parser(&parser) {} - - const SchemaParser* parser; - friend class SchemaParser; -}; - -// ======================================================================================= -// Advanced API - -class SchemaFile { - // Abstract interface representing a schema file. You can implement this yourself in order to - // gain more control over how the compiler resolves imports and reads files. For the - // common case of files on disk or other global filesystem-like namespaces, use - // `SchemaFile::newDiskFile()`. - -public: - class FileReader { - public: - virtual bool exists(kj::StringPtr path) const = 0; - virtual kj::Array read(kj::StringPtr path) const = 0; - }; - - class DiskFileReader final: public FileReader { - // Implementation of FileReader that uses the local disk. Files are read using mmap() if - // possible. - - public: - static const DiskFileReader instance; - - bool exists(kj::StringPtr path) const override; - kj::Array read(kj::StringPtr path) const override; - }; - - static kj::Own newDiskFile( - kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath, - const FileReader& fileReader = DiskFileReader::instance); - // Construct a SchemaFile representing a file on disk (or located in the filesystem-like - // namespace represented by `fileReader`). - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). The array content must remain valid as long as the - // SchemaFile exists (which is at least as long as the SchemaParser that parses it exists). - // * `fileReader`: Allows you to use a filesystem other than the actual local disk. Although, - // if you find yourself using this, it may make more sense for you to implement SchemaFile - // yourself. - // - // The SchemaFile compares equal to any other SchemaFile that has exactly the same disk path, - // after canonicalization. - // - // The SchemaFile will throw an exception if any errors are reported. - - // ----------------------------------------------------------------- - // For more control, you can implement this interface. - - virtual kj::StringPtr getDisplayName() const = 0; - // Get the file's name, as it should appear in the schema. - - virtual kj::Array readContent() const = 0; - // Read the file's entire content and return it as a byte array. - - virtual kj::Maybe> import(kj::StringPtr path) const = 0; - // Resolve an import, relative to this file. - // - // `path` is exactly what appears between quotes after the `import` keyword in the source code. - // It is entirely up to the `SchemaFile` to decide how to map this to another file. Typically, - // a leading '/' means that the file is an "absolute" path and is searched for in some list of - // schema file repositories. On the other hand, a path that doesn't start with '/' is relative - // to the importing file. - - virtual bool operator==(const SchemaFile& other) const = 0; - virtual bool operator!=(const SchemaFile& other) const = 0; - virtual size_t hashCode() const = 0; - // Compare two SchemaFiles to see if they refer to the same underlying file. This is an - // optimization used to avoid the need to re-parse a file to check its ID. - - struct SourcePos { - uint byte; - uint line; - uint column; - }; - virtual void reportError(SourcePos start, SourcePos end, kj::StringPtr message) const = 0; - // Report that the file contains an error at the given interval. - -private: - class DiskSchemaFile; -}; - -} // namespace capnp - -#endif // CAPNP_SCHEMA_PARSER_H_ diff --git a/external/capnp/include/capnp/schema.capnp b/external/capnp/include/capnp/schema.capnp deleted file mode 100644 index 4bef693f6c..0000000000 --- a/external/capnp/include/capnp/schema.capnp +++ /dev/null @@ -1,498 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -using Cxx = import "/capnp/c++.capnp"; - -@0xa93fc509624c72d9; -$Cxx.namespace("capnp::schema"); - -using Id = UInt64; -# The globally-unique ID of a file, type, or annotation. - -struct Node { - id @0 :Id; - - displayName @1 :Text; - # Name to present to humans to identify this Node. You should not attempt to parse this. Its - # format could change. It is not guaranteed to be unique. - # - # (On Zooko's triangle, this is the node's nickname.) - - displayNamePrefixLength @2 :UInt32; - # If you want a shorter version of `displayName` (just naming this node, without its surrounding - # scope), chop off this many characters from the beginning of `displayName`. - - scopeId @3 :Id; - # ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back - # at this node, but robust code should avoid relying on this (and, in fact, group nodes are not - # listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is - # zero if the node has no parent, which is normally only the case with files, but should be - # allowed for any kind of node (in order to make runtime type generation easier). - - parameters @32 :List(Parameter); - # If this node is parameterized (generic), the list of parameters. Empty for non-generic types. - - isGeneric @33 :Bool; - # True if this node is generic, meaning that it or one of its parent scopes has a non-empty - # `parameters`. - - struct Parameter { - # Information about one of the node's parameters. - - name @0 :Text; - } - - nestedNodes @4 :List(NestedNode); - # List of nodes nested within this node, along with the names under which they were declared. - - struct NestedNode { - name @0 :Text; - # Unqualified symbol name. Unlike Node.displayName, this *can* be used programmatically. - # - # (On Zooko's triangle, this is the node's petname according to its parent scope.) - - id @1 :Id; - # ID of the nested node. Typically, the target node's scopeId points back to this node, but - # robust code should avoid relying on this. - } - - annotations @5 :List(Annotation); - # Annotations applied to this node. - - union { - # Info specific to each kind of node. - - file @6 :Void; - - struct :group { - dataWordCount @7 :UInt16; - # Size of the data section, in words. - - pointerCount @8 :UInt16; - # Size of the pointer section, in pointers (which are one word each). - - preferredListEncoding @9 :ElementSize; - # The preferred element size to use when encoding a list of this struct. If this is anything - # other than `inlineComposite` then the struct is one word or less in size and is a candidate - # for list packing optimization. - - isGroup @10 :Bool; - # If true, then this "struct" node is actually not an independent node, but merely represents - # some named union or group within a particular parent struct. This node's scopeId refers - # to the parent struct, which may itself be a union/group in yet another struct. - # - # All group nodes share the same dataWordCount and pointerCount as the top-level - # struct, and their fields live in the same ordinal and offset spaces as all other fields in - # the struct. - # - # Note that a named union is considered a special kind of group -- in fact, a named union - # is exactly equivalent to a group that contains nothing but an unnamed union. - - discriminantCount @11 :UInt16; - # Number of fields in this struct which are members of an anonymous union, and thus may - # overlap. If this is non-zero, then a 16-bit discriminant is present indicating which - # of the overlapping fields is active. This can never be 1 -- if it is non-zero, it must be - # two or more. - # - # Note that the fields of an unnamed union are considered fields of the scope containing the - # union -- an unnamed union is not its own group. So, a top-level struct may contain a - # non-zero discriminant count. Named unions, on the other hand, are equivalent to groups - # containing unnamed unions. So, a named union has its own independent schema node, with - # `isGroup` = true. - - discriminantOffset @12 :UInt32; - # If `discriminantCount` is non-zero, this is the offset of the union discriminant, in - # multiples of 16 bits. - - fields @13 :List(Field); - # Fields defined within this scope (either the struct's top-level fields, or the fields of - # a particular group; see `isGroup`). - # - # The fields are sorted by ordinal number, but note that because groups share the same - # ordinal space, the field's index in this list is not necessarily exactly its ordinal. - # On the other hand, the field's position in this list does remain the same even as the - # protocol evolves, since it is not possible to insert or remove an earlier ordinal. - # Therefore, for most use cases, if you want to identify a field by number, it may make the - # most sense to use the field's index in this list rather than its ordinal. - } - - enum :group { - enumerants@14 :List(Enumerant); - # Enumerants ordered by numeric value (ordinal). - } - - interface :group { - methods @15 :List(Method); - # Methods ordered by ordinal. - - superclasses @31 :List(Superclass); - # Superclasses of this interface. - } - - const :group { - type @16 :Type; - value @17 :Value; - } - - annotation :group { - type @18 :Type; - - targetsFile @19 :Bool; - targetsConst @20 :Bool; - targetsEnum @21 :Bool; - targetsEnumerant @22 :Bool; - targetsStruct @23 :Bool; - targetsField @24 :Bool; - targetsUnion @25 :Bool; - targetsGroup @26 :Bool; - targetsInterface @27 :Bool; - targetsMethod @28 :Bool; - targetsParam @29 :Bool; - targetsAnnotation @30 :Bool; - } - } -} - -struct Field { - # Schema for a field of a struct. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Indicates where this member appeared in the code, relative to other members. - # Code ordering may have semantic relevance -- programmers tend to place related fields - # together. So, using code ordering makes sense in human-readable formats where ordering is - # otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum - # value is count(members) - 1. Fields that are members of a union are only ordered relative to - # the other members of that union, so the maximum value there is count(union.members). - - annotations @2 :List(Annotation); - - const noDiscriminant :UInt16 = 0xffff; - - discriminantValue @3 :UInt16 = Field.noDiscriminant; - # If the field is in a union, this is the value which the union's discriminant should take when - # the field is active. If the field is not in a union, this is 0xffff. - - union { - slot :group { - # A regular, non-group, non-fixed-list field. - - offset @4 :UInt32; - # Offset, in units of the field's size, from the beginning of the section in which the field - # resides. E.g. for a UInt32 field, multiply this by 4 to get the byte offset from the - # beginning of the data section. - - type @5 :Type; - defaultValue @6 :Value; - - hadExplicitDefault @10 :Bool; - # Whether the default value was specified explicitly. Non-explicit default values are always - # zero or empty values. Usually, whether the default value was explicit shouldn't matter. - # The main use case for this flag is for structs representing method parameters: - # explicitly-defaulted parameters may be allowed to be omitted when calling the method. - } - - group :group { - # A group. - - typeId @7 :Id; - # The ID of the group's node. - } - } - - ordinal :union { - implicit @8 :Void; - explicit @9 :UInt16; - # The original ordinal number given to the field. You probably should NOT use this; if you need - # a numeric identifier for a field, use its position within the field array for its scope. - # The ordinal is given here mainly just so that the original schema text can be reproduced given - # the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. - } -} - -struct Enumerant { - # Schema for member of an enum. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the enumerants were declared in the code. - # Like Struct.Field.codeOrder. - - annotations @2 :List(Annotation); -} - -struct Superclass { - id @0 :Id; - brand @1 :Brand; -} - -struct Method { - # Schema for method of an interface. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the methods were declared in the code. - # Like Struct.Field.codeOrder. - - implicitParameters @7 :List(Node.Parameter); - # The parameters listed in [] (typically, type / generic parameters), whose bindings are intended - # to be inferred rather than specified explicitly, although not all languages support this. - - paramStructType @2 :Id; - # ID of the parameter struct type. If a named parameter list was specified in the method - # declaration (rather than a single struct parameter type) then a corresponding struct type is - # auto-generated. Such an auto-generated type will not be listed in the interface's - # `nestedNodes` and its `scopeId` will be zero -- it is completely detached from the namespace. - # (Awkwardly, it does of course inherit generic parameters from the method's scope, which makes - # this a situation where you can't just climb the scope chain to find where a particular - # generic parameter was introduced. Making the `scopeId` zero was a mistake.) - - paramBrand @5 :Brand; - # Brand of param struct type. - - resultStructType @3 :Id; - # ID of the return struct type; similar to `paramStructType`. - - resultBrand @6 :Brand; - # Brand of result struct type. - - annotations @4 :List(Annotation); -} - -struct Type { - # Represents a type expression. - - union { - # The ordinals intentionally match those of Value. - - void @0 :Void; - bool @1 :Void; - int8 @2 :Void; - int16 @3 :Void; - int32 @4 :Void; - int64 @5 :Void; - uint8 @6 :Void; - uint16 @7 :Void; - uint32 @8 :Void; - uint64 @9 :Void; - float32 @10 :Void; - float64 @11 :Void; - text @12 :Void; - data @13 :Void; - - list :group { - elementType @14 :Type; - } - - enum :group { - typeId @15 :Id; - brand @21 :Brand; - } - struct :group { - typeId @16 :Id; - brand @22 :Brand; - } - interface :group { - typeId @17 :Id; - brand @23 :Brand; - } - - anyPointer :union { - unconstrained :union { - # A regular AnyPointer. - # - # The name "unconstrained" means as opposed to constraining it to match a type parameter. - # In retrospect this name is probably a poor choice given that it may still be constrained - # to be a struct, list, or capability. - - anyKind @18 :Void; # truly AnyPointer - struct @25 :Void; # AnyStruct - list @26 :Void; # AnyList - capability @27 :Void; # Capability - } - - parameter :group { - # This is actually a reference to a type parameter defined within this scope. - - scopeId @19 :Id; - # ID of the generic type whose parameter we're referencing. This should be a parent of the - # current scope. - - parameterIndex @20 :UInt16; - # Index of the parameter within the generic type's parameter list. - } - - implicitMethodParameter :group { - # This is actually a reference to an implicit (generic) parameter of a method. The only - # legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. - - parameterIndex @24 :UInt16; - } - } - } -} - -struct Brand { - # Specifies bindings for parameters of generics. Since these bindings turn a generic into a - # non-generic, we call it the "brand". - - scopes @0 :List(Scope); - # For each of the target type and each of its parent scopes, a parameterization may be included - # in this list. If no parameterization is included for a particular relevant scope, then either - # that scope has no parameters or all parameters should be considered to be `AnyPointer`. - - struct Scope { - scopeId @0 :Id; - # ID of the scope to which these params apply. - - union { - bind @1 :List(Binding); - # List of parameter bindings. - - inherit @2 :Void; - # The place where this Brand appears is actually within this scope or a sub-scope, - # and the bindings for this scope should be inherited from the reference point. - } - } - - struct Binding { - union { - unbound @0 :Void; - type @1 :Type; - - # TODO(someday): Allow non-type parameters? Unsure if useful. - } - } -} - -struct Value { - # Represents a value, e.g. a field default value, constant value, or annotation value. - - union { - # The ordinals intentionally match those of Type. - - void @0 :Void; - bool @1 :Bool; - int8 @2 :Int8; - int16 @3 :Int16; - int32 @4 :Int32; - int64 @5 :Int64; - uint8 @6 :UInt8; - uint16 @7 :UInt16; - uint32 @8 :UInt32; - uint64 @9 :UInt64; - float32 @10 :Float32; - float64 @11 :Float64; - text @12 :Text; - data @13 :Data; - - list @14 :AnyPointer; - - enum @15 :UInt16; - struct @16 :AnyPointer; - - interface @17 :Void; - # The only interface value that can be represented statically is "null", whose methods always - # throw exceptions. - - anyPointer @18 :AnyPointer; - } -} - -struct Annotation { - # Describes an annotation applied to a declaration. Note AnnotationNode describes the - # annotation's declaration, while this describes a use of the annotation. - - id @0 :Id; - # ID of the annotation node. - - brand @2 :Brand; - # Brand of the annotation. - # - # Note that the annotation itself is not allowed to be parameterized, but its scope might be. - - value @1 :Value; -} - -enum ElementSize { - # Possible element sizes for encoded lists. These correspond exactly to the possible values of - # the 3-bit element size component of a list pointer. - - empty @0; # aka "void", but that's a keyword. - bit @1; - byte @2; - twoBytes @3; - fourBytes @4; - eightBytes @5; - pointer @6; - inlineComposite @7; -} - -struct CapnpVersion { - major @0 :UInt16; - minor @1 :UInt8; - micro @2 :UInt8; -} - -struct CodeGeneratorRequest { - capnpVersion @2 :CapnpVersion; - # Version of the `capnp` executable. Generally, code generators should ignore this, but the code - # generators that ship with `capnp` itself will print a warning if this mismatches since that - # probably indicates something is misconfigured. - # - # The first version of 'capnp' to set this was 0.6.0. So, if it's missing, the compiler version - # is older than that. - - nodes @0 :List(Node); - # All nodes parsed by the compiler, including for the files on the command line and their - # imports. - - requestedFiles @1 :List(RequestedFile); - # Files which were listed on the command line. - - struct RequestedFile { - id @0 :Id; - # ID of the file. - - filename @1 :Text; - # Name of the file as it appeared on the command-line (minus the src-prefix). You may use - # this to decide where to write the output. - - imports @2 :List(Import); - # List of all imported paths seen in this file. - - struct Import { - id @0 :Id; - # ID of the imported file. - - name @1 :Text; - # Name which *this* file used to refer to the foreign file. This may be a relative name. - # This information is provided because it might be useful for code generation, e.g. to - # generate #include directives in C++. We don't put this in Node.file because this - # information is only meaningful at compile time anyway. - # - # (On Zooko's triangle, this is the import's petname according to the importing file.) - } - } -} diff --git a/external/capnp/include/capnp/schema.capnp.h b/external/capnp/include/capnp/schema.capnp.h deleted file mode 100644 index 1f116c9f8f..0000000000 --- a/external/capnp/include/capnp/schema.capnp.h +++ /dev/null @@ -1,7861 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: schema.capnp - -#ifndef CAPNP_INCLUDED_a93fc509624c72d9_ -#define CAPNP_INCLUDED_a93fc509624c72d9_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(e682ab4cf923a417); -CAPNP_DECLARE_SCHEMA(b9521bccf10fa3b1); -CAPNP_DECLARE_SCHEMA(debf55bbfa0fc242); -CAPNP_DECLARE_SCHEMA(9ea0b19b37fb4435); -CAPNP_DECLARE_SCHEMA(b54ab3364333f598); -CAPNP_DECLARE_SCHEMA(e82753cff0c2218f); -CAPNP_DECLARE_SCHEMA(b18aa5ac7a0d9420); -CAPNP_DECLARE_SCHEMA(ec1619d4400a0290); -CAPNP_DECLARE_SCHEMA(9aad50a41f4af45f); -CAPNP_DECLARE_SCHEMA(97b14cbe7cfec712); -CAPNP_DECLARE_SCHEMA(c42305476bb4746f); -CAPNP_DECLARE_SCHEMA(cafccddb68db1d11); -CAPNP_DECLARE_SCHEMA(bb90d5c287870be6); -CAPNP_DECLARE_SCHEMA(978a7cebdc549a4d); -CAPNP_DECLARE_SCHEMA(a9962a9ed0a4d7f8); -CAPNP_DECLARE_SCHEMA(9500cce23b334d80); -CAPNP_DECLARE_SCHEMA(d07378ede1f9cc60); -CAPNP_DECLARE_SCHEMA(87e739250a60ea97); -CAPNP_DECLARE_SCHEMA(9e0e78711a7f87a9); -CAPNP_DECLARE_SCHEMA(ac3a6f60ef4cc6d3); -CAPNP_DECLARE_SCHEMA(ed8bca69f7fb0cbf); -CAPNP_DECLARE_SCHEMA(c2573fe8a23e49f1); -CAPNP_DECLARE_SCHEMA(8e3b5f79fe593656); -CAPNP_DECLARE_SCHEMA(9dd1f724f4614a85); -CAPNP_DECLARE_SCHEMA(baefc9120c56e274); -CAPNP_DECLARE_SCHEMA(903455f06065422b); -CAPNP_DECLARE_SCHEMA(abd73485a9636bc9); -CAPNP_DECLARE_SCHEMA(c863cd16969ee7fc); -CAPNP_DECLARE_SCHEMA(ce23dcd2d7b00c9b); -CAPNP_DECLARE_SCHEMA(f1c8950dab257542); -CAPNP_DECLARE_SCHEMA(d1958f7dba521926); -enum class ElementSize_d1958f7dba521926: uint16_t { - EMPTY, - BIT, - BYTE, - TWO_BYTES, - FOUR_BYTES, - EIGHT_BYTES, - POINTER, - INLINE_COMPOSITE, -}; -CAPNP_DECLARE_ENUM(ElementSize, d1958f7dba521926); -CAPNP_DECLARE_SCHEMA(d85d305b7d839963); -CAPNP_DECLARE_SCHEMA(bfc546f6210ad7ce); -CAPNP_DECLARE_SCHEMA(cfea0eb02e810062); -CAPNP_DECLARE_SCHEMA(ae504193122357e5); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace schema { - -struct Node { - Node() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - FILE, - STRUCT, - ENUM, - INTERFACE, - CONST, - ANNOTATION, - }; - struct Parameter; - struct NestedNode; - struct Struct; - struct Enum; - struct Interface; - struct Const; - struct Annotation; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e682ab4cf923a417, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b9521bccf10fa3b1, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::NestedNode { - NestedNode() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(debf55bbfa0fc242, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9ea0b19b37fb4435, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b54ab3364333f598, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e82753cff0c2218f, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Const { - Const() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b18aa5ac7a0d9420, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ec1619d4400a0290, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SLOT, - GROUP, - }; - static constexpr ::uint16_t NO_DISCRIMINANT = 65535u; - struct Slot; - struct Group; - struct Ordinal; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9aad50a41f4af45f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Slot { - Slot() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c42305476bb4746f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Group { - Group() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cafccddb68db1d11, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Ordinal { - Ordinal() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPLICIT, - EXPLICIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bb90d5c287870be6, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Enumerant { - Enumerant() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(978a7cebdc549a4d, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Superclass { - Superclass() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(a9962a9ed0a4d7f8, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Method { - Method() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9500cce23b334d80, 3, 5) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type { - Type() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - struct List; - struct Enum; - struct Struct; - struct Interface; - struct AnyPointer; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d07378ede1f9cc60, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::List { - List() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(87e739250a60ea97, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e0e78711a7f87a9, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ac3a6f60ef4cc6d3, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ed8bca69f7fb0cbf, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer { - AnyPointer() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNCONSTRAINED, - PARAMETER, - IMPLICIT_METHOD_PARAMETER, - }; - struct Unconstrained; - struct Parameter; - struct ImplicitMethodParameter; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c2573fe8a23e49f1, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Unconstrained { - Unconstrained() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - ANY_KIND, - STRUCT, - LIST, - CAPABILITY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8e3b5f79fe593656, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9dd1f724f4614a85, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::ImplicitMethodParameter { - ImplicitMethodParameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(baefc9120c56e274, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand { - Brand() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Scope; - struct Binding; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(903455f06065422b, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Scope { - Scope() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - BIND, - INHERIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(abd73485a9636bc9, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Binding { - Binding() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNBOUND, - TYPE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c863cd16969ee7fc, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Value { - Value() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ce23dcd2d7b00c9b, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f1c8950dab257542, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -typedef ::capnp::schemas::ElementSize_d1958f7dba521926 ElementSize; - -struct CapnpVersion { - CapnpVersion() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d85d305b7d839963, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest { - CodeGeneratorRequest() = delete; - - class Reader; - class Builder; - class Pipeline; - struct RequestedFile; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bfc546f6210ad7ce, 0, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile { - RequestedFile() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Import; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cfea0eb02e810062, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile::Import { - Import() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ae504193122357e5, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Node::Reader { -public: - typedef Node Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getId() const; - - inline bool hasDisplayName() const; - inline ::capnp::Text::Reader getDisplayName() const; - - inline ::uint32_t getDisplayNamePrefixLength() const; - - inline ::uint64_t getScopeId() const; - - inline bool hasNestedNodes() const; - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader getNestedNodes() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool isFile() const; - inline ::capnp::Void getFile() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isConst() const; - inline typename Const::Reader getConst() const; - - inline bool isAnnotation() const; - inline typename Annotation::Reader getAnnotation() const; - - inline bool hasParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getParameters() const; - - inline bool getIsGeneric() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Builder { -public: - typedef Node Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasDisplayName(); - inline ::capnp::Text::Builder getDisplayName(); - inline void setDisplayName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initDisplayName(unsigned int size); - inline void adoptDisplayName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownDisplayName(); - - inline ::uint32_t getDisplayNamePrefixLength(); - inline void setDisplayNamePrefixLength( ::uint32_t value); - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool hasNestedNodes(); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder getNestedNodes(); - inline void setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder initNestedNodes(unsigned int size); - inline void adoptNestedNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> disownNestedNodes(); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool isFile(); - inline ::capnp::Void getFile(); - inline void setFile( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isConst(); - inline typename Const::Builder getConst(); - inline typename Const::Builder initConst(); - - inline bool isAnnotation(); - inline typename Annotation::Builder getAnnotation(); - inline typename Annotation::Builder initAnnotation(); - - inline bool hasParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getParameters(); - inline void setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initParameters(unsigned int size); - inline void adoptParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownParameters(); - - inline bool getIsGeneric(); - inline void setIsGeneric(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Pipeline { -public: - typedef Node Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::NestedNode::Reader { -public: - typedef NestedNode Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint64_t getId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::NestedNode::Builder { -public: - typedef NestedNode Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::NestedNode::Pipeline { -public: - typedef NestedNode Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount() const; - - inline ::uint16_t getPointerCount() const; - - inline ::capnp::schema::ElementSize getPreferredListEncoding() const; - - inline bool getIsGroup() const; - - inline ::uint16_t getDiscriminantCount() const; - - inline ::uint32_t getDiscriminantOffset() const; - - inline bool hasFields() const; - inline ::capnp::List< ::capnp::schema::Field>::Reader getFields() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount(); - inline void setDataWordCount( ::uint16_t value); - - inline ::uint16_t getPointerCount(); - inline void setPointerCount( ::uint16_t value); - - inline ::capnp::schema::ElementSize getPreferredListEncoding(); - inline void setPreferredListEncoding( ::capnp::schema::ElementSize value); - - inline bool getIsGroup(); - inline void setIsGroup(bool value); - - inline ::uint16_t getDiscriminantCount(); - inline void setDiscriminantCount( ::uint16_t value); - - inline ::uint32_t getDiscriminantOffset(); - inline void setDiscriminantOffset( ::uint32_t value); - - inline bool hasFields(); - inline ::capnp::List< ::capnp::schema::Field>::Builder getFields(); - inline void setFields( ::capnp::List< ::capnp::schema::Field>::Reader value); - inline ::capnp::List< ::capnp::schema::Field>::Builder initFields(unsigned int size); - inline void adoptFields(::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> disownFields(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasEnumerants() const; - inline ::capnp::List< ::capnp::schema::Enumerant>::Reader getEnumerants() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasEnumerants(); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder getEnumerants(); - inline void setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder initEnumerants(unsigned int size); - inline void adoptEnumerants(::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> disownEnumerants(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasMethods() const; - inline ::capnp::List< ::capnp::schema::Method>::Reader getMethods() const; - - inline bool hasSuperclasses() const; - inline ::capnp::List< ::capnp::schema::Superclass>::Reader getSuperclasses() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasMethods(); - inline ::capnp::List< ::capnp::schema::Method>::Builder getMethods(); - inline void setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value); - inline ::capnp::List< ::capnp::schema::Method>::Builder initMethods(unsigned int size); - inline void adoptMethods(::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> disownMethods(); - - inline bool hasSuperclasses(); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder getSuperclasses(); - inline void setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder initSuperclasses(unsigned int size); - inline void adoptSuperclasses(::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> disownSuperclasses(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Const::Reader { -public: - typedef Const Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Const::Builder { -public: - typedef Const Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Const::Pipeline { -public: - typedef Const Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool getTargetsFile() const; - - inline bool getTargetsConst() const; - - inline bool getTargetsEnum() const; - - inline bool getTargetsEnumerant() const; - - inline bool getTargetsStruct() const; - - inline bool getTargetsField() const; - - inline bool getTargetsUnion() const; - - inline bool getTargetsGroup() const; - - inline bool getTargetsInterface() const; - - inline bool getTargetsMethod() const; - - inline bool getTargetsParam() const; - - inline bool getTargetsAnnotation() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool getTargetsFile(); - inline void setTargetsFile(bool value); - - inline bool getTargetsConst(); - inline void setTargetsConst(bool value); - - inline bool getTargetsEnum(); - inline void setTargetsEnum(bool value); - - inline bool getTargetsEnumerant(); - inline void setTargetsEnumerant(bool value); - - inline bool getTargetsStruct(); - inline void setTargetsStruct(bool value); - - inline bool getTargetsField(); - inline void setTargetsField(bool value); - - inline bool getTargetsUnion(); - inline void setTargetsUnion(bool value); - - inline bool getTargetsGroup(); - inline void setTargetsGroup(bool value); - - inline bool getTargetsInterface(); - inline void setTargetsInterface(bool value); - - inline bool getTargetsMethod(); - inline void setTargetsMethod(bool value); - - inline bool getTargetsParam(); - inline void setTargetsParam(bool value); - - inline bool getTargetsAnnotation(); - inline void setTargetsAnnotation(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline ::uint16_t getDiscriminantValue() const; - - inline bool isSlot() const; - inline typename Slot::Reader getSlot() const; - - inline bool isGroup() const; - inline typename Group::Reader getGroup() const; - - inline typename Ordinal::Reader getOrdinal() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline ::uint16_t getDiscriminantValue(); - inline void setDiscriminantValue( ::uint16_t value); - - inline bool isSlot(); - inline typename Slot::Builder getSlot(); - inline typename Slot::Builder initSlot(); - - inline bool isGroup(); - inline typename Group::Builder getGroup(); - inline typename Group::Builder initGroup(); - - inline typename Ordinal::Builder getOrdinal(); - inline typename Ordinal::Builder initOrdinal(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename Ordinal::Pipeline getOrdinal(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Slot::Reader { -public: - typedef Slot Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset() const; - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasDefaultValue() const; - inline ::capnp::schema::Value::Reader getDefaultValue() const; - - inline bool getHadExplicitDefault() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Slot::Builder { -public: - typedef Slot Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset(); - inline void setOffset( ::uint32_t value); - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasDefaultValue(); - inline ::capnp::schema::Value::Builder getDefaultValue(); - inline void setDefaultValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initDefaultValue(); - inline void adoptDefaultValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownDefaultValue(); - - inline bool getHadExplicitDefault(); - inline void setHadExplicitDefault(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Slot::Pipeline { -public: - typedef Slot Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getDefaultValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Group::Reader { -public: - typedef Group Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Group::Builder { -public: - typedef Group Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Group::Pipeline { -public: - typedef Group Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Ordinal::Reader { -public: - typedef Ordinal Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImplicit() const; - inline ::capnp::Void getImplicit() const; - - inline bool isExplicit() const; - inline ::uint16_t getExplicit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Ordinal::Builder { -public: - typedef Ordinal Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImplicit(); - inline ::capnp::Void getImplicit(); - inline void setImplicit( ::capnp::Void value = ::capnp::VOID); - - inline bool isExplicit(); - inline ::uint16_t getExplicit(); - inline void setExplicit( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Ordinal::Pipeline { -public: - typedef Ordinal Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Enumerant::Reader { -public: - typedef Enumerant Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Enumerant::Builder { -public: - typedef Enumerant Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Enumerant::Pipeline { -public: - typedef Enumerant Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Superclass::Reader { -public: - typedef Superclass Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Superclass::Builder { -public: - typedef Superclass Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Superclass::Pipeline { -public: - typedef Superclass Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Method::Reader { -public: - typedef Method Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline ::uint64_t getParamStructType() const; - - inline ::uint64_t getResultStructType() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool hasParamBrand() const; - inline ::capnp::schema::Brand::Reader getParamBrand() const; - - inline bool hasResultBrand() const; - inline ::capnp::schema::Brand::Reader getResultBrand() const; - - inline bool hasImplicitParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getImplicitParameters() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Method::Builder { -public: - typedef Method Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline ::uint64_t getParamStructType(); - inline void setParamStructType( ::uint64_t value); - - inline ::uint64_t getResultStructType(); - inline void setResultStructType( ::uint64_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool hasParamBrand(); - inline ::capnp::schema::Brand::Builder getParamBrand(); - inline void setParamBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initParamBrand(); - inline void adoptParamBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownParamBrand(); - - inline bool hasResultBrand(); - inline ::capnp::schema::Brand::Builder getResultBrand(); - inline void setResultBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initResultBrand(); - inline void adoptResultBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownResultBrand(); - - inline bool hasImplicitParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getImplicitParameters(); - inline void setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initImplicitParameters(unsigned int size); - inline void adoptImplicitParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownImplicitParameters(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Method::Pipeline { -public: - typedef Method Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getParamBrand(); - inline ::capnp::schema::Brand::Pipeline getResultBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Reader { -public: - typedef Type Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline ::capnp::Void getBool() const; - - inline bool isInt8() const; - inline ::capnp::Void getInt8() const; - - inline bool isInt16() const; - inline ::capnp::Void getInt16() const; - - inline bool isInt32() const; - inline ::capnp::Void getInt32() const; - - inline bool isInt64() const; - inline ::capnp::Void getInt64() const; - - inline bool isUint8() const; - inline ::capnp::Void getUint8() const; - - inline bool isUint16() const; - inline ::capnp::Void getUint16() const; - - inline bool isUint32() const; - inline ::capnp::Void getUint32() const; - - inline bool isUint64() const; - inline ::capnp::Void getUint64() const; - - inline bool isFloat32() const; - inline ::capnp::Void getFloat32() const; - - inline bool isFloat64() const; - inline ::capnp::Void getFloat64() const; - - inline bool isText() const; - inline ::capnp::Void getText() const; - - inline bool isData() const; - inline ::capnp::Void getData() const; - - inline bool isList() const; - inline typename List::Reader getList() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isAnyPointer() const; - inline typename AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Builder { -public: - typedef Type Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline ::capnp::Void getBool(); - inline void setBool( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt8(); - inline ::capnp::Void getInt8(); - inline void setInt8( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt16(); - inline ::capnp::Void getInt16(); - inline void setInt16( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt32(); - inline ::capnp::Void getInt32(); - inline void setInt32( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt64(); - inline ::capnp::Void getInt64(); - inline void setInt64( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint8(); - inline ::capnp::Void getUint8(); - inline void setUint8( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint16(); - inline ::capnp::Void getUint16(); - inline void setUint16( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint32(); - inline ::capnp::Void getUint32(); - inline void setUint32( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint64(); - inline ::capnp::Void getUint64(); - inline void setUint64( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat32(); - inline ::capnp::Void getFloat32(); - inline void setFloat32( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat64(); - inline ::capnp::Void getFloat64(); - inline void setFloat64( ::capnp::Void value = ::capnp::VOID); - - inline bool isText(); - inline ::capnp::Void getText(); - inline void setText( ::capnp::Void value = ::capnp::VOID); - - inline bool isData(); - inline ::capnp::Void getData(); - inline void setData( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline typename List::Builder getList(); - inline typename List::Builder initList(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isAnyPointer(); - inline typename AnyPointer::Builder getAnyPointer(); - inline typename AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Pipeline { -public: - typedef Type Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::List::Reader { -public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasElementType() const; - inline ::capnp::schema::Type::Reader getElementType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::List::Builder { -public: - typedef List Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasElementType(); - inline ::capnp::schema::Type::Builder getElementType(); - inline void setElementType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initElementType(); - inline void adoptElementType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownElementType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::List::Pipeline { -public: - typedef List Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getElementType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Reader { -public: - typedef AnyPointer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnconstrained() const; - inline typename Unconstrained::Reader getUnconstrained() const; - - inline bool isParameter() const; - inline typename Parameter::Reader getParameter() const; - - inline bool isImplicitMethodParameter() const; - inline typename ImplicitMethodParameter::Reader getImplicitMethodParameter() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Builder { -public: - typedef AnyPointer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnconstrained(); - inline typename Unconstrained::Builder getUnconstrained(); - inline typename Unconstrained::Builder initUnconstrained(); - - inline bool isParameter(); - inline typename Parameter::Builder getParameter(); - inline typename Parameter::Builder initParameter(); - - inline bool isImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder getImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder initImplicitMethodParameter(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Pipeline { -public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Unconstrained::Reader { -public: - typedef Unconstrained Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isAnyKind() const; - inline ::capnp::Void getAnyKind() const; - - inline bool isStruct() const; - inline ::capnp::Void getStruct() const; - - inline bool isList() const; - inline ::capnp::Void getList() const; - - inline bool isCapability() const; - inline ::capnp::Void getCapability() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Unconstrained::Builder { -public: - typedef Unconstrained Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isAnyKind(); - inline ::capnp::Void getAnyKind(); - inline void setAnyKind( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline ::capnp::Void getStruct(); - inline void setStruct( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline ::capnp::Void getList(); - inline void setList( ::capnp::Void value = ::capnp::VOID); - - inline bool isCapability(); - inline ::capnp::Void getCapability(); - inline void setCapability( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Unconstrained::Pipeline { -public: - typedef Unconstrained Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId() const; - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::ImplicitMethodParameter::Reader { -public: - typedef ImplicitMethodParameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::ImplicitMethodParameter::Builder { -public: - typedef ImplicitMethodParameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::ImplicitMethodParameter::Pipeline { -public: - typedef ImplicitMethodParameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Reader { -public: - typedef Brand Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasScopes() const; - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader getScopes() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Builder { -public: - typedef Brand Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasScopes(); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder getScopes(); - inline void setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder initScopes(unsigned int size); - inline void adoptScopes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> disownScopes(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Pipeline { -public: - typedef Brand Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Scope::Reader { -public: - typedef Scope Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getScopeId() const; - - inline bool isBind() const; - inline bool hasBind() const; - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader getBind() const; - - inline bool isInherit() const; - inline ::capnp::Void getInherit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Scope::Builder { -public: - typedef Scope Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool isBind(); - inline bool hasBind(); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder getBind(); - inline void setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder initBind(unsigned int size); - inline void adoptBind(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> disownBind(); - - inline bool isInherit(); - inline ::capnp::Void getInherit(); - inline void setInherit( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Scope::Pipeline { -public: - typedef Scope Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Binding::Reader { -public: - typedef Binding Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnbound() const; - inline ::capnp::Void getUnbound() const; - - inline bool isType() const; - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Binding::Builder { -public: - typedef Binding Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnbound(); - inline ::capnp::Void getUnbound(); - inline void setUnbound( ::capnp::Void value = ::capnp::VOID); - - inline bool isType(); - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Binding::Pipeline { -public: - typedef Binding Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Value::Reader { -public: - typedef Value Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline bool getBool() const; - - inline bool isInt8() const; - inline ::int8_t getInt8() const; - - inline bool isInt16() const; - inline ::int16_t getInt16() const; - - inline bool isInt32() const; - inline ::int32_t getInt32() const; - - inline bool isInt64() const; - inline ::int64_t getInt64() const; - - inline bool isUint8() const; - inline ::uint8_t getUint8() const; - - inline bool isUint16() const; - inline ::uint16_t getUint16() const; - - inline bool isUint32() const; - inline ::uint32_t getUint32() const; - - inline bool isUint64() const; - inline ::uint64_t getUint64() const; - - inline bool isFloat32() const; - inline float getFloat32() const; - - inline bool isFloat64() const; - inline double getFloat64() const; - - inline bool isText() const; - inline bool hasText() const; - inline ::capnp::Text::Reader getText() const; - - inline bool isData() const; - inline bool hasData() const; - inline ::capnp::Data::Reader getData() const; - - inline bool isList() const; - inline bool hasList() const; - inline ::capnp::AnyPointer::Reader getList() const; - - inline bool isEnum() const; - inline ::uint16_t getEnum() const; - - inline bool isStruct() const; - inline bool hasStruct() const; - inline ::capnp::AnyPointer::Reader getStruct() const; - - inline bool isInterface() const; - inline ::capnp::Void getInterface() const; - - inline bool isAnyPointer() const; - inline bool hasAnyPointer() const; - inline ::capnp::AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Value::Builder { -public: - typedef Value Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline bool getBool(); - inline void setBool(bool value); - - inline bool isInt8(); - inline ::int8_t getInt8(); - inline void setInt8( ::int8_t value); - - inline bool isInt16(); - inline ::int16_t getInt16(); - inline void setInt16( ::int16_t value); - - inline bool isInt32(); - inline ::int32_t getInt32(); - inline void setInt32( ::int32_t value); - - inline bool isInt64(); - inline ::int64_t getInt64(); - inline void setInt64( ::int64_t value); - - inline bool isUint8(); - inline ::uint8_t getUint8(); - inline void setUint8( ::uint8_t value); - - inline bool isUint16(); - inline ::uint16_t getUint16(); - inline void setUint16( ::uint16_t value); - - inline bool isUint32(); - inline ::uint32_t getUint32(); - inline void setUint32( ::uint32_t value); - - inline bool isUint64(); - inline ::uint64_t getUint64(); - inline void setUint64( ::uint64_t value); - - inline bool isFloat32(); - inline float getFloat32(); - inline void setFloat32(float value); - - inline bool isFloat64(); - inline double getFloat64(); - inline void setFloat64(double value); - - inline bool isText(); - inline bool hasText(); - inline ::capnp::Text::Builder getText(); - inline void setText( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initText(unsigned int size); - inline void adoptText(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownText(); - - inline bool isData(); - inline bool hasData(); - inline ::capnp::Data::Builder getData(); - inline void setData( ::capnp::Data::Reader value); - inline ::capnp::Data::Builder initData(unsigned int size); - inline void adoptData(::capnp::Orphan< ::capnp::Data>&& value); - inline ::capnp::Orphan< ::capnp::Data> disownData(); - - inline bool isList(); - inline bool hasList(); - inline ::capnp::AnyPointer::Builder getList(); - inline ::capnp::AnyPointer::Builder initList(); - - inline bool isEnum(); - inline ::uint16_t getEnum(); - inline void setEnum( ::uint16_t value); - - inline bool isStruct(); - inline bool hasStruct(); - inline ::capnp::AnyPointer::Builder getStruct(); - inline ::capnp::AnyPointer::Builder initStruct(); - - inline bool isInterface(); - inline ::capnp::Void getInterface(); - inline void setInterface( ::capnp::Void value = ::capnp::VOID); - - inline bool isAnyPointer(); - inline bool hasAnyPointer(); - inline ::capnp::AnyPointer::Builder getAnyPointer(); - inline ::capnp::AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Value::Pipeline { -public: - typedef Value Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Value::Pipeline getValue(); - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapnpVersion::Reader { -public: - typedef CapnpVersion Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor() const; - - inline ::uint8_t getMinor() const; - - inline ::uint8_t getMicro() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapnpVersion::Builder { -public: - typedef CapnpVersion Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor(); - inline void setMajor( ::uint16_t value); - - inline ::uint8_t getMinor(); - inline void setMinor( ::uint8_t value); - - inline ::uint8_t getMicro(); - inline void setMicro( ::uint8_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapnpVersion::Pipeline { -public: - typedef CapnpVersion Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::Reader { -public: - typedef CodeGeneratorRequest Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasNodes() const; - inline ::capnp::List< ::capnp::schema::Node>::Reader getNodes() const; - - inline bool hasRequestedFiles() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader getRequestedFiles() const; - - inline bool hasCapnpVersion() const; - inline ::capnp::schema::CapnpVersion::Reader getCapnpVersion() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::Builder { -public: - typedef CodeGeneratorRequest Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasNodes(); - inline ::capnp::List< ::capnp::schema::Node>::Builder getNodes(); - inline void setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value); - inline ::capnp::List< ::capnp::schema::Node>::Builder initNodes(unsigned int size); - inline void adoptNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> disownNodes(); - - inline bool hasRequestedFiles(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder getRequestedFiles(); - inline void setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder initRequestedFiles(unsigned int size); - inline void adoptRequestedFiles(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> disownRequestedFiles(); - - inline bool hasCapnpVersion(); - inline ::capnp::schema::CapnpVersion::Builder getCapnpVersion(); - inline void setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value); - inline ::capnp::schema::CapnpVersion::Builder initCapnpVersion(); - inline void adoptCapnpVersion(::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value); - inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> disownCapnpVersion(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::Pipeline { -public: - typedef CodeGeneratorRequest Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::CapnpVersion::Pipeline getCapnpVersion(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Reader { -public: - typedef RequestedFile Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasFilename() const; - inline ::capnp::Text::Reader getFilename() const; - - inline bool hasImports() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader getImports() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Builder { -public: - typedef RequestedFile Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasFilename(); - inline ::capnp::Text::Builder getFilename(); - inline void setFilename( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFilename(unsigned int size); - inline void adoptFilename(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFilename(); - - inline bool hasImports(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder getImports(); - inline void setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder initImports(unsigned int size); - inline void adoptImports(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> disownImports(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Pipeline { -public: - typedef RequestedFile Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Import::Reader { -public: - typedef Import Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Import::Builder { -public: - typedef Import Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Import::Pipeline { -public: - typedef Import Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::schema::Node::Which Node::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Node::Which Node::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasDisplayName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasDisplayName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Reader::getDisplayName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Builder::getDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setDisplayName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Builder::initDisplayName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptDisplayName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Builder::disownDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Node::Reader::getDisplayNamePrefixLength() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Builder::getDisplayNamePrefixLength() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setDisplayNamePrefixLength( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Node::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasNestedNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasNestedNodes() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader Node::Reader::getNestedNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::getNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::initNestedNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptNestedNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> Node::Builder::disownNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Node::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Node::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::isFile() const { - return which() == Node::FILE; -} -inline bool Node::Builder::isFile() { - return which() == Node::FILE; -} -inline ::capnp::Void Node::Reader::getFile() const { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Node::Builder::getFile() { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setFile( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::FILE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::isStruct() const { - return which() == Node::STRUCT; -} -inline bool Node::Builder::isStruct() { - return which() == Node::STRUCT; -} -inline typename Node::Struct::Reader Node::Reader::getStruct() const { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Reader(_reader); -} -inline typename Node::Struct::Builder Node::Builder::getStruct() { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Builder(_builder); -} -inline typename Node::Struct::Builder Node::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::STRUCT); - _builder.setDataField< ::uint16_t>(::capnp::bounded<7>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<12>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<13>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<224>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<15>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint32_t>(::capnp::bounded<8>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Struct::Builder(_builder); -} -inline bool Node::Reader::isEnum() const { - return which() == Node::ENUM; -} -inline bool Node::Builder::isEnum() { - return which() == Node::ENUM; -} -inline typename Node::Enum::Reader Node::Reader::getEnum() const { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Reader(_reader); -} -inline typename Node::Enum::Builder Node::Builder::getEnum() { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Builder(_builder); -} -inline typename Node::Enum::Builder Node::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ENUM); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Enum::Builder(_builder); -} -inline bool Node::Reader::isInterface() const { - return which() == Node::INTERFACE; -} -inline bool Node::Builder::isInterface() { - return which() == Node::INTERFACE; -} -inline typename Node::Interface::Reader Node::Reader::getInterface() const { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Reader(_reader); -} -inline typename Node::Interface::Builder Node::Builder::getInterface() { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Builder(_builder); -} -inline typename Node::Interface::Builder Node::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::INTERFACE); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Interface::Builder(_builder); -} -inline bool Node::Reader::isConst() const { - return which() == Node::CONST; -} -inline bool Node::Builder::isConst() { - return which() == Node::CONST; -} -inline typename Node::Const::Reader Node::Reader::getConst() const { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Reader(_reader); -} -inline typename Node::Const::Builder Node::Builder::getConst() { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Builder(_builder); -} -inline typename Node::Const::Builder Node::Builder::initConst() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::CONST); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Const::Builder(_builder); -} -inline bool Node::Reader::isAnnotation() const { - return which() == Node::ANNOTATION; -} -inline bool Node::Builder::isAnnotation() { - return which() == Node::ANNOTATION; -} -inline typename Node::Annotation::Reader Node::Reader::getAnnotation() const { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Reader(_reader); -} -inline typename Node::Annotation::Builder Node::Builder::getAnnotation() { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Builder(_builder); -} -inline typename Node::Annotation::Builder Node::Builder::initAnnotation() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ANNOTATION); - _builder.setDataField(::capnp::bounded<112>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<113>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<114>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<115>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<116>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<117>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<118>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<119>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<120>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<121>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<122>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<123>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Annotation::Builder(_builder); -} -inline bool Node::Reader::hasParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasParameters() { - return !_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Node::Reader::getParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::getParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::initParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Node::Builder::disownParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::getIsGeneric() const { - return _reader.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} - -inline bool Node::Builder::getIsGeneric() { - return _builder.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setIsGeneric(bool value) { - _builder.setDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Parameter::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Parameter::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Parameter::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Parameter::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Parameter::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Parameter::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Node::NestedNode::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::NestedNode::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::NestedNode::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::NestedNode::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::NestedNode::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::NestedNode::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Node::NestedNode::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::NestedNode::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::NestedNode::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDataWordCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDataWordCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDataWordCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getPointerCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getPointerCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPointerCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::ElementSize Node::Struct::Reader::getPreferredListEncoding() const { - return _reader.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} - -inline ::capnp::schema::ElementSize Node::Struct::Builder::getPreferredListEncoding() { - return _builder.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPreferredListEncoding( ::capnp::schema::ElementSize value) { - _builder.setDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::getIsGroup() const { - return _reader.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} - -inline bool Node::Struct::Builder::getIsGroup() { - return _builder.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setIsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDiscriminantCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDiscriminantCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Node::Struct::Reader::getDiscriminantOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Struct::Builder::getDiscriminantOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::hasFields() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Struct::Builder::hasFields() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Field>::Reader Node::Struct::Reader::getFields() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::getFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Struct::Builder::setFields( ::capnp::List< ::capnp::schema::Field>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::initFields(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Struct::Builder::adoptFields( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> Node::Struct::Builder::disownFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Enum::Reader::hasEnumerants() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Enum::Builder::hasEnumerants() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Reader Node::Enum::Reader::getEnumerants() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::getEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Enum::Builder::setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::initEnumerants(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Enum::Builder::adoptEnumerants( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> Node::Enum::Builder::disownEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasMethods() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasMethods() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Method>::Reader Node::Interface::Reader::getMethods() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::getMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::initMethods(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptMethods( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> Node::Interface::Builder::disownMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasSuperclasses() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasSuperclasses() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Reader Node::Interface::Reader::getSuperclasses() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::getSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::initSuperclasses(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptSuperclasses( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> Node::Interface::Builder::disownSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Const::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Const::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Const::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Node::Const::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Node::Const::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(4)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Node::Const::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Annotation::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Annotation::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Annotation::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Annotation::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Annotation::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Annotation::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::getTargetsFile() const { - return _reader.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsFile() { - return _builder.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsFile(bool value) { - _builder.setDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsConst() const { - return _reader.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsConst() { - return _builder.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsConst(bool value) { - _builder.setDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnum() const { - return _reader.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnum() { - return _builder.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnum(bool value) { - _builder.setDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnumerant() const { - return _reader.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnumerant() { - return _builder.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnumerant(bool value) { - _builder.setDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsStruct() const { - return _reader.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsStruct() { - return _builder.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsStruct(bool value) { - _builder.setDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsField() const { - return _reader.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsField() { - return _builder.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsField(bool value) { - _builder.setDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsUnion() const { - return _reader.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsUnion() { - return _builder.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsUnion(bool value) { - _builder.setDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsGroup() const { - return _reader.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsGroup() { - return _builder.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsInterface() const { - return _reader.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsInterface() { - return _builder.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsInterface(bool value) { - _builder.setDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsMethod() const { - return _reader.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsMethod() { - return _builder.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsMethod(bool value) { - _builder.setDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsParam() const { - return _reader.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsParam() { - return _builder.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsParam(bool value) { - _builder.setDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsAnnotation() const { - return _reader.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsAnnotation() { - return _builder.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsAnnotation(bool value) { - _builder.setDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Which Field::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Which Field::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Field::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Field::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getDiscriminantValue() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} - -inline ::uint16_t Field::Builder::getDiscriminantValue() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} -inline void Field::Builder::setDiscriminantValue( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value, 65535u); -} - -inline bool Field::Reader::isSlot() const { - return which() == Field::SLOT; -} -inline bool Field::Builder::isSlot() { - return which() == Field::SLOT; -} -inline typename Field::Slot::Reader Field::Reader::getSlot() const { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Reader(_reader); -} -inline typename Field::Slot::Builder Field::Builder::getSlot() { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Builder(_builder); -} -inline typename Field::Slot::Builder Field::Builder::initSlot() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::SLOT); - _builder.setDataField< ::uint32_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<128>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Field::Slot::Builder(_builder); -} -inline bool Field::Reader::isGroup() const { - return which() == Field::GROUP; -} -inline bool Field::Builder::isGroup() { - return which() == Field::GROUP; -} -inline typename Field::Group::Reader Field::Reader::getGroup() const { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Reader(_reader); -} -inline typename Field::Group::Builder Field::Builder::getGroup() { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Group::Builder Field::Builder::initGroup() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::GROUP); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Ordinal::Reader Field::Reader::getOrdinal() const { - return typename Field::Ordinal::Reader(_reader); -} -inline typename Field::Ordinal::Builder Field::Builder::getOrdinal() { - return typename Field::Ordinal::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Field::Ordinal::Pipeline Field::Pipeline::getOrdinal() { - return typename Field::Ordinal::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Field::Ordinal::Builder Field::Builder::initOrdinal() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); - return typename Field::Ordinal::Builder(_builder); -} -inline ::uint32_t Field::Slot::Reader::getOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Field::Slot::Builder::getOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Slot::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Field::Slot::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Field::Slot::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Field::Slot::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::hasDefaultValue() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasDefaultValue() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Field::Slot::Reader::getDefaultValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::getDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Field::Slot::Pipeline::getDefaultValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setDefaultValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::initDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptDefaultValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Field::Slot::Builder::disownDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::getHadExplicitDefault() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Field::Slot::Builder::getHadExplicitDefault() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setHadExplicitDefault(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Field::Group::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Field::Group::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Field::Group::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Field::Ordinal::Reader::isImplicit() const { - return which() == Field::Ordinal::IMPLICIT; -} -inline bool Field::Ordinal::Builder::isImplicit() { - return which() == Field::Ordinal::IMPLICIT; -} -inline ::capnp::Void Field::Ordinal::Reader::getImplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Field::Ordinal::Builder::getImplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setImplicit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::IMPLICIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Ordinal::Reader::isExplicit() const { - return which() == Field::Ordinal::EXPLICIT; -} -inline bool Field::Ordinal::Builder::isExplicit() { - return which() == Field::Ordinal::EXPLICIT; -} -inline ::uint16_t Field::Ordinal::Reader::getExplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Ordinal::Builder::getExplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setExplicit( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::EXPLICIT); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Enumerant::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Enumerant::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Enumerant::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Enumerant::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Enumerant::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Enumerant::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Enumerant::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Enumerant::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Enumerant::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Superclass::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Superclass::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Superclass::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Superclass::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Superclass::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Superclass::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Superclass::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Superclass::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Superclass::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Superclass::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Method::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Method::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Method::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Method::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Method::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Method::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getParamStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getParamStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setParamStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getResultStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getResultStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setResultStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Method::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Method::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Method::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasParamBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasParamBrand() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getParamBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getParamBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setParamBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptParamBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasResultBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasResultBrand() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getResultBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getResultBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setResultBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptResultBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasImplicitParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasImplicitParameters() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Method::Reader::getImplicitParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::getImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::initImplicitParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptImplicitParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Method::Builder::disownImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::Which Type::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::Which Type::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Type::Reader::isVoid() const { - return which() == Type::VOID; -} -inline bool Type::Builder::isVoid() { - return which() == Type::VOID; -} -inline ::capnp::Void Type::Reader::getVoid() const { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getVoid() { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isBool() const { - return which() == Type::BOOL; -} -inline bool Type::Builder::isBool() { - return which() == Type::BOOL; -} -inline ::capnp::Void Type::Reader::getBool() const { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getBool() { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setBool( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::BOOL); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt8() const { - return which() == Type::INT8; -} -inline bool Type::Builder::isInt8() { - return which() == Type::INT8; -} -inline ::capnp::Void Type::Reader::getInt8() const { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt8() { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt16() const { - return which() == Type::INT16; -} -inline bool Type::Builder::isInt16() { - return which() == Type::INT16; -} -inline ::capnp::Void Type::Reader::getInt16() const { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt16() { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt32() const { - return which() == Type::INT32; -} -inline bool Type::Builder::isInt32() { - return which() == Type::INT32; -} -inline ::capnp::Void Type::Reader::getInt32() const { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt32() { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt64() const { - return which() == Type::INT64; -} -inline bool Type::Builder::isInt64() { - return which() == Type::INT64; -} -inline ::capnp::Void Type::Reader::getInt64() const { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt64() { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint8() const { - return which() == Type::UINT8; -} -inline bool Type::Builder::isUint8() { - return which() == Type::UINT8; -} -inline ::capnp::Void Type::Reader::getUint8() const { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint8() { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint16() const { - return which() == Type::UINT16; -} -inline bool Type::Builder::isUint16() { - return which() == Type::UINT16; -} -inline ::capnp::Void Type::Reader::getUint16() const { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint16() { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint32() const { - return which() == Type::UINT32; -} -inline bool Type::Builder::isUint32() { - return which() == Type::UINT32; -} -inline ::capnp::Void Type::Reader::getUint32() const { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint32() { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint64() const { - return which() == Type::UINT64; -} -inline bool Type::Builder::isUint64() { - return which() == Type::UINT64; -} -inline ::capnp::Void Type::Reader::getUint64() const { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint64() { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat32() const { - return which() == Type::FLOAT32; -} -inline bool Type::Builder::isFloat32() { - return which() == Type::FLOAT32; -} -inline ::capnp::Void Type::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat32() { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat64() const { - return which() == Type::FLOAT64; -} -inline bool Type::Builder::isFloat64() { - return which() == Type::FLOAT64; -} -inline ::capnp::Void Type::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat64() { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isText() const { - return which() == Type::TEXT; -} -inline bool Type::Builder::isText() { - return which() == Type::TEXT; -} -inline ::capnp::Void Type::Reader::getText() const { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getText() { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setText( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::TEXT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isData() const { - return which() == Type::DATA; -} -inline bool Type::Builder::isData() { - return which() == Type::DATA; -} -inline ::capnp::Void Type::Reader::getData() const { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getData() { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setData( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::DATA); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isList() const { - return which() == Type::LIST; -} -inline bool Type::Builder::isList() { - return which() == Type::LIST; -} -inline typename Type::List::Reader Type::Reader::getList() const { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Reader(_reader); -} -inline typename Type::List::Builder Type::Builder::getList() { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Builder(_builder); -} -inline typename Type::List::Builder Type::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::LIST); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::List::Builder(_builder); -} -inline bool Type::Reader::isEnum() const { - return which() == Type::ENUM; -} -inline bool Type::Builder::isEnum() { - return which() == Type::ENUM; -} -inline typename Type::Enum::Reader Type::Reader::getEnum() const { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Reader(_reader); -} -inline typename Type::Enum::Builder Type::Builder::getEnum() { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Builder(_builder); -} -inline typename Type::Enum::Builder Type::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ENUM); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Enum::Builder(_builder); -} -inline bool Type::Reader::isStruct() const { - return which() == Type::STRUCT; -} -inline bool Type::Builder::isStruct() { - return which() == Type::STRUCT; -} -inline typename Type::Struct::Reader Type::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Reader(_reader); -} -inline typename Type::Struct::Builder Type::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Builder(_builder); -} -inline typename Type::Struct::Builder Type::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::STRUCT); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Struct::Builder(_builder); -} -inline bool Type::Reader::isInterface() const { - return which() == Type::INTERFACE; -} -inline bool Type::Builder::isInterface() { - return which() == Type::INTERFACE; -} -inline typename Type::Interface::Reader Type::Reader::getInterface() const { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Reader(_reader); -} -inline typename Type::Interface::Builder Type::Builder::getInterface() { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Builder(_builder); -} -inline typename Type::Interface::Builder Type::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INTERFACE); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Interface::Builder(_builder); -} -inline bool Type::Reader::isAnyPointer() const { - return which() == Type::ANY_POINTER; -} -inline bool Type::Builder::isAnyPointer() { - return which() == Type::ANY_POINTER; -} -inline typename Type::AnyPointer::Reader Type::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Reader(_reader); -} -inline typename Type::AnyPointer::Builder Type::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Builder(_builder); -} -inline typename Type::AnyPointer::Builder Type::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ANY_POINTER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<4>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Builder(_builder); -} -inline bool Type::List::Reader::hasElementType() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::List::Builder::hasElementType() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Type::List::Reader::getElementType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::getElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Type::List::Pipeline::getElementType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::List::Builder::setElementType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::initElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::List::Builder::adoptElementType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Type::List::Builder::disownElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Enum::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Enum::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Enum::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Enum::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Enum::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Enum::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Enum::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Enum::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Enum::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Enum::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Struct::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Struct::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Struct::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Struct::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Struct::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Struct::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Struct::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Struct::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Struct::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Struct::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Interface::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Interface::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Interface::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Interface::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Interface::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Interface::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Interface::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Interface::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Interface::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Interface::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Reader::isUnconstrained() const { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline bool Type::AnyPointer::Builder::isUnconstrained() { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline typename Type::AnyPointer::Unconstrained::Reader Type::AnyPointer::Reader::getUnconstrained() const { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Reader(_reader); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::getUnconstrained() { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::initUnconstrained() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::UNCONSTRAINED); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isParameter() const { - return which() == Type::AnyPointer::PARAMETER; -} -inline bool Type::AnyPointer::Builder::isParameter() { - return which() == Type::AnyPointer::PARAMETER; -} -inline typename Type::AnyPointer::Parameter::Reader Type::AnyPointer::Reader::getParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Reader(_reader); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::getParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::initParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isImplicitMethodParameter() const { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline bool Type::AnyPointer::Builder::isImplicitMethodParameter() { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Reader Type::AnyPointer::Reader::getImplicitMethodParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Reader(_reader); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::getImplicitMethodParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::initImplicitMethodParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::IMPLICIT_METHOD_PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isAnyKind() const { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isAnyKind() { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getAnyKind() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getAnyKind() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setAnyKind( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::ANY_KIND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isStruct() const { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isStruct() { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setStruct( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::STRUCT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isList() const { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isList() { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getList() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getList() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setList( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::LIST); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isCapability() const { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isCapability() { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getCapability() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getCapability() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setCapability( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::CAPABILITY); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::ImplicitMethodParameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Reader::hasScopes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Builder::hasScopes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader Brand::Reader::getScopes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::getScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Builder::setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::initScopes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Builder::adoptScopes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> Brand::Builder::disownScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Scope::Reader::isBind() const { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Builder::isBind() { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Reader::hasBind() const { - if (which() != Brand::Scope::BIND) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Scope::Builder::hasBind() { - if (which() != Brand::Scope::BIND) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader Brand::Scope::Reader::getBind() const { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::getBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Scope::Builder::setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::initBind(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Scope::Builder::adoptBind( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> Brand::Scope::Builder::disownBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Brand::Scope::Reader::isInherit() const { - return which() == Brand::Scope::INHERIT; -} -inline bool Brand::Scope::Builder::isInherit() { - return which() == Brand::Scope::INHERIT; -} -inline ::capnp::Void Brand::Scope::Reader::getInherit() const { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Scope::Builder::getInherit() { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setInherit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::INHERIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Brand::Binding::Reader::isUnbound() const { - return which() == Brand::Binding::UNBOUND; -} -inline bool Brand::Binding::Builder::isUnbound() { - return which() == Brand::Binding::UNBOUND; -} -inline ::capnp::Void Brand::Binding::Reader::getUnbound() const { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Binding::Builder::getUnbound() { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Binding::Builder::setUnbound( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::UNBOUND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Binding::Reader::isType() const { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Builder::isType() { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Reader::hasType() const { - if (which() != Brand::Binding::TYPE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Binding::Builder::hasType() { - if (which() != Brand::Binding::TYPE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Brand::Binding::Reader::getType() const { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::getType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::setType( ::capnp::schema::Type::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::initType() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Brand::Binding::Builder::disownType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Value::Which Value::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Value::Which Value::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Value::Reader::isVoid() const { - return which() == Value::VOID; -} -inline bool Value::Builder::isVoid() { - return which() == Value::VOID; -} -inline ::capnp::Void Value::Reader::getVoid() const { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getVoid() { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isBool() const { - return which() == Value::BOOL; -} -inline bool Value::Builder::isBool() { - return which() == Value::BOOL; -} -inline bool Value::Reader::getBool() const { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool Value::Builder::getBool() { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setBool(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::BOOL); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt8() const { - return which() == Value::INT8; -} -inline bool Value::Builder::isInt8() { - return which() == Value::INT8; -} -inline ::int8_t Value::Reader::getInt8() const { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::int8_t Value::Builder::getInt8() { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt8( ::int8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT8); - _builder.setDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt16() const { - return which() == Value::INT16; -} -inline bool Value::Builder::isInt16() { - return which() == Value::INT16; -} -inline ::int16_t Value::Reader::getInt16() const { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int16_t Value::Builder::getInt16() { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt16( ::int16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT16); - _builder.setDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt32() const { - return which() == Value::INT32; -} -inline bool Value::Builder::isInt32() { - return which() == Value::INT32; -} -inline ::int32_t Value::Reader::getInt32() const { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int32_t Value::Builder::getInt32() { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt32( ::int32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT32); - _builder.setDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt64() const { - return which() == Value::INT64; -} -inline bool Value::Builder::isInt64() { - return which() == Value::INT64; -} -inline ::int64_t Value::Reader::getInt64() const { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int64_t Value::Builder::getInt64() { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt64( ::int64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT64); - _builder.setDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint8() const { - return which() == Value::UINT8; -} -inline bool Value::Builder::isUint8() { - return which() == Value::UINT8; -} -inline ::uint8_t Value::Reader::getUint8() const { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t Value::Builder::getUint8() { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint8( ::uint8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT8); - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint16() const { - return which() == Value::UINT16; -} -inline bool Value::Builder::isUint16() { - return which() == Value::UINT16; -} -inline ::uint16_t Value::Reader::getUint16() const { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getUint16() { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint16( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT16); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint32() const { - return which() == Value::UINT32; -} -inline bool Value::Builder::isUint32() { - return which() == Value::UINT32; -} -inline ::uint32_t Value::Reader::getUint32() const { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Value::Builder::getUint32() { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint32( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT32); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint64() const { - return which() == Value::UINT64; -} -inline bool Value::Builder::isUint64() { - return which() == Value::UINT64; -} -inline ::uint64_t Value::Reader::getUint64() const { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Value::Builder::getUint64() { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint64( ::uint64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT64); - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat32() const { - return which() == Value::FLOAT32; -} -inline bool Value::Builder::isFloat32() { - return which() == Value::FLOAT32; -} -inline float Value::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline float Value::Builder::getFloat32() { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat32(float value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT32); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat64() const { - return which() == Value::FLOAT64; -} -inline bool Value::Builder::isFloat64() { - return which() == Value::FLOAT64; -} -inline double Value::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double Value::Builder::getFloat64() { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat64(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT64); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isText() const { - return which() == Value::TEXT; -} -inline bool Value::Builder::isText() { - return which() == Value::TEXT; -} -inline bool Value::Reader::hasText() const { - if (which() != Value::TEXT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasText() { - if (which() != Value::TEXT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Value::Reader::getText() const { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Value::Builder::getText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setText( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Value::Builder::initText(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptText( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Value::Builder::disownText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isData() const { - return which() == Value::DATA; -} -inline bool Value::Builder::isData() { - return which() == Value::DATA; -} -inline bool Value::Reader::hasData() const { - if (which() != Value::DATA) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasData() { - if (which() != Value::DATA) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Data::Reader Value::Reader::getData() const { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Data::Builder Value::Builder::getData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setData( ::capnp::Data::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Data::Builder Value::Builder::initData(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - return ::capnp::_::PointerHelpers< ::capnp::Data>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptData( - ::capnp::Orphan< ::capnp::Data>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Data> Value::Builder::disownData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isList() const { - return which() == Value::LIST; -} -inline bool Value::Builder::isList() { - return which() == Value::LIST; -} -inline bool Value::Reader::hasList() const { - if (which() != Value::LIST) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasList() { - if (which() != Value::LIST) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getList() const { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getList() { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::LIST); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isEnum() const { - return which() == Value::ENUM; -} -inline bool Value::Builder::isEnum() { - return which() == Value::ENUM; -} -inline ::uint16_t Value::Reader::getEnum() const { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getEnum() { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setEnum( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ENUM); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isStruct() const { - return which() == Value::STRUCT; -} -inline bool Value::Builder::isStruct() { - return which() == Value::STRUCT; -} -inline bool Value::Reader::hasStruct() const { - if (which() != Value::STRUCT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasStruct() { - if (which() != Value::STRUCT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getStruct() const { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getStruct() { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::STRUCT); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isInterface() const { - return which() == Value::INTERFACE; -} -inline bool Value::Builder::isInterface() { - return which() == Value::INTERFACE; -} -inline ::capnp::Void Value::Reader::getInterface() const { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getInterface() { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInterface( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INTERFACE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isAnyPointer() const { - return which() == Value::ANY_POINTER; -} -inline bool Value::Builder::isAnyPointer() { - return which() == Value::ANY_POINTER; -} -inline bool Value::Reader::hasAnyPointer() const { - if (which() != Value::ANY_POINTER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasAnyPointer() { - if (which() != Value::ANY_POINTER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ANY_POINTER); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint64_t Annotation::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Annotation::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Annotation::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Annotation::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Annotation::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Annotation::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Annotation::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Annotation::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Annotation::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Annotation::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Annotation::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t CapnpVersion::Reader::getMajor() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t CapnpVersion::Builder::getMajor() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMajor( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMinor() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMinor() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMinor( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMicro() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMicro() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMicro( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::Reader::hasNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasNodes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node>::Reader CodeGeneratorRequest::Reader::getNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::getNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::initNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> CodeGeneratorRequest::Builder::disownNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasRequestedFiles() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasRequestedFiles() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader CodeGeneratorRequest::Reader::getRequestedFiles() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::getRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::initRequestedFiles(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptRequestedFiles( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> CodeGeneratorRequest::Builder::disownRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasCapnpVersion() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasCapnpVersion() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::CapnpVersion::Reader CodeGeneratorRequest::Reader::getCapnpVersion() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::getCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::CapnpVersion::Pipeline CodeGeneratorRequest::Pipeline::getCapnpVersion() { - return ::capnp::schema::CapnpVersion::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void CodeGeneratorRequest::Builder::setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::initCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::adoptCapnpVersion( - ::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> CodeGeneratorRequest::Builder::disownCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasFilename() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasFilename() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Reader::getFilename() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::getFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setFilename( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::initFilename(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptFilename( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Builder::disownFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasImports() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasImports() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader CodeGeneratorRequest::RequestedFile::Reader::getImports() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::getImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::initImports(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptImports( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> CodeGeneratorRequest::RequestedFile::Builder::disownImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Import::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Import::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Import::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Import::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a93fc509624c72d9_ diff --git a/external/capnp/include/capnp/schema.h b/external/capnp/include/capnp/schema.h deleted file mode 100644 index d59fa75236..0000000000 --- a/external/capnp/include/capnp/schema.h +++ /dev/null @@ -1,934 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_H_ -#define CAPNP_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "Reflection APIs, including this header, are not available in lite mode." -#endif - -#include - -namespace capnp { - -class Schema; -class StructSchema; -class EnumSchema; -class InterfaceSchema; -class ConstSchema; -class ListSchema; -class Type; - -template ()> struct SchemaType_ { typedef Schema Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef EnumSchema Type; }; -template struct SchemaType_ { typedef StructSchema Type; }; -template struct SchemaType_ { typedef InterfaceSchema Type; }; -template struct SchemaType_ { typedef ListSchema Type; }; - -template -using SchemaType = typename SchemaType_::Type; -// SchemaType is the type of T's schema, e.g. StructSchema if T is a struct. - -namespace _ { // private -extern const RawSchema NULL_SCHEMA; -extern const RawSchema NULL_STRUCT_SCHEMA; -extern const RawSchema NULL_ENUM_SCHEMA; -extern const RawSchema NULL_INTERFACE_SCHEMA; -extern const RawSchema NULL_CONST_SCHEMA; -// The schema types default to these null (empty) schemas in case of error, especially when -// exceptions are disabled. -} // namespace _ (private) - -class Schema { - // Convenience wrapper around capnp::schema::Node. - -public: - inline Schema(): raw(&_::NULL_SCHEMA.defaultBrand) {} - - template - static inline SchemaType from() { return SchemaType::template fromImpl(); } - // Get the Schema for a particular compiled-in type. - - schema::Node::Reader getProto() const; - // Get the underlying Cap'n Proto representation of the schema node. (Note that this accessor - // has performance comparable to accessors of struct-typed fields on Reader classes.) - - kj::ArrayPtr asUncheckedMessage() const; - // Get the encoded schema node content as a single message segment. It is safe to read as an - // unchecked message. - - Schema getDependency(uint64_t id) const KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the dependency. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Gets the Schema for one of this Schema's dependencies. For example, if this Schema is for a - // struct, you could look up the schema for one of its fields' types. Throws an exception if this - // schema doesn't actually depend on the given id. - // - // Note that not all type IDs found in the schema node are considered "dependencies" -- only the - // ones that are needed to implement the dynamic API are. That includes: - // - Field types. - // - Group types. - // - scopeId for group nodes, but NOT otherwise. - // - Method parameter and return types. - // - // The following are NOT considered dependencies: - // - Nested nodes. - // - scopeId for a non-group node. - // - Annotations. - // - // To obtain schemas for those, you would need a SchemaLoader. - - bool isBranded() const; - // Returns true if this schema represents a non-default parameterization of this type. - - Schema getGeneric() const; - // Get the version of this schema with any brands removed. - - class BrandArgumentList; - BrandArgumentList getBrandArgumentsAtScope(uint64_t scopeId) const; - // Gets the values bound to the brand parameters at the given scope. - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ConstSchema asConst() const; - // Cast the Schema to a specific type. Throws an exception if the type doesn't match. Use - // getProto() to determine type, e.g. getProto().isStruct(). - - inline bool operator==(const Schema& other) const { return raw == other.raw; } - inline bool operator!=(const Schema& other) const { return raw != other.raw; } - // Determine whether two Schemas are wrapping the exact same underlying data, by identity. If - // you want to check if two Schemas represent the same type (but possibly different versions of - // it), compare their IDs instead. - - template - void requireUsableAs() const; - // Throws an exception if a value with this Schema cannot safely be cast to a native value of - // the given type. This passes if either: - // - *this == from() - // - This schema was loaded with SchemaLoader, the type ID matches typeId(), and - // loadCompiledTypeAndDependencies() was called on the SchemaLoader. - - kj::StringPtr getShortDisplayName() const; - // Get the short version of the node's display name. - -private: - const _::RawBrandedSchema* raw; - - inline explicit Schema(const _::RawBrandedSchema* raw): raw(raw) { - KJ_IREQUIRE(raw->lazyInitializer == nullptr, - "Must call ensureInitialized() on RawSchema before constructing Schema."); - } - - template static inline Schema fromImpl() { - return Schema(&_::rawSchema()); - } - - void requireUsableAs(const _::RawSchema* expected) const; - - uint32_t getSchemaOffset(const schema::Value::Reader& value) const; - - Type getBrandBinding(uint64_t scopeId, uint index) const; - // Look up the binding for a brand parameter used by this Schema. Returns `AnyPointer` if the - // parameter is not bound. - // - // TODO(someday): Public interface for iterating over all bindings? - - Schema getDependency(uint64_t id, uint location) const; - // Look up schema for a particular dependency of this schema. `location` is the dependency - // location number as defined in _::RawBrandedSchema. - - Type interpretType(schema::Type::Reader proto, uint location) const; - // Interpret a schema::Type in the given location within the schema, compiling it into a - // Type object. - - friend class StructSchema; - friend class EnumSchema; - friend class InterfaceSchema; - friend class ConstSchema; - friend class ListSchema; - friend class SchemaLoader; - friend class Type; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend kj::String _::enumString(uint16_t value, const _::RawBrandedSchema& schema); -}; - -kj::StringPtr KJ_STRINGIFY(const Schema& schema); - -class Schema::BrandArgumentList { - // A list of generic parameter bindings for parameters of some particular type. Note that since - // parameters on an outer type apply to all inner types as well, a deeply-nested type can have - // multiple BrandArgumentLists that apply to it. - // - // A BrandArgumentList only represents the arguments that the client of the type specified. Since - // new parameters can be added over time, this list may not cover all defined parameters for the - // type. Missing parameters should be treated as AnyPointer. This class's implementation of - // operator[] already does this for you; out-of-bounds access will safely return AnyPointer. - -public: - inline BrandArgumentList(): scopeId(0), size_(0), bindings(nullptr) {} - - inline uint size() const { return size_; } - Type operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - uint64_t scopeId; - uint size_; - bool isUnbound; - const _::RawBrandedSchema::Binding* bindings; - - inline BrandArgumentList(uint64_t scopeId, bool isUnbound) - : scopeId(scopeId), size_(0), isUnbound(isUnbound), bindings(nullptr) {} - inline BrandArgumentList(uint64_t scopeId, uint size, - const _::RawBrandedSchema::Binding* bindings) - : scopeId(scopeId), size_(size), isUnbound(false), bindings(bindings) {} - - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class StructSchema: public Schema { -public: - inline StructSchema(): Schema(&_::NULL_STRUCT_SCHEMA.defaultBrand) {} - - class Field; - class FieldList; - class FieldSubset; - - FieldList getFields() const; - // List top-level fields of this struct. This list will contain top-level groups (including - // named unions) but not the members of those groups. The list does, however, contain the - // members of the unnamed union, if there is one. - - FieldSubset getUnionFields() const; - // If the field contains an unnamed union, get a list of fields in the union, ordered by - // ordinal. Since discriminant values are assigned sequentially by ordinal, you may index this - // list by discriminant value. - - FieldSubset getNonUnionFields() const; - // Get the fields of this struct which are not in an unnamed union, ordered by ordinal. - - kj::Maybe findFieldByName(kj::StringPtr name) const; - // Find the field with the given name, or return null if there is no such field. If the struct - // contains an unnamed union, then this will find fields of that union in addition to fields - // of the outer struct, since they exist in the same namespace. It will not, however, find - // members of groups (including named unions) -- you must first look up the group itself, - // then dig into its type. - - Field getFieldByName(kj::StringPtr name) const; - // Like findFieldByName() but throws an exception on failure. - - kj::Maybe getFieldByDiscriminant(uint16_t discriminant) const; - // Finds the field whose `discriminantValue` is equal to the given value, or returns null if - // there is no such field. (If the schema does not represent a union or a struct containing - // an unnamed union, then this always returns null.) - -private: - StructSchema(Schema base): Schema(base) {} - template static inline StructSchema fromImpl() { - return StructSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class StructSchema::Field { -public: - Field() = default; - - inline schema::Field::Reader getProto() const { return proto; } - inline StructSchema getContainingStruct() const { return parent; } - - inline uint getIndex() const { return index; } - // Get the index of this field within the containing struct or union. - - Type getType() const; - // Get the type of this field. Note that this is preferred over getProto().getType() as this - // method will apply generics. - - uint32_t getDefaultValueSchemaOffset() const; - // For struct, list, and object fields, returns the offset, in words, within the first segment of - // the struct's schema, where this field's default value pointer is located. The schema is - // always stored as a single-segment unchecked message, which in turn means that the default - // value pointer itself can be treated as the root of an unchecked message -- if you know where - // to find it, which is what this method helps you with. - // - // For blobs, returns the offset of the beginning of the blob's content within the first segment - // of the struct's schema. - // - // This is primarily useful for code generators. The C++ code generator, for example, embeds - // the entire schema as a raw word array within the generated code. Of course, to implement - // field accessors, it needs access to those fields' default values. Embedding separate copies - // of those default values would be redundant since they are already included in the schema, but - // seeking through the schema at runtime to find the default values would be ugly. Instead, - // the code generator can use getDefaultValueSchemaOffset() to find the offset of the default - // value within the schema, and can simply apply that offset at runtime. - // - // If the above does not make sense, you probably don't need this method. - - inline bool operator==(const Field& other) const; - inline bool operator!=(const Field& other) const { return !(*this == other); } - -private: - StructSchema parent; - uint index; - schema::Field::Reader proto; - - inline Field(StructSchema parent, uint index, schema::Field::Reader proto) - : parent(parent), index(index), proto(proto) {} - - friend class StructSchema; -}; - -kj::StringPtr KJ_STRINGIFY(const StructSchema::Field& field); - -class StructSchema::FieldList { -public: - FieldList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Field operator[](uint index) const { return Field(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - - inline FieldList(StructSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class StructSchema; -}; - -class StructSchema::FieldSubset { -public: - FieldSubset() = default; // empty list - - inline uint size() const { return size_; } - inline Field operator[](uint index) const { - return Field(parent, indices[index], list[indices[index]]); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - const uint16_t* indices; - uint size_; - - inline FieldSubset(StructSchema parent, List::Reader list, - const uint16_t* indices, uint size) - : parent(parent), list(list), indices(indices), size_(size) {} - - friend class StructSchema; -}; - -// ------------------------------------------------------------------- - -class EnumSchema: public Schema { -public: - inline EnumSchema(): Schema(&_::NULL_ENUM_SCHEMA.defaultBrand) {} - - class Enumerant; - class EnumerantList; - - EnumerantList getEnumerants() const; - - kj::Maybe findEnumerantByName(kj::StringPtr name) const; - - Enumerant getEnumerantByName(kj::StringPtr name) const; - // Like findEnumerantByName() but throws an exception on failure. - -private: - EnumSchema(Schema base): Schema(base) {} - template static inline EnumSchema fromImpl() { - return EnumSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class EnumSchema::Enumerant { -public: - Enumerant() = default; - - inline schema::Enumerant::Reader getProto() const { return proto; } - inline EnumSchema getContainingEnum() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - inline bool operator==(const Enumerant& other) const; - inline bool operator!=(const Enumerant& other) const { return !(*this == other); } - -private: - EnumSchema parent; - uint16_t ordinal; - schema::Enumerant::Reader proto; - - inline Enumerant(EnumSchema parent, uint16_t ordinal, schema::Enumerant::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class EnumSchema; -}; - -class EnumSchema::EnumerantList { -public: - EnumerantList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Enumerant operator[](uint index) const { return Enumerant(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - EnumSchema parent; - List::Reader list; - - inline EnumerantList(EnumSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class EnumSchema; -}; - -// ------------------------------------------------------------------- - -class InterfaceSchema: public Schema { -public: - inline InterfaceSchema(): Schema(&_::NULL_INTERFACE_SCHEMA.defaultBrand) {} - - class Method; - class MethodList; - - MethodList getMethods() const; - - kj::Maybe findMethodByName(kj::StringPtr name) const; - - Method getMethodByName(kj::StringPtr name) const; - // Like findMethodByName() but throws an exception on failure. - - class SuperclassList; - - SuperclassList getSuperclasses() const; - // Get the immediate superclasses of this type, after applying generics. - - bool extends(InterfaceSchema other) const; - // Returns true if `other` is a superclass of this interface (including if `other == *this`). - - kj::Maybe findSuperclass(uint64_t typeId) const; - // Find the superclass of this interface with the given type ID. Returns null if the interface - // extends no such type. - -private: - InterfaceSchema(Schema base): Schema(base) {} - template static inline InterfaceSchema fromImpl() { - return InterfaceSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; - - kj::Maybe findMethodByName(kj::StringPtr name, uint& counter) const; - bool extends(InterfaceSchema other, uint& counter) const; - kj::Maybe findSuperclass(uint64_t typeId, uint& counter) const; - // We protect against malicious schemas with large or cyclic hierarchies by cutting off the - // search when the counter reaches a threshold. -}; - -class InterfaceSchema::Method { -public: - Method() = default; - - inline schema::Method::Reader getProto() const { return proto; } - inline InterfaceSchema getContainingInterface() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - StructSchema getParamType() const; - StructSchema getResultType() const; - // Get the parameter and result types, including substituting generic parameters. - - inline bool operator==(const Method& other) const; - inline bool operator!=(const Method& other) const { return !(*this == other); } - -private: - InterfaceSchema parent; - uint16_t ordinal; - schema::Method::Reader proto; - - inline Method(InterfaceSchema parent, uint16_t ordinal, - schema::Method::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::MethodList { -public: - MethodList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Method operator[](uint index) const { return Method(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline MethodList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::SuperclassList { -public: - SuperclassList() = default; // empty list - - inline uint size() const { return list.size(); } - InterfaceSchema operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline SuperclassList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -// ------------------------------------------------------------------- - -class ConstSchema: public Schema { - // Represents a constant declaration. - // - // `ConstSchema` can be implicitly cast to DynamicValue to read its value. - -public: - inline ConstSchema(): Schema(&_::NULL_CONST_SCHEMA.defaultBrand) {} - - template - ReaderFor as() const; - // Read the constant's value. This is a convenience method equivalent to casting the ConstSchema - // to a DynamicValue and then calling its `as()` method. For dependency reasons, this method - // is defined in , which you must #include explicitly. - - uint32_t getValueSchemaOffset() const; - // Much like StructSchema::Field::getDefaultValueSchemaOffset(), if the constant has pointer - // type, this gets the offset from the beginning of the constant's schema node to a pointer - // representing the constant value. - - Type getType() const; - -private: - ConstSchema(Schema base): Schema(base) {} - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class Type { -public: - struct BrandParameter { - uint64_t scopeId; - uint index; - }; - struct ImplicitParameter { - uint index; - }; - - inline Type(); - inline Type(schema::Type::Which primitive); - inline Type(StructSchema schema); - inline Type(EnumSchema schema); - inline Type(InterfaceSchema schema); - inline Type(ListSchema schema); - inline Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind); - inline Type(BrandParameter param); - inline Type(ImplicitParameter param); - - template - inline static Type from(); - - inline schema::Type::Which which() const; - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ListSchema asList() const; - // Each of these methods may only be called if which() returns the corresponding type. - - kj::Maybe getBrandParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. - - kj::Maybe getImplicitParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. "Implicit parameters" refer to type parameters on methods. - - inline schema::Type::AnyPointer::Unconstrained::Which whichAnyPointerKind() const; - // Only callable if which() returns ANY_POINTER. - - inline bool isVoid() const; - inline bool isBool() const; - inline bool isInt8() const; - inline bool isInt16() const; - inline bool isInt32() const; - inline bool isInt64() const; - inline bool isUInt8() const; - inline bool isUInt16() const; - inline bool isUInt32() const; - inline bool isUInt64() const; - inline bool isFloat32() const; - inline bool isFloat64() const; - inline bool isText() const; - inline bool isData() const; - inline bool isList() const; - inline bool isEnum() const; - inline bool isStruct() const; - inline bool isInterface() const; - inline bool isAnyPointer() const; - - bool operator==(const Type& other) const; - inline bool operator!=(const Type& other) const { return !(*this == other); } - - size_t hashCode() const; - - inline Type wrapInList(uint depth = 1) const; - // Return the Type formed by wrapping this type in List() `depth` times. - - inline Type(schema::Type::Which derived, const _::RawBrandedSchema* schema); - // For internal use. - -private: - schema::Type::Which baseType; // type not including applications of List() - uint8_t listDepth; // 0 for T, 1 for List(T), 2 for List(List(T)), ... - - bool isImplicitParam; - // If true, this refers to an implicit method parameter. baseType must be ANY_POINTER, scopeId - // must be zero, and paramIndex indicates the parameter index. - - union { - uint16_t paramIndex; - // If baseType is ANY_POINTER but this Type actually refers to a type parameter, this is the - // index of the parameter among the parameters at its scope, and `scopeId` below is the type ID - // of the scope where the parameter was defined. - - schema::Type::AnyPointer::Unconstrained::Which anyPointerKind; - // If scopeId is zero and isImplicitParam is false. - }; - - union { - const _::RawBrandedSchema* schema; // if type is struct, enum, interface... - uint64_t scopeId; // if type is AnyPointer but it's actually a type parameter... - }; - - Type(schema::Type::Which baseType, uint8_t listDepth, const _::RawBrandedSchema* schema) - : baseType(baseType), listDepth(listDepth), schema(schema) { - KJ_IREQUIRE(baseType != schema::Type::ANY_POINTER); - } - - void requireUsableAs(Type expected) const; - - friend class ListSchema; // only for requireUsableAs() -}; - -// ------------------------------------------------------------------- - -class ListSchema { - // ListSchema is a little different because list types are not described by schema nodes. So, - // ListSchema doesn't subclass Schema. - -public: - ListSchema() = default; - - static ListSchema of(schema::Type::Which primitiveType); - static ListSchema of(StructSchema elementType); - static ListSchema of(EnumSchema elementType); - static ListSchema of(InterfaceSchema elementType); - static ListSchema of(ListSchema elementType); - static ListSchema of(Type elementType); - // Construct the schema for a list of the given type. - - static ListSchema of(schema::Type::Reader elementType, Schema context) - KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the input type. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Construct from an element type schema. Requires a context which can handle getDependency() - // requests for any type ID found in the schema. - - Type getElementType() const; - - inline schema::Type::Which whichElementType() const; - // Get the element type's "which()". ListSchema does not actually store a schema::Type::Reader - // describing the element type, but if it did, this would be equivalent to calling - // .getBody().which() on that type. - - StructSchema getStructElementType() const; - EnumSchema getEnumElementType() const; - InterfaceSchema getInterfaceElementType() const; - ListSchema getListElementType() const; - // Get the schema for complex element types. Each of these throws an exception if the element - // type is not of the requested kind. - - inline bool operator==(const ListSchema& other) const { return elementType == other.elementType; } - inline bool operator!=(const ListSchema& other) const { return elementType != other.elementType; } - - template - void requireUsableAs() const; - -private: - Type elementType; - - inline explicit ListSchema(Type elementType): elementType(elementType) {} - - template - struct FromImpl; - template static inline ListSchema fromImpl() { - return FromImpl::get(); - } - - void requireUsableAs(ListSchema expected) const; - - friend class Schema; -}; - -// ======================================================================================= -// inline implementation - -template <> inline schema::Type::Which Schema::from() { return schema::Type::VOID; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::BOOL; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::TEXT; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::DATA; } - -inline Schema Schema::getDependency(uint64_t id) const { - return getDependency(id, 0); -} - -inline bool Schema::isBranded() const { - return raw != &raw->generic->defaultBrand; -} - -inline Schema Schema::getGeneric() const { - return Schema(&raw->generic->defaultBrand); -} - -template -inline void Schema::requireUsableAs() const { - requireUsableAs(&_::rawSchema()); -} - -inline bool StructSchema::Field::operator==(const Field& other) const { - return parent == other.parent && index == other.index; -} -inline bool EnumSchema::Enumerant::operator==(const Enumerant& other) const { - return parent == other.parent && ordinal == other.ordinal; -} -inline bool InterfaceSchema::Method::operator==(const Method& other) const { - return parent == other.parent && ordinal == other.ordinal; -} - -inline ListSchema ListSchema::of(StructSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(EnumSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(InterfaceSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(ListSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(Type elementType) { - return ListSchema(elementType); -} - -inline Type ListSchema::getElementType() const { - return elementType; -} - -inline schema::Type::Which ListSchema::whichElementType() const { - return elementType.which(); -} - -inline StructSchema ListSchema::getStructElementType() const { - return elementType.asStruct(); -} - -inline EnumSchema ListSchema::getEnumElementType() const { - return elementType.asEnum(); -} - -inline InterfaceSchema ListSchema::getInterfaceElementType() const { - return elementType.asInterface(); -} - -inline ListSchema ListSchema::getListElementType() const { - return elementType.asList(); -} - -template -inline void ListSchema::requireUsableAs() const { - static_assert(kind() == Kind::LIST, - "ListSchema::requireUsableAs() requires T is a list type."); - requireUsableAs(Schema::from()); -} - -inline void ListSchema::requireUsableAs(ListSchema expected) const { - elementType.requireUsableAs(expected.elementType); -} - -template -struct ListSchema::FromImpl> { - static inline ListSchema get() { return of(Schema::from()); } -}; - -inline Type::Type(): baseType(schema::Type::VOID), listDepth(0), schema(nullptr) {} -inline Type::Type(schema::Type::Which primitive) - : baseType(primitive), listDepth(0), isImplicitParam(false) { - KJ_IREQUIRE(primitive != schema::Type::STRUCT && - primitive != schema::Type::ENUM && - primitive != schema::Type::INTERFACE && - primitive != schema::Type::LIST); - if (primitive == schema::Type::ANY_POINTER) { - scopeId = 0; - anyPointerKind = schema::Type::AnyPointer::Unconstrained::ANY_KIND; - } else { - schema = nullptr; - } -} -inline Type::Type(schema::Type::Which derived, const _::RawBrandedSchema* schema) - : baseType(derived), listDepth(0), isImplicitParam(false), schema(schema) { - KJ_IREQUIRE(derived == schema::Type::STRUCT || - derived == schema::Type::ENUM || - derived == schema::Type::INTERFACE); -} - -inline Type::Type(StructSchema schema) - : baseType(schema::Type::STRUCT), listDepth(0), schema(schema.raw) {} -inline Type::Type(EnumSchema schema) - : baseType(schema::Type::ENUM), listDepth(0), schema(schema.raw) {} -inline Type::Type(InterfaceSchema schema) - : baseType(schema::Type::INTERFACE), listDepth(0), schema(schema.raw) {} -inline Type::Type(ListSchema schema) - : Type(schema.getElementType()) { ++listDepth; } -inline Type::Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - anyPointerKind(anyPointerKind), scopeId(0) {} -inline Type::Type(BrandParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - paramIndex(param.index), scopeId(param.scopeId) {} -inline Type::Type(ImplicitParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(true), - paramIndex(param.index), scopeId(0) {} - -inline schema::Type::Which Type::which() const { - return listDepth > 0 ? schema::Type::LIST : baseType; -} - -inline schema::Type::AnyPointer::Unconstrained::Which Type::whichAnyPointerKind() const { - KJ_IREQUIRE(baseType == schema::Type::ANY_POINTER); - return !isImplicitParam && scopeId == 0 ? anyPointerKind - : schema::Type::AnyPointer::Unconstrained::ANY_KIND; -} - -template -inline Type Type::from() { return Type(Schema::from()); } - -inline bool Type::isVoid () const { return baseType == schema::Type::VOID && listDepth == 0; } -inline bool Type::isBool () const { return baseType == schema::Type::BOOL && listDepth == 0; } -inline bool Type::isInt8 () const { return baseType == schema::Type::INT8 && listDepth == 0; } -inline bool Type::isInt16 () const { return baseType == schema::Type::INT16 && listDepth == 0; } -inline bool Type::isInt32 () const { return baseType == schema::Type::INT32 && listDepth == 0; } -inline bool Type::isInt64 () const { return baseType == schema::Type::INT64 && listDepth == 0; } -inline bool Type::isUInt8 () const { return baseType == schema::Type::UINT8 && listDepth == 0; } -inline bool Type::isUInt16 () const { return baseType == schema::Type::UINT16 && listDepth == 0; } -inline bool Type::isUInt32 () const { return baseType == schema::Type::UINT32 && listDepth == 0; } -inline bool Type::isUInt64 () const { return baseType == schema::Type::UINT64 && listDepth == 0; } -inline bool Type::isFloat32() const { return baseType == schema::Type::FLOAT32 && listDepth == 0; } -inline bool Type::isFloat64() const { return baseType == schema::Type::FLOAT64 && listDepth == 0; } -inline bool Type::isText () const { return baseType == schema::Type::TEXT && listDepth == 0; } -inline bool Type::isData () const { return baseType == schema::Type::DATA && listDepth == 0; } -inline bool Type::isList () const { return listDepth > 0; } -inline bool Type::isEnum () const { return baseType == schema::Type::ENUM && listDepth == 0; } -inline bool Type::isStruct () const { return baseType == schema::Type::STRUCT && listDepth == 0; } -inline bool Type::isInterface() const { - return baseType == schema::Type::INTERFACE && listDepth == 0; -} -inline bool Type::isAnyPointer() const { - return baseType == schema::Type::ANY_POINTER && listDepth == 0; -} - -inline Type Type::wrapInList(uint depth) const { - Type result = *this; - result.listDepth += depth; - return result; -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_H_ diff --git a/external/capnp/include/capnp/serialize-async.h b/external/capnp/include/capnp/serialize-async.h deleted file mode 100644 index a16bfd8975..0000000000 --- a/external/capnp/include/capnp/serialize-async.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_ASYNC_H_ -#define CAPNP_SERIALIZE_ASYNC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -kj::Promise> readMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Read a message asynchronously. -// -// `input` must remain valid until the returned promise resolves (or is canceled). -// -// `scratchSpace`, if provided, must remain valid until the returned MessageReader is destroyed. - -kj::Promise>> tryReadMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Like `readMessage` but returns null on EOF. - -kj::Promise writeMessage(kj::AsyncOutputStream& output, - kj::ArrayPtr> segments) - KJ_WARN_UNUSED_RESULT; -kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) - KJ_WARN_UNUSED_RESULT; -// Write asynchronously. The parameters must remain valid until the returned promise resolves. - -// ======================================================================================= -// inline implementation details - -inline kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) { - return writeMessage(output, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_ASYNC_H_ diff --git a/external/capnp/include/capnp/serialize-packed.h b/external/capnp/include/capnp/serialize-packed.h deleted file mode 100644 index a71260ce1d..0000000000 --- a/external/capnp/include/capnp/serialize-packed.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_PACKED_H_ -#define CAPNP_SERIALIZE_PACKED_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "serialize.h" - -namespace capnp { - -namespace _ { // private - -class PackedInputStream: public kj::InputStream { - // An input stream that unpacks packed data with a picky constraint: The caller must read data - // in the exact same size and sequence as the data was written to PackedOutputStream. - -public: - explicit PackedInputStream(kj::BufferedInputStream& inner); - KJ_DISALLOW_COPY(PackedInputStream); - ~PackedInputStream() noexcept(false); - - // implements InputStream ------------------------------------------ - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - kj::BufferedInputStream& inner; -}; - -class PackedOutputStream: public kj::OutputStream { -public: - explicit PackedOutputStream(kj::BufferedOutputStream& inner); - KJ_DISALLOW_COPY(PackedOutputStream); - ~PackedOutputStream() noexcept(false); - - // implements OutputStream ----------------------------------------- - void write(const void* buffer, size_t bytes) override; - -private: - kj::BufferedOutputStream& inner; -}; - -} // namespace _ (private) - -class PackedMessageReader: private _::PackedInputStream, public InputStreamMessageReader { -public: - PackedMessageReader(kj::BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - KJ_DISALLOW_COPY(PackedMessageReader); - ~PackedMessageReader() noexcept(false); -}; - -class PackedFdMessageReader: private kj::FdInputStream, private kj::BufferedInputStreamWrapper, - public PackedMessageReader { -public: - PackedFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read message from a file descriptor, without taking ownership of the descriptor. - // Note that if you want to reuse the descriptor after the reader is destroyed, you'll need to - // seek it, since otherwise the position is unspecified. - - PackedFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read a message from a file descriptor, taking ownership of the descriptor. - - KJ_DISALLOW_COPY(PackedFdMessageReader); - - ~PackedFdMessageReader() noexcept(false); -}; - -void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::BufferedOutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to a buffered output stream. - -void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::OutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to an unbuffered output stream. If you intend to write multiple messages -// in succession, consider wrapping your output in a buffered stream in order to reduce system -// call overhead. - -void writePackedMessageToFd(int fd, MessageBuilder& builder); -void writePackedMessageToFd(int fd, kj::ArrayPtr> segments); -// Write a single packed message to the file descriptor. - -size_t computeUnpackedSizeInWords(kj::ArrayPtr packedBytes); -// Computes the number of words to which the given packed bytes will unpack. Not intended for use -// in performance-sensitive situations. - -// ======================================================================================= -// inline stuff - -inline void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessageToFd(int fd, MessageBuilder& builder) { - writePackedMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_PACKED_H_ diff --git a/external/capnp/include/capnp/serialize-text.h b/external/capnp/include/capnp/serialize-text.h deleted file mode 100644 index d86fc2c00e..0000000000 --- a/external/capnp/include/capnp/serialize-text.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015 Philip Quinn. -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_TEXT_H_ -#define CAPNP_SERIALIZE_TEXT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "dynamic.h" -#include "orphan.h" -#include "schema.h" - -namespace capnp { - -class TextCodec { - // Reads and writes Cap'n Proto objects in a plain text format (as used in the schema - // language for constants, and read/written by the 'decode' and 'encode' commands of - // the capnp tool). - // - // This format is useful for debugging or human input, but it is not a robust alternative - // to the binary format. Changes to a schema's types or names that are permitted in a - // schema's binary evolution will likely break messages stored in this format. - // - // Note that definitions or references (to constants, other fields, or files) are not - // permitted in this format. To evaluate declarations with the full expressiveness of the - // schema language, see `capnp::SchemaParser`. - // - // Requires linking with the capnpc library. - -public: - TextCodec(); - ~TextCodec() noexcept(true); - - void setPrettyPrint(bool enabled); - // If enabled, pads the output of `encode()` with spaces and newlines to make it more - // human-readable. - - template - kj::String encode(T&& value) const; - kj::String encode(DynamicValue::Reader value) const; - // Encode any Cap'n Proto value. - - template - Orphan decode(kj::StringPtr input, Orphanage orphanage) const; - // Decode a text message into a Cap'n Proto object of type T, allocated in the given - // orphanage. Any errors parsing the input or assigning the fields of T are thrown as - // exceptions. - - void decode(kj::StringPtr input, DynamicStruct::Builder output) const; - // Decode a text message for a struct into the given builder. Any errors parsing the - // input or assigning the fields of the output are thrown as exceptions. - - // TODO(someday): expose some control over the error handling? -private: - Orphan decode(kj::StringPtr input, Type type, Orphanage orphanage) const; - - bool prettyPrint; -}; - -// ======================================================================================= -// inline stuff - -template -inline kj::String TextCodec::encode(T&& value) const { - return encode(DynamicValue::Reader(ReaderFor>(kj::fwd(value)))); -} - -template -inline Orphan TextCodec::decode(kj::StringPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_TEXT_H_ diff --git a/external/capnp/include/capnp/serialize.h b/external/capnp/include/capnp/serialize.h deleted file mode 100644 index 797db51766..0000000000 --- a/external/capnp/include/capnp/serialize.h +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file implements a simple serialization format for Cap'n Proto messages. The format -// is as follows: -// -// * 32-bit little-endian segment count (4 bytes). -// * 32-bit little-endian size of each segment (4*(segment count) bytes). -// * Padding so that subsequent data is 64-bit-aligned (0 or 4 bytes). (I.e., if there are an even -// number of segments, there are 4 bytes of zeros here, otherwise there is no padding.) -// * Data from each segment, in order (8*sum(segment sizes) bytes) -// -// This format has some important properties: -// - It is self-delimiting, so multiple messages may be written to a stream without any external -// delimiter. -// - The total size and position of each segment can be determined by reading only the first part -// of the message, allowing lazy and random-access reading of the segment data. -// - A message is always at least 8 bytes. -// - A single-segment message can be read entirely in two system calls with no buffering. -// - A multi-segment message can be read entirely in three system calls with no buffering. -// - The format is appropriate for mmap()ing since all data is aligned. - -#ifndef CAPNP_SERIALIZE_H_ -#define CAPNP_SERIALIZE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "message.h" -#include - -namespace capnp { - -class FlatArrayMessageReader: public MessageReader { - // Parses a message from a flat array. Note that it makes sense to use this together with mmap() - // for extremely fast parsing. - -public: - FlatArrayMessageReader(kj::ArrayPtr array, ReaderOptions options = ReaderOptions()); - // The array must remain valid until the MessageReader is destroyed. - - kj::ArrayPtr getSegment(uint id) override; - - const word* getEnd() const { return end; } - // Get a pointer just past the end of the message as determined by reading the message header. - // This could actually be before the end of the input array. This pointer is useful e.g. if - // you know that the input array has extra stuff appended after the message and you want to - // get at it. - -private: - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - const word* end; -}; - -kj::ArrayPtr initMessageBuilderFromFlatArrayCopy( - kj::ArrayPtr array, MessageBuilder& target, - ReaderOptions options = ReaderOptions()); -// Convenience function which reads a message using `FlatArrayMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// Returns an ArrayPtr containing any words left over in the array after consuming the whole -// message. This is useful when reading multiple messages that have been concatenated. See also -// FlatArrayMessageReader::getEnd(). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -kj::Array messageToFlatArray(MessageBuilder& builder); -// Constructs a flat array containing the entire content of the given message. -// -// To output the message as bytes, use `.asBytes()` on the returned word array. Keep in mind that -// `asBytes()` returns an ArrayPtr, so you have to save the Array as well to prevent it from being -// deleted. For example: -// -// kj::Array words = messageToFlatArray(myMessage); -// kj::ArrayPtr bytes = words.asBytes(); -// write(fd, bytes.begin(), bytes.size()); - -kj::Array messageToFlatArray(kj::ArrayPtr> segments); -// Version of messageToFlatArray that takes a raw segment array. - -size_t computeSerializedSizeInWords(MessageBuilder& builder); -// Returns the size, in words, that will be needed to serialize the message, including the header. - -size_t computeSerializedSizeInWords(kj::ArrayPtr> segments); -// Version of computeSerializedSizeInWords that takes a raw segment array. - -size_t expectedSizeInWordsFromPrefix(kj::ArrayPtr messagePrefix); -// Given a prefix of a serialized message, try to determine the expected total size of the message, -// in words. The returned size is based on the information known so far; it may be an underestimate -// if the prefix doesn't contain the full segment table. -// -// If the returned value is greater than `messagePrefix.size()`, then the message is not yet -// complete and the app cannot parse it yet. If the returned value is less than or equal to -// `messagePrefix.size()`, then the returned value is the exact total size of the message; any -// remaining bytes are part of the next message. -// -// This function is useful when reading messages from a stream in an asynchronous way, but when -// using the full KJ async infrastructure would be too difficult. Each time bytes are received, -// use this function to determine if an entire message is ready to be parsed. - -// ======================================================================================= - -class InputStreamMessageReader: public MessageReader { - // A MessageReader that reads from an abstract kj::InputStream. See also StreamFdMessageReader - // for a subclass specific to file descriptors. - -public: - InputStreamMessageReader(kj::InputStream& inputStream, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - ~InputStreamMessageReader() noexcept(false); - - // implements MessageReader ---------------------------------------- - kj::ArrayPtr getSegment(uint id) override; - -private: - kj::InputStream& inputStream; - byte* readPos; - - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - - kj::Array ownedSpace; - // Only if scratchSpace wasn't big enough. - - kj::UnwindDetector unwindDetector; -}; - -void readMessageCopy(kj::InputStream& input, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `InputStreamMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessage(kj::OutputStream& output, MessageBuilder& builder); -// Write the message to the given output stream. - -void writeMessage(kj::OutputStream& output, kj::ArrayPtr> segments); -// Write the segment array to the given output stream. - -// ======================================================================================= -// Specializations for reading from / writing to file descriptors. - -class StreamFdMessageReader: private kj::FdInputStream, public InputStreamMessageReader { - // A MessageReader that reads from a steam-based file descriptor. - -public: - StreamFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(fd), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read message from a file descriptor, without taking ownership of the descriptor. - - StreamFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(kj::mv(fd)), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read a message from a file descriptor, taking ownership of the descriptor. - - ~StreamFdMessageReader() noexcept(false); -}; - -void readMessageCopyFromFd(int fd, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `StreamFdMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessageToFd(int fd, MessageBuilder& builder); -// Write the message to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -void writeMessageToFd(int fd, kj::ArrayPtr> segments); -// Write the segment array to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -// ======================================================================================= -// inline stuff - -inline kj::Array messageToFlatArray(MessageBuilder& builder) { - return messageToFlatArray(builder.getSegmentsForOutput()); -} - -inline size_t computeSerializedSizeInWords(MessageBuilder& builder) { - return computeSerializedSizeInWords(builder.getSegmentsForOutput()); -} - -inline void writeMessage(kj::OutputStream& output, MessageBuilder& builder) { - writeMessage(output, builder.getSegmentsForOutput()); -} - -inline void writeMessageToFd(int fd, MessageBuilder& builder) { - writeMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // SERIALIZE_H_ diff --git a/external/capnp/include/capnp_c.h b/external/capnp/include/capnp_c.h deleted file mode 100644 index 9fa2718f7f..0000000000 --- a/external/capnp/include/capnp_c.h +++ /dev/null @@ -1,426 +0,0 @@ -/* vim: set sw=8 ts=8 sts=8 noet: */ -/* capnp_c.h - * - * Copyright (C) 2013 James McKaskill - * Copyright (C) 2014 Steve Dee - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -#ifndef CAPNP_C_H -#define CAPNP_C_H - -#include -#include -#if defined(unix) && !defined(__APPLE__) -#include -#endif - -// ssize_t is not defined in stdint.h in MSVC. -#ifdef _MSC_VER -typedef intmax_t ssize_t; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) -#define CAPN_INLINE static inline -#else -#define CAPN_INLINE static -#endif - -#define CAPN_VERSION 1 - -/* struct capn is a common structure shared between segments in the same - * session/context so that far pointers between segments will be created. - * - * lookup is used to lookup segments by id when derefencing a far pointer - * - * create is used to create or lookup an alternate segment that has at least - * sz available (ie returned seg->len + sz <= seg->cap) - * - * create_local is used to create a segment for the copy tree and should be - * allocated in the local memory space. - * - * Allocated segments must be zero initialized. - * - * create and lookup can be NULL if you don't need multiple segments and don't - * want to support copying - * - * seglist and copylist are linked lists which can be used to free up segments - * on cleanup, but should not be modified by the user. - * - * lookup, create, create_local, and user can be set by the user. Other values - * should be zero initialized. - */ -struct capn { - /* user settable */ - struct capn_segment *(*lookup)(void* /*user*/, uint32_t /*id */); - struct capn_segment *(*create)(void* /*user*/, uint32_t /*id */, int /*sz*/); - struct capn_segment *(*create_local)(void* /*user*/, int /*sz*/); - void *user; - /* zero initialized, user should not modify */ - uint32_t segnum; - struct capn_tree *copy; - struct capn_tree *segtree; - struct capn_segment *seglist, *lastseg; - struct capn_segment *copylist; -}; - -/* struct capn_tree is a rb tree header used internally for the segment id - * lookup and copy tree */ -struct capn_tree { - struct capn_tree *parent, *link[2]; - unsigned int red : 1; -}; - -struct capn_tree *capn_tree_insert(struct capn_tree *root, struct capn_tree *n); - -/* struct capn_segment contains the information about a single segment. - * - * capn points to a struct capn that is shared between segments in the - * same session - * - * id specifies the segment id, used for far pointers - * - * data specifies the segment data. This should not move after creation. - * - * len specifies the current segment length. This is 0 for a blank - * segment. - * - * cap specifies the segment capacity. - * - * When creating new structures len will be incremented until it reaces cap, - * at which point a new segment will be requested via capn->create. The - * create callback can either create a new segment or expand an existing - * one by incrementing cap and returning the expanded segment. - * - * data, len, and cap must all by 8 byte aligned - * - * data, len, cap, and user should all set by the user. Other values - * should be zero initialized. - */ -#ifdef _MSC_VER -__declspec(align(64)) -#endif -struct capn_segment { - struct capn_tree hdr; - struct capn_segment *next; - struct capn *capn; - uint32_t id; - /* user settable */ - char *data; - size_t len, cap; - void *user; -}; - -enum CAPN_TYPE { - CAPN_NULL = 0, - CAPN_STRUCT = 1, - CAPN_LIST = 2, - CAPN_PTR_LIST = 3, - CAPN_BIT_LIST = 4, - CAPN_FAR_POINTER = 5, -}; - -struct capn_ptr { - unsigned int type : 4; - unsigned int has_ptr_tag : 1; - unsigned int is_list_member : 1; - unsigned int is_composite_list : 1; - unsigned int datasz : 19; - unsigned int ptrs : 16; - int len; - char *data; - struct capn_segment *seg; -}; - -struct capn_text { - int len; - const char *str; - struct capn_segment *seg; -}; - -typedef struct capn_ptr capn_ptr; -typedef struct capn_text capn_text; -typedef struct {capn_ptr p;} capn_data; -typedef struct {capn_ptr p;} capn_list1; -typedef struct {capn_ptr p;} capn_list8; -typedef struct {capn_ptr p;} capn_list16; -typedef struct {capn_ptr p;} capn_list32; -typedef struct {capn_ptr p;} capn_list64; - -struct capn_msg { - struct capn_segment *seg; - uint64_t iface; - uint16_t method; - capn_ptr args; -}; - -/* capn_append_segment appends a segment to a session */ -void capn_append_segment(struct capn*, struct capn_segment*); - -capn_ptr capn_root(struct capn *c); -void capn_resolve(capn_ptr *p); - -#define capn_len(list) ((list).p.type == CAPN_FAR_POINTER ? (capn_resolve(&(list).p), (list).p.len) : (list).p.len) - -/* capn_getp|setp functions get/set ptrs in list/structs - * off is the list index or pointer index in a struct - * capn_setp will copy the data, create far pointers, etc if the target - * is in a different segment/context. - * Both of these will use/return inner pointers for composite lists. - */ -capn_ptr capn_getp(capn_ptr p, int off, int resolve); -int capn_setp(capn_ptr p, int off, capn_ptr tgt); - -capn_text capn_get_text(capn_ptr p, int off, capn_text def); -capn_data capn_get_data(capn_ptr p, int off); -int capn_set_text(capn_ptr p, int off, capn_text tgt); - -/* capn_get* functions get data from a list - * The length of the list is given by p->size - * off specifies how far into the list to start - * sz indicates the number of elements to get - * The function returns the number of elements read or -1 on an error. - * off must be byte aligned for capn_getv1 - */ -int capn_get1(capn_list1 p, int off); -uint8_t capn_get8(capn_list8 p, int off); -uint16_t capn_get16(capn_list16 p, int off); -uint32_t capn_get32(capn_list32 p, int off); -uint64_t capn_get64(capn_list64 p, int off); -int capn_getv1(capn_list1 p, int off, uint8_t *data, int sz); -int capn_getv8(capn_list8 p, int off, uint8_t *data, int sz); -int capn_getv16(capn_list16 p, int off, uint16_t *data, int sz); -int capn_getv32(capn_list32 p, int off, uint32_t *data, int sz); -int capn_getv64(capn_list64 p, int off, uint64_t *data, int sz); - -/* capn_set* functions set data in a list - * off specifies how far into the list to start - * sz indicates the number of elements to write - * The function returns the number of elemnts written or -1 on an error. - * off must be byte aligned for capn_setv1 - */ -int capn_set1(capn_list1 p, int off, int v); -int capn_set8(capn_list8 p, int off, uint8_t v); -int capn_set16(capn_list16 p, int off, uint16_t v); -int capn_set32(capn_list32 p, int off, uint32_t v); -int capn_set64(capn_list64 p, int off, uint64_t v); -int capn_setv1(capn_list1 p, int off, const uint8_t *data, int sz); -int capn_setv8(capn_list8 p, int off, const uint8_t *data, int sz); -int capn_setv16(capn_list16 p, int off, const uint16_t *data, int sz); -int capn_setv32(capn_list32 p, int off, const uint32_t *data, int sz); -int capn_setv64(capn_list64 p, int off, const uint64_t *data, int sz); - -/* capn_new_* functions create a new object - * datasz is in bytes, ptrs is # of pointers, sz is # of elements in the list - * On an error a CAPN_NULL pointer is returned - */ -capn_ptr capn_new_string(struct capn_segment *seg, const char *str, ssize_t sz); -capn_ptr capn_new_struct(struct capn_segment *seg, int datasz, int ptrs); -capn_ptr capn_new_interface(struct capn_segment *seg, int datasz, int ptrs); -capn_ptr capn_new_ptr_list(struct capn_segment *seg, int sz); -capn_ptr capn_new_list(struct capn_segment *seg, int sz, int datasz, int ptrs); -capn_list1 capn_new_list1(struct capn_segment *seg, int sz); -capn_list8 capn_new_list8(struct capn_segment *seg, int sz); -capn_list16 capn_new_list16(struct capn_segment *seg, int sz); -capn_list32 capn_new_list32(struct capn_segment *seg, int sz); -capn_list64 capn_new_list64(struct capn_segment *seg, int sz); - -/* capn_read|write* functions read/write struct values - * off is the offset into the structure in bytes - * Rarely should these be called directly, instead use the generated code. - * Data must be xored with the default value - * These are inlined - */ -CAPN_INLINE uint8_t capn_read8(capn_ptr p, int off); -CAPN_INLINE uint16_t capn_read16(capn_ptr p, int off); -CAPN_INLINE uint32_t capn_read32(capn_ptr p, int off); -CAPN_INLINE uint64_t capn_read64(capn_ptr p, int off); -CAPN_INLINE int capn_write1(capn_ptr p, int off, int val); -CAPN_INLINE int capn_write8(capn_ptr p, int off, uint8_t val); -CAPN_INLINE int capn_write16(capn_ptr p, int off, uint16_t val); -CAPN_INLINE int capn_write32(capn_ptr p, int off, uint32_t val); -CAPN_INLINE int capn_write64(capn_ptr p, int off, uint64_t val); - -/* capn_init_malloc inits the capn struct with a create function which - * allocates segments on the heap using malloc - * - * capn_init_(fp|mem) inits by reading segments in from the file/memory buffer - * in serialized form (optionally packed). It will then setup the create - * function ala capn_init_malloc so that further segments can be created. - * - * capn_free frees all the segment headers and data created by the create - * function setup by capn_init_* - */ -void capn_init_malloc(struct capn *c); -int capn_init_fp(struct capn *c, FILE *f, int packed); -int capn_init_mem(struct capn *c, const uint8_t *p, size_t sz, int packed); - -/* capn_write_(fp|mem) writes segments to the file/memory buffer in - * serialized form and returns the number of bytes written. - */ -/* TODO */ -/*int capn_write_fp(struct capn *c, FILE *f, int packed);*/ -int capn_write_fd(struct capn *c, ssize_t (*write_fd)(int fd, void *p, size_t count), int fd, int packed); -int capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed); - -void capn_free(struct capn *c); -void capn_reset_copy(struct capn *c); - -/* Inline functions */ - - -CAPN_INLINE uint8_t capn_flip8(uint8_t v) { - return v; -} -CAPN_INLINE uint16_t capn_flip16(uint16_t v) { -#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) - return v; -#elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) && \ - defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 - return __builtin_bswap16(v); -#else - union { uint16_t u; uint8_t v[2]; } s; - s.v[0] = (uint8_t)v; - s.v[1] = (uint8_t)(v>>8); - return s.u; -#endif -} -CAPN_INLINE uint32_t capn_flip32(uint32_t v) { -#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) - return v; -#elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) && \ - defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 - return __builtin_bswap32(v); -#else - union { uint32_t u; uint8_t v[4]; } s; - s.v[0] = (uint8_t)v; - s.v[1] = (uint8_t)(v>>8); - s.v[2] = (uint8_t)(v>>16); - s.v[3] = (uint8_t)(v>>24); - return s.u; -#endif -} -CAPN_INLINE uint64_t capn_flip64(uint64_t v) { -#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) - return v; -#elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) && \ - defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 - return __builtin_bswap64(v); -#else - union { uint64_t u; uint8_t v[8]; } s; - s.v[0] = (uint8_t)v; - s.v[1] = (uint8_t)(v>>8); - s.v[2] = (uint8_t)(v>>16); - s.v[3] = (uint8_t)(v>>24); - s.v[4] = (uint8_t)(v>>32); - s.v[5] = (uint8_t)(v>>40); - s.v[6] = (uint8_t)(v>>48); - s.v[7] = (uint8_t)(v>>56); - return s.u; -#endif -} - -CAPN_INLINE int capn_write1(capn_ptr p, int off, int val) { - if (off >= p.datasz*8) { - return -1; - } else if (val) { - uint8_t tmp = (uint8_t)(1 << (off & 7)); - ((uint8_t*) p.data)[off >> 3] |= tmp; - return 0; - } else { - uint8_t tmp = (uint8_t)(~(1 << (off & 7))); - ((uint8_t*) p.data)[off >> 3] &= tmp; - return 0; - } -} - -CAPN_INLINE uint8_t capn_read8(capn_ptr p, int off) { - return off+1 <= p.datasz ? capn_flip8(*(uint8_t*) (p.data+off)) : 0; -} -CAPN_INLINE int capn_write8(capn_ptr p, int off, uint8_t val) { - if (off+1 <= p.datasz) { - *(uint8_t*) (p.data+off) = capn_flip8(val); - return 0; - } else { - return -1; - } -} - -CAPN_INLINE uint16_t capn_read16(capn_ptr p, int off) { - return off+2 <= p.datasz ? capn_flip16(*(uint16_t*) (p.data+off)) : 0; -} -CAPN_INLINE int capn_write16(capn_ptr p, int off, uint16_t val) { - if (off+2 <= p.datasz) { - *(uint16_t*) (p.data+off) = capn_flip16(val); - return 0; - } else { - return -1; - } -} - -CAPN_INLINE uint32_t capn_read32(capn_ptr p, int off) { - return off+4 <= p.datasz ? capn_flip32(*(uint32_t*) (p.data+off)) : 0; -} -CAPN_INLINE int capn_write32(capn_ptr p, int off, uint32_t val) { - if (off+4 <= p.datasz) { - *(uint32_t*) (p.data+off) = capn_flip32(val); - return 0; - } else { - return -1; - } -} - -CAPN_INLINE uint64_t capn_read64(capn_ptr p, int off) { - return off+8 <= p.datasz ? capn_flip64(*(uint64_t*) (p.data+off)) : 0; -} -CAPN_INLINE int capn_write64(capn_ptr p, int off, uint64_t val) { - if (off+8 <= p.datasz) { - *(uint64_t*) (p.data+off) = capn_flip64(val); - return 0; - } else { - return -1; - } -} - -union capn_conv_f32 { - uint32_t u; - float f; -}; - -union capn_conv_f64 { - uint64_t u; - double f; -}; - -CAPN_INLINE float capn_to_f32(uint32_t v) { - union capn_conv_f32 u; - u.u = v; - return u.f; -} -CAPN_INLINE double capn_to_f64(uint64_t v) { - union capn_conv_f64 u; - u.u = v; - return u.f; -} -CAPN_INLINE uint32_t capn_from_f32(float v) { - union capn_conv_f32 u; - u.f = v; - return u.u; -} -CAPN_INLINE uint64_t capn_from_f64(double v) { - union capn_conv_f64 u; - u.f = v; - return u.u; -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/capnp/include/kj/arena.h b/external/capnp/include/kj/arena.h deleted file mode 100644 index 32c1f61c51..0000000000 --- a/external/capnp/include/kj/arena.h +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARENA_H_ -#define KJ_ARENA_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class Arena { - // A class which allows several objects to be allocated in contiguous chunks of memory, then - // frees them all at once. - // - // Allocating from the same Arena in multiple threads concurrently is NOT safe, because making - // it safe would require atomic operations that would slow down allocation even when - // single-threaded. If you need to use arena allocation in a multithreaded context, consider - // allocating thread-local arenas. - -public: - explicit Arena(size_t chunkSizeHint = 1024); - // Create an Arena. `chunkSizeHint` hints at where to start when allocating chunks, but is only - // a hint -- the Arena will, for example, allocate progressively larger chunks as time goes on, - // in order to reduce overall allocation overhead. - - explicit Arena(ArrayPtr scratch); - // Allocates from the given scratch space first, only resorting to the heap when it runs out. - - KJ_DISALLOW_COPY(Arena); - ~Arena() noexcept(false); - - template - T& allocate(Params&&... params); - template - ArrayPtr allocateArray(size_t size); - // Allocate an object or array of type T. If T has a non-trivial destructor, that destructor - // will be run during the Arena's destructor. Such destructors are run in opposite order of - // allocation. Note that these methods must maintain a list of destructors to call, which has - // overhead, but this overhead only applies if T has a non-trivial destructor. - - template - Own allocateOwn(Params&&... params); - template - Array allocateOwnArray(size_t size); - template - ArrayBuilder allocateOwnArrayBuilder(size_t capacity); - // Allocate an object or array of type T. Destructors are executed when the returned Own - // or Array goes out-of-scope, which must happen before the Arena is destroyed. This variant - // is useful when you need to control when the destructor is called. This variant also avoids - // the need for the Arena itself to keep track of destructors to call later, which may make it - // slightly more efficient. - - template - inline T& copy(T&& value) { return allocate>(kj::fwd(value)); } - // Allocate a copy of the given value in the arena. This is just a shortcut for calling the - // type's copy (or move) constructor. - - StringPtr copyString(StringPtr content); - // Make a copy of the given string inside the arena, and return a pointer to the copy. - -private: - struct ChunkHeader { - ChunkHeader* next; - byte* pos; // first unallocated byte in this chunk - byte* end; // end of this chunk - }; - struct ObjectHeader { - void (*destructor)(void*); - ObjectHeader* next; - }; - - size_t nextChunkSize; - ChunkHeader* chunkList = nullptr; - ObjectHeader* objectList = nullptr; - - ChunkHeader* currentChunk = nullptr; - - void cleanup(); - // Run all destructors, leaving the above pointers null. If a destructor throws, the State is - // left in a consistent state, such that if cleanup() is called again, it will pick up where - // it left off. - - void* allocateBytes(size_t amount, uint alignment, bool hasDisposer); - // Allocate the given number of bytes. `hasDisposer` must be true if `setDisposer()` may be - // called on this pointer later. - - void* allocateBytesInternal(size_t amount, uint alignment); - // Try to allocate the given number of bytes without taking a lock. Fails if and only if there - // is no space left in the current chunk. - - void setDestructor(void* ptr, void (*destructor)(void*)); - // Schedule the given destructor to be executed when the Arena is destroyed. `ptr` must be a - // pointer previously returned by an `allocateBytes()` call for which `hasDisposer` was true. - - template - static void destroyArray(void* pointer) { - size_t elementCount = *reinterpret_cast(pointer); - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - DestructorOnlyArrayDisposer::instance.disposeImpl( - reinterpret_cast(pointer) + prefixSize, - sizeof(T), elementCount, elementCount, &destroyObject); - } - - template - static void destroyObject(void* pointer) { - dtor(*reinterpret_cast(pointer)); - } -}; - -// ======================================================================================= -// Inline implementation details - -template -T& Arena::allocate(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes( - sizeof(T), alignof(T), !__has_trivial_destructor(T))); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - if (!__has_trivial_destructor(T)) { - setDestructor(&result, &destroyObject); - } - return result; -} - -template -ArrayPtr Arena::allocateArray(size_t size) { - if (__has_trivial_destructor(T)) { - ArrayPtr result = - arrayPtr(reinterpret_cast(allocateBytes( - sizeof(T) * size, alignof(T), false)), size); - if (!__has_trivial_constructor(T)) { - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - } - } - return result; - } else { - // Allocate with a 64-bit prefix in which we store the array size. - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - void* base = allocateBytes(sizeof(T) * size + prefixSize, alignof(T), true); - size_t& tag = *reinterpret_cast(base); - ArrayPtr result = - arrayPtr(reinterpret_cast(reinterpret_cast(base) + prefixSize), size); - setDestructor(base, &destroyArray); - - if (__has_trivial_constructor(T)) { - tag = size; - } else { - // In case of constructor exceptions, we need the tag to end up storing the number of objects - // that were successfully constructed, so that they'll be properly destroyed. - tag = 0; - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - tag = i + 1; - } - } - return result; - } -} - -template -Own Arena::allocateOwn(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes(sizeof(T), alignof(T), false)); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - return Own(&result, DestructorOnlyDisposer::instance); -} - -template -Array Arena::allocateOwnArray(size_t size) { - ArrayBuilder result = allocateOwnArrayBuilder(size); - for (size_t i = 0; i < size; i++) { - result.add(); - } - return result.finish(); -} - -template -ArrayBuilder Arena::allocateOwnArrayBuilder(size_t capacity) { - return ArrayBuilder( - reinterpret_cast(allocateBytes(sizeof(T) * capacity, alignof(T), false)), - capacity, DestructorOnlyArrayDisposer::instance); -} - -} // namespace kj - -#endif // KJ_ARENA_H_ diff --git a/external/capnp/include/kj/array.h b/external/capnp/include/kj/array.h deleted file mode 100644 index 51b5dcf319..0000000000 --- a/external/capnp/include/kj/array.h +++ /dev/null @@ -1,813 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARRAY_H_ -#define KJ_ARRAY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include - -namespace kj { - -// ======================================================================================= -// ArrayDisposer -- Implementation details. - -class ArrayDisposer { - // Much like Disposer from memory.h. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for - // HeapArrayDisposer::instance. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const = 0; - // Disposes of the array. `destroyElement` invokes the destructor of each element, or is nullptr - // if the elements have trivial destructors. `capacity` is the amount of space that was - // allocated while `elementCount` is the number of elements that were actually constructed; - // these are always the same number for Array but may be different when using ArrayBuilder. - -public: - - template - void dispose(T* firstElement, size_t elementCount, size_t capacity) const; - // Helper wrapper around disposeImpl(). - // - // Callers must not call dispose() on the same array twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -class ExceptionSafeArrayUtil { - // Utility class that assists in constructing or destroying elements of an array, where the - // constructor or destructor could throw exceptions. In case of an exception, - // ExceptionSafeArrayUtil's destructor will call destructors on all elements that have been - // constructed but not destroyed. Remember that destructors that throw exceptions are required - // to use UnwindDetector to detect unwind and avoid exceptions in this case. Therefore, no more - // than one exception will be thrown (and the program will not terminate). - -public: - inline ExceptionSafeArrayUtil(void* ptr, size_t elementSize, size_t constructedElementCount, - void (*destroyElement)(void*)) - : pos(reinterpret_cast(ptr) + elementSize * constructedElementCount), - elementSize(elementSize), constructedElementCount(constructedElementCount), - destroyElement(destroyElement) {} - KJ_DISALLOW_COPY(ExceptionSafeArrayUtil); - - inline ~ExceptionSafeArrayUtil() noexcept(false) { - if (constructedElementCount > 0) destroyAll(); - } - - void construct(size_t count, void (*constructElement)(void*)); - // Construct the given number of elements. - - void destroyAll(); - // Destroy all elements. Call this immediately before ExceptionSafeArrayUtil goes out-of-scope - // to ensure that one element throwing an exception does not prevent the others from being - // destroyed. - - void release() { constructedElementCount = 0; } - // Prevent ExceptionSafeArrayUtil's destructor from destroying the constructed elements. - // Call this after you've successfully finished constructing. - -private: - byte* pos; - size_t elementSize; - size_t constructedElementCount; - void (*destroyElement)(void*); -}; - -class DestructorOnlyArrayDisposer: public ArrayDisposer { -public: - static const DestructorOnlyArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -class NullArrayDisposer: public ArrayDisposer { - // An ArrayDisposer that does nothing. Can be used to construct a fake Arrays that doesn't - // actually own its content. - -public: - static const NullArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -// ======================================================================================= -// Array - -template -class Array { - // An owned array which will automatically be disposed of (using an ArrayDisposer) in the - // destructor. Can be moved, but not copied. Much like Own, but for arrays rather than - // single objects. - -public: - inline Array(): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(decltype(nullptr)): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(Array&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(Array>&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(T* firstElement, size_t size, const ArrayDisposer& disposer) - : ptr(firstElement), size_(size), disposer(&disposer) {} - - KJ_DISALLOW_COPY(Array); - inline ~Array() noexcept { dispose(); } - - inline operator ArrayPtr() { - return ArrayPtr(ptr, size_); - } - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr asBytes() const { return asPtr().asBytes(); } - inline ArrayPtr> asBytes() { return asPtr().asBytes(); } - inline ArrayPtr asChars() const { return asPtr().asChars(); } - inline ArrayPtr> asChars() { return asPtr().asChars(); } - - inline Array> releaseAsBytes() { - // Like asBytes() but transfers ownership. - static_assert(sizeof(T) == sizeof(byte), - "releaseAsBytes() only possible on arrays with byte-size elements (e.g. chars)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - inline Array> releaseAsChars() { - // Like asChars() but transfers ownership. - static_assert(sizeof(T) == sizeof(PropagateConst), - "releaseAsChars() only possible on arrays with char-size elements (e.g. bytes)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline Array& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - inline Array& operator=(Array&& other) { - dispose(); - ptr = other.ptr; - size_ = other.size_; - disposer = other.disposer; - other.ptr = nullptr; - other.size_ = 0; - return *this; - } - -private: - T* ptr; - size_t size_; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - size_t sizeCopy = size_; - if (ptrCopy != nullptr) { - ptr = nullptr; - size_ = 0; - disposer->dispose(ptrCopy, sizeCopy, sizeCopy); - } - } - - template - friend class Array; -}; - -static_assert(!canMemcpy>(), "canMemcpy<>() is broken"); - -namespace _ { // private - -class HeapArrayDisposer final: public ArrayDisposer { -public: - template - static T* allocate(size_t count); - template - static T* allocateUninitialized(size_t count); - - static const HeapArrayDisposer instance; - -private: - static void* allocateImpl(size_t elementSize, size_t elementCount, size_t capacity, - void (*constructElement)(void*), void (*destroyElement)(void*)); - // Allocates and constructs the array. Both function pointers are null if the constructor is - // trivial, otherwise destroyElement is null if the constructor doesn't throw. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; - - template - struct Allocate_; -}; - -} // namespace _ (private) - -template -inline Array heapArray(size_t size) { - // Much like `heap()` from memory.h, allocates a new array on the heap. - - return Array(_::HeapArrayDisposer::allocate(size), size, - _::HeapArrayDisposer::instance); -} - -template Array heapArray(const T* content, size_t size); -template Array heapArray(ArrayPtr content); -template Array heapArray(ArrayPtr content); -template Array heapArray(Iterator begin, Iterator end); -template Array heapArray(std::initializer_list init); -// Allocate a heap array containing a copy of the given content. - -template -Array heapArrayFromIterable(Container&& a) { return heapArray(a.begin(), a.end()); } -template -Array heapArrayFromIterable(Array&& a) { return mv(a); } - -// ======================================================================================= -// ArrayBuilder - -template -class ArrayBuilder { - // Class which lets you build an Array specifying the exact constructor arguments for each - // element, rather than starting by default-constructing them. - -public: - ArrayBuilder(): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - ArrayBuilder(decltype(nullptr)): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - explicit ArrayBuilder(RemoveConst* firstElement, size_t capacity, - const ArrayDisposer& disposer) - : ptr(firstElement), pos(firstElement), endPtr(firstElement + capacity), - disposer(&disposer) {} - ArrayBuilder(ArrayBuilder&& other) - : ptr(other.ptr), pos(other.pos), endPtr(other.endPtr), disposer(other.disposer) { - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - } - KJ_DISALLOW_COPY(ArrayBuilder); - inline ~ArrayBuilder() noexcept(false) { dispose(); } - - inline operator ArrayPtr() { - return arrayPtr(ptr, pos); - } - inline operator ArrayPtr() const { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() const { - return arrayPtr(ptr, pos); - } - - inline size_t size() const { return pos - ptr; } - inline size_t capacity() const { return endPtr - ptr; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < implicitCast(pos - ptr), "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return pos; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(pos - 1); } - inline T* begin() { return ptr; } - inline T* end() { return pos; } - inline T& front() { return *ptr; } - inline T& back() { return *(pos - 1); } - - ArrayBuilder& operator=(ArrayBuilder&& other) { - dispose(); - ptr = other.ptr; - pos = other.pos; - endPtr = other.endPtr; - disposer = other.disposer; - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - return *this; - } - ArrayBuilder& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - T& add(Params&&... params) { - KJ_IREQUIRE(pos < endPtr, "Added too many elements to ArrayBuilder."); - ctor(*pos, kj::fwd(params)...); - return *pos++; - } - - template - void addAll(Container&& container) { - addAll()>( - container.begin(), container.end()); - } - - template - void addAll(Iterator start, Iterator end); - - void removeLast() { - KJ_IREQUIRE(pos > ptr, "No elements present to remove."); - kj::dtor(*--pos); - } - - void truncate(size_t size) { - KJ_IREQUIRE(size <= this->size(), "can't use truncate() to expand"); - - T* target = ptr + size; - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - - void resize(size_t size) { - KJ_IREQUIRE(size <= capacity(), "can't resize past capacity"); - - T* target = ptr + size; - if (target > pos) { - // expand - if (__has_trivial_constructor(T)) { - pos = target; - } else { - while (pos < target) { - kj::ctor(*pos++); - } - } - } else { - // truncate - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - } - - Array finish() { - // We could safely remove this check if we assume that the disposer implementation doesn't - // need to know the original capacity, as is thes case with HeapArrayDisposer since it uses - // operator new() or if we created a custom disposer for ArrayBuilder which stores the capacity - // in a prefix. But that would make it hard to write cleverer heap allocators, and anyway this - // check might catch bugs. Probably people should use Vector if they want to build arrays - // without knowing the final size in advance. - KJ_IREQUIRE(pos == endPtr, "ArrayBuilder::finish() called prematurely."); - Array result(reinterpret_cast(ptr), pos - ptr, *disposer); - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - return result; - } - - inline bool isFull() const { - return pos == endPtr; - } - -private: - T* ptr; - RemoveConst* pos; - T* endPtr; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - T* posCopy = pos; - T* endCopy = endPtr; - if (ptrCopy != nullptr) { - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - disposer->dispose(ptrCopy, posCopy - ptrCopy, endCopy - ptrCopy); - } - } -}; - -template -inline ArrayBuilder heapArrayBuilder(size_t size) { - // Like `heapArray()` but does not default-construct the elements. You must construct them - // manually by calling `add()`. - - return ArrayBuilder(_::HeapArrayDisposer::allocateUninitialized>(size), - size, _::HeapArrayDisposer::instance); -} - -// ======================================================================================= -// Inline Arrays - -template -class FixedArray { - // A fixed-width array whose storage is allocated inline rather than on the heap. - -public: - inline size_t size() const { return fixedSize; } - inline T* begin() { return content; } - inline T* end() { return content + fixedSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + fixedSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, fixedSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, fixedSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - T content[fixedSize]; -}; - -template -class CappedArray { - // Like `FixedArray` but can be dynamically resized as long as the size does not exceed the limit - // specified by the template parameter. - // - // TODO(someday): Don't construct elements past currentSize? - -public: - inline KJ_CONSTEXPR() CappedArray(): currentSize(fixedSize) {} - inline explicit constexpr CappedArray(size_t s): currentSize(s) {} - - inline size_t size() const { return currentSize; } - inline void setSize(size_t s) { KJ_IREQUIRE(s <= fixedSize); currentSize = s; } - inline T* begin() { return content; } - inline T* end() { return content + currentSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + currentSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, currentSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, currentSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - size_t currentSize; - T content[fixedSize]; -}; - -// ======================================================================================= -// KJ_MAP - -#define KJ_MAP(elementName, array) \ - ::kj::_::Mapper(array) * \ - [&](typename ::kj::_::Mapper::Element elementName) -// Applies some function to every element of an array, returning an Array of the results, with -// nice syntax. Example: -// -// StringPtr foo = "abcd"; -// Array bar = KJ_MAP(c, foo) -> char { return c + 1; }; -// KJ_ASSERT(str(bar) == "bcde"); - -namespace _ { // private - -template -struct Mapper { - T array; - Mapper(T&& array): array(kj::fwd(array)) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(array.size()); - for (auto iter = array.begin(); iter != array.end(); ++iter) { - builder.add(func(*iter)); - } - return builder.finish(); - } - typedef decltype(*kj::instance().begin()) Element; -}; - -template -struct Mapper { - T* array; - Mapper(T* array): array(array) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(s); - for (size_t i = 0; i < s; i++) { - builder.add(func(array[i])); - } - return builder.finish(); - } - typedef decltype(*array)& Element; -}; - -} // namespace _ (private) - -// ======================================================================================= -// Inline implementation details - -template -struct ArrayDisposer::Dispose_ { - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(const_cast*>(firstElement), - sizeof(T), elementCount, capacity, nullptr); - } -}; -template -struct ArrayDisposer::Dispose_ { - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(firstElement, sizeof(T), elementCount, capacity, &destruct); - } -}; - -template -void ArrayDisposer::dispose(T* firstElement, size_t elementCount, size_t capacity) const { - Dispose_::dispose(firstElement, elementCount, capacity, *this); -} - -namespace _ { // private - -template -struct HeapArrayDisposer::Allocate_ { - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, nullptr, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, &destruct)); - } -}; - -template -T* HeapArrayDisposer::allocate(size_t count) { - return Allocate_::allocate(count, count); -} - -template -T* HeapArrayDisposer::allocateUninitialized(size_t count) { - return Allocate_::allocate(0, count); -} - -template ()> -struct CopyConstructArray_; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, T* start, T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, const T* start, const T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Since both the copy constructor and assignment operator are trivial, we know that assignment - // is equivalent to copy-constructing. So we can make this case somewhat easier for the - // compiler to optimize. - while (start != end) { - *pos++ = *start++; - } - return pos; - } -}; - -template -struct CopyConstructArray_ { - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(*start); - - if (noexcept(T(*start))) { - while (start != end) { - ctor(*pos++, *start++); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, *start++); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -template -struct CopyConstructArray_ { - // Actually move-construct. - - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(kj::mv(*start)); - - if (noexcept(T(kj::mv(*start)))) { - while (start != end) { - ctor(*pos++, kj::mv(*start++)); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, kj::mv(*start++)); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -} // namespace _ (private) - -template -template -void ArrayBuilder::addAll(Iterator start, Iterator end) { - pos = _::CopyConstructArray_, Decay, move>::apply(pos, start, end); -} - -template -Array heapArray(const T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template Array -heapArray(Iterator begin, Iterator end) { - ArrayBuilder builder = heapArrayBuilder(end - begin); - builder.addAll(begin, end); - return builder.finish(); -} - -template -inline Array heapArray(std::initializer_list init) { - return heapArray(init.begin(), init.end()); -} - -} // namespace kj - -#endif // KJ_ARRAY_H_ diff --git a/external/capnp/include/kj/async-inl.h b/external/capnp/include/kj/async-inl.h deleted file mode 100644 index f11e4fcd5b..0000000000 --- a/external/capnp/include/kj/async-inl.h +++ /dev/null @@ -1,1112 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains extended inline implementation details that are required along with async.h. -// We move this all into a separate file to make async.h more readable. -// -// Non-inline declarations here are defined in async.c++. - -#ifndef KJ_ASYNC_H_ -#error "Do not include this directly; include kj/async.h." -#include "async.h" // help IDE parse this file -#endif - -#ifndef KJ_ASYNC_INL_H_ -#define KJ_ASYNC_INL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { -namespace _ { // private - -template -class ExceptionOr; - -class ExceptionOrValue { -public: - ExceptionOrValue(bool, Exception&& exception): exception(kj::mv(exception)) {} - KJ_DISALLOW_COPY(ExceptionOrValue); - - void addException(Exception&& exception) { - if (this->exception == nullptr) { - this->exception = kj::mv(exception); - } - } - - template - ExceptionOr& as() { return *static_cast*>(this); } - template - const ExceptionOr& as() const { return *static_cast*>(this); } - - Maybe exception; - -protected: - // Allow subclasses to have move constructor / assignment. - ExceptionOrValue() = default; - ExceptionOrValue(ExceptionOrValue&& other) = default; - ExceptionOrValue& operator=(ExceptionOrValue&& other) = default; -}; - -template -class ExceptionOr: public ExceptionOrValue { -public: - ExceptionOr() = default; - ExceptionOr(T&& value): value(kj::mv(value)) {} - ExceptionOr(bool, Exception&& exception): ExceptionOrValue(false, kj::mv(exception)) {} - ExceptionOr(ExceptionOr&&) = default; - ExceptionOr& operator=(ExceptionOr&&) = default; - - Maybe value; -}; - -class Event { - // An event waiting to be executed. Not for direct use by applications -- promises use this - // internally. - -public: - Event(); - ~Event() noexcept(false); - KJ_DISALLOW_COPY(Event); - - void armDepthFirst(); - // Enqueue this event so that `fire()` will be called from the event loop soon. - // - // Events scheduled in this way are executed in depth-first order: if an event callback arms - // more events, those events are placed at the front of the queue (in the order in which they - // were armed), so that they run immediately after the first event's callback returns. - // - // Depth-first event scheduling is appropriate for events that represent simple continuations - // of a previous event that should be globbed together for performance. Depth-first scheduling - // can lead to starvation, so any long-running task must occasionally yield with - // `armBreadthFirst()`. (Promise::then() uses depth-first whereas evalLater() uses - // breadth-first.) - // - // To use breadth-first scheduling instead, use `armBreadthFirst()`. - - void armBreadthFirst(); - // Like `armDepthFirst()` except that the event is placed at the end of the queue. - - kj::String trace(); - // Dump debug info about this event. - - virtual _::PromiseNode* getInnerForTrace(); - // If this event wraps a PromiseNode, get that node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - virtual Maybe> fire() = 0; - // Fire the event. Possibly returns a pointer to itself, which will be discarded by the - // caller. This is the only way that an event can delete itself as a result of firing, as - // doing so from within fire() will throw an exception. - -private: - friend class kj::EventLoop; - EventLoop& loop; - Event* next; - Event** prev; - bool firing = false; -}; - -class PromiseNode { - // A Promise contains a chain of PromiseNodes tracking the pending transformations. - // - // To reduce generated code bloat, PromiseNode is not a template. Instead, it makes very hacky - // use of pointers to ExceptionOrValue which actually point to ExceptionOr, but are only - // so down-cast in the few places that really need to be templated. Luckily this is all - // internal implementation details. - -public: - virtual void onReady(Event& event) noexcept = 0; - // Arms the given event when ready. - - virtual void setSelfPointer(Own* selfPtr) noexcept; - // Tells the node that `selfPtr` is the pointer that owns this node, and will continue to own - // this node until it is destroyed or setSelfPointer() is called again. ChainPromiseNode uses - // this to shorten redundant chains. The default implementation does nothing; only - // ChainPromiseNode should implement this. - - virtual void get(ExceptionOrValue& output) noexcept = 0; - // Get the result. `output` points to an ExceptionOr into which the result will be written. - // Can only be called once, and only after the node is ready. Must be called directly from the - // event loop, with no application code on the stack. - - virtual PromiseNode* getInnerForTrace(); - // If this node wraps some other PromiseNode, get the wrapped node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - class OnReadyEvent { - // Helper class for implementing onReady(). - - public: - void init(Event& newEvent); - // Returns true if arm() was already called. - - void arm(); - // Arms the event if init() has already been called and makes future calls to init() return - // true. - - private: - Event* event = nullptr; - }; -}; - -// ------------------------------------------------------------------- - -class ImmediatePromiseNodeBase: public PromiseNode { -public: - ImmediatePromiseNodeBase(); - ~ImmediatePromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override; -}; - -template -class ImmediatePromiseNode final: public ImmediatePromiseNodeBase { - // A promise that has already been resolved to an immediate value or exception. - -public: - ImmediatePromiseNode(ExceptionOr&& result): result(kj::mv(result)) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -class ImmediateBrokenPromiseNode final: public ImmediatePromiseNodeBase { -public: - ImmediateBrokenPromiseNode(Exception&& exception); - - void get(ExceptionOrValue& output) noexcept override; - -private: - Exception exception; -}; - -// ------------------------------------------------------------------- - -class AttachmentPromiseNodeBase: public PromiseNode { -public: - AttachmentPromiseNodeBase(Own&& dependency); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - - void dropDependency(); - - template - friend class AttachmentPromiseNode; -}; - -template -class AttachmentPromiseNode final: public AttachmentPromiseNodeBase { - // A PromiseNode that holds on to some object (usually, an Own, but could be any movable - // object) until the promise resolves. - -public: - AttachmentPromiseNode(Own&& dependency, Attachment&& attachment) - : AttachmentPromiseNodeBase(kj::mv(dependency)), - attachment(kj::mv(attachment)) {} - - ~AttachmentPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the attachment because the - // dependency may be using the attachment. - dropDependency(); - } - -private: - Attachment attachment; -}; - -// ------------------------------------------------------------------- - -class PtmfHelper { - // This class is a private helper for GetFunctorStartAddress. The class represents the internal - // representation of a pointer-to-member-function. - - template - friend struct GetFunctorStartAddress; - -#if __GNUG__ - - void* ptr; - ptrdiff_t adj; - // Layout of a pointer-to-member-function used by GCC and compatible compilers. - - void* apply(void* obj) { -#if defined(__arm__) || defined(__mips__) || defined(__aarch64__) - if (adj & 1) { - ptrdiff_t voff = (ptrdiff_t)ptr; -#else - ptrdiff_t voff = (ptrdiff_t)ptr; - if (voff & 1) { - voff &= ~1; -#endif - return *(void**)(*(char**)obj + voff); - } else { - return ptr; - } - } - -#define BODY \ - PtmfHelper result; \ - static_assert(sizeof(p) == sizeof(result), "unknown ptmf layout"); \ - memcpy(&result, &p, sizeof(result)); \ - return result - -#else // __GNUG__ - - void* apply(void* obj) { return nullptr; } - // TODO(port): PTMF instruction address extraction - -#define BODY return PtmfHelper{} - -#endif // __GNUG__, else - - template - static PtmfHelper from(F p) { BODY; } - // Create a PtmfHelper from some arbitrary pointer-to-member-function which is not - // overloaded nor a template. In this case the compiler is able to deduce the full function - // signature directly given the name since there is only one function with that name. - - template - static PtmfHelper from(R (C::*p)(NoInfer

...)) { BODY; } - template - static PtmfHelper from(R (C::*p)(NoInfer

...) const) { BODY; } - // Create a PtmfHelper from some poniter-to-member-function which is a template. In this case - // the function must match exactly the containing type C, return type R, and parameter types P... - // GetFunctorStartAddress normally specifies exactly the correct C and R, but can only make a - // guess at P. Luckily, if the function parameters are template parameters then it's not - // necessary to be precise about P. -#undef BODY -}; - -template -struct GetFunctorStartAddress { - // Given a functor (any object defining operator()), return the start address of the function, - // suitable for passing to addr2line to obtain a source file/line for debugging purposes. - // - // This turns out to be incredibly hard to implement in the presence of overloaded or templated - // functors. Therefore, we impose these specific restrictions, specific to our use case: - // - Overloading is not allowed, but templating is. (Generally we only intend to support lambdas - // anyway.) - // - The template parameters to GetFunctorStartAddress specify a hint as to the expected - // parameter types. If the functor is templated, its parameters must match exactly these types. - // (If it's not templated, ParamTypes are ignored.) - - template - static void* apply(Func&& func) { - typedef decltype(func(instance()...)) ReturnType; - return PtmfHelper::from, ParamTypes...>( - &Decay::operator()).apply(&func); - } -}; - -template <> -struct GetFunctorStartAddress: public GetFunctorStartAddress<> {}; -// Hack for TransformPromiseNode use case: an input type of `Void` indicates that the function -// actually has no parameters. - -class TransformPromiseNodeBase: public PromiseNode { -public: - TransformPromiseNodeBase(Own&& dependency, void* continuationTracePtr); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - void* continuationTracePtr; - - void dropDependency(); - void getDepResult(ExceptionOrValue& output); - - virtual void getImpl(ExceptionOrValue& output) = 0; - - template - friend class TransformPromiseNode; -}; - -template -class TransformPromiseNode final: public TransformPromiseNodeBase { - // A PromiseNode that transforms the result of another PromiseNode through an application-provided - // function (implements `then()`). - -public: - TransformPromiseNode(Own&& dependency, Func&& func, ErrorFunc&& errorHandler) - : TransformPromiseNodeBase(kj::mv(dependency), - GetFunctorStartAddress::apply(func)), - func(kj::fwd(func)), errorHandler(kj::fwd(errorHandler)) {} - - ~TransformPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the continuations because it - // is a common pattern for the continuations to hold ownership of objects that might be in-use - // by the dependency. - dropDependency(); - } - -private: - Func func; - ErrorFunc errorHandler; - - void getImpl(ExceptionOrValue& output) override { - ExceptionOr depResult; - getDepResult(depResult); - KJ_IF_MAYBE(depException, depResult.exception) { - output.as() = handle( - MaybeVoidCaller>>::apply( - errorHandler, kj::mv(*depException))); - } else KJ_IF_MAYBE(depValue, depResult.value) { - output.as() = handle(MaybeVoidCaller::apply(func, kj::mv(*depValue))); - } - } - - ExceptionOr handle(T&& value) { - return kj::mv(value); - } - ExceptionOr handle(PropagateException::Bottom&& value) { - return ExceptionOr(false, value.asException()); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase; - -class ForkBranchBase: public PromiseNode { -public: - ForkBranchBase(Own&& hub); - ~ForkBranchBase() noexcept(false); - - void hubReady() noexcept; - // Called by the hub to indicate that it is ready. - - // implements PromiseNode ------------------------------------------ - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -protected: - inline ExceptionOrValue& getHubResultRef(); - - void releaseHub(ExceptionOrValue& output); - // Release the hub. If an exception is thrown, add it to `output`. - -private: - OnReadyEvent onReadyEvent; - - Own hub; - ForkBranchBase* next = nullptr; - ForkBranchBase** prevPtr = nullptr; - - friend class ForkHubBase; -}; - -template T copyOrAddRef(T& t) { return t; } -template Own copyOrAddRef(Own& t) { return t->addRef(); } - -template -class ForkBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - ForkBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = copyOrAddRef(*value); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -template -class SplitBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - SplitBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - typedef kj::Decay(kj::instance()))> Element; - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = kj::mv(kj::get(*value)); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase: public Refcounted, protected Event { -public: - ForkHubBase(Own&& inner, ExceptionOrValue& resultRef); - - inline ExceptionOrValue& getResultRef() { return resultRef; } - -private: - Own inner; - ExceptionOrValue& resultRef; - - ForkBranchBase* headBranch = nullptr; - ForkBranchBase** tailBranch = &headBranch; - // Tail becomes null once the inner promise is ready and all branches have been notified. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - friend class ForkBranchBase; -}; - -template -class ForkHub final: public ForkHubBase { - // A PromiseNode that implements the hub of a fork. The first call to Promise::fork() replaces - // the promise's outer node with a ForkHub, and subsequent calls add branches to that hub (if - // possible). - -public: - ForkHub(Own&& inner): ForkHubBase(kj::mv(inner), result) {} - - Promise<_::UnfixVoid> addBranch() { - return Promise<_::UnfixVoid>(false, kj::heap>(addRef(*this))); - } - - _::SplitTuplePromise split() { - return splitImpl(MakeIndexes()>()); - } - -private: - ExceptionOr result; - - template - _::SplitTuplePromise splitImpl(Indexes) { - return kj::tuple(addSplit()...); - } - - template - Promise::Element>> addSplit() { - return Promise::Element>>( - false, maybeChain(kj::heap>(addRef(*this)), - implicitCast::Element*>(nullptr))); - } -}; - -inline ExceptionOrValue& ForkBranchBase::getHubResultRef() { - return hub->getResultRef(); -} - -// ------------------------------------------------------------------- - -class ChainPromiseNode final: public PromiseNode, public Event { - // Promise node which reduces Promise> to Promise. - // - // `Event` is only a public base class because otherwise we can't cast Own to - // Own. Ugh, templates and private... - -public: - explicit ChainPromiseNode(Own inner); - ~ChainPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void setSelfPointer(Own* selfPtr) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - enum State { - STEP1, - STEP2 - }; - - State state; - - Own inner; - // In STEP1, a PromiseNode for a Promise. - // In STEP2, a PromiseNode for a T. - - Event* onReadyEvent = nullptr; - Own* selfPtr = nullptr; - - Maybe> fire() override; -}; - -template -Own maybeChain(Own&& node, Promise*) { - return heap(kj::mv(node)); -} - -template -Own&& maybeChain(Own&& node, T*) { - return kj::mv(node); -} - -// ------------------------------------------------------------------- - -class ExclusiveJoinPromiseNode final: public PromiseNode { -public: - ExclusiveJoinPromiseNode(Own left, Own right); - ~ExclusiveJoinPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - class Branch: public Event { - public: - Branch(ExclusiveJoinPromiseNode& joinNode, Own dependency); - ~Branch() noexcept(false); - - bool get(ExceptionOrValue& output); - // Returns true if this is the side that finished. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - private: - ExclusiveJoinPromiseNode& joinNode; - Own dependency; - }; - - Branch left; - Branch right; - OnReadyEvent onReadyEvent; -}; - -// ------------------------------------------------------------------- - -class ArrayJoinPromiseNodeBase: public PromiseNode { -public: - ArrayJoinPromiseNodeBase(Array> promises, - ExceptionOrValue* resultParts, size_t partSize); - ~ArrayJoinPromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override final; - void get(ExceptionOrValue& output) noexcept override final; - PromiseNode* getInnerForTrace() override final; - -protected: - virtual void getNoError(ExceptionOrValue& output) noexcept = 0; - // Called to compile the result only in the case where there were no errors. - -private: - uint countLeft; - OnReadyEvent onReadyEvent; - - class Branch final: public Event { - public: - Branch(ArrayJoinPromiseNodeBase& joinNode, Own dependency, - ExceptionOrValue& output); - ~Branch() noexcept(false); - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - Maybe getPart(); - // Calls dependency->get(output). If there was an exception, return it. - - private: - ArrayJoinPromiseNodeBase& joinNode; - Own dependency; - ExceptionOrValue& output; - }; - - Array branches; -}; - -template -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts) - : ArrayJoinPromiseNodeBase(kj::mv(promises), resultParts.begin(), sizeof(ExceptionOr)), - resultParts(kj::mv(resultParts)) {} - -protected: - void getNoError(ExceptionOrValue& output) noexcept override { - auto builder = heapArrayBuilder(resultParts.size()); - for (auto& part: resultParts) { - KJ_IASSERT(part.value != nullptr, - "Bug in KJ promise framework: Promise result had neither value no exception."); - builder.add(kj::mv(*_::readMaybe(part.value))); - } - output.as>() = builder.finish(); - } - -private: - Array> resultParts; -}; - -template <> -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts); - ~ArrayJoinPromiseNode(); - -protected: - void getNoError(ExceptionOrValue& output) noexcept override; - -private: - Array> resultParts; -}; - -// ------------------------------------------------------------------- - -class EagerPromiseNodeBase: public PromiseNode, protected Event { - // A PromiseNode that eagerly evaluates its dependency even if its dependent does not eagerly - // evaluate it. - -public: - EagerPromiseNodeBase(Own&& dependency, ExceptionOrValue& resultRef); - - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - OnReadyEvent onReadyEvent; - - ExceptionOrValue& resultRef; - - Maybe> fire() override; -}; - -template -class EagerPromiseNode final: public EagerPromiseNodeBase { -public: - EagerPromiseNode(Own&& dependency) - : EagerPromiseNodeBase(kj::mv(dependency), result) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -template -Own spark(Own&& node) { - // Forces evaluation of the given node to begin as soon as possible, even if no one is waiting - // on it. - return heap>(kj::mv(node)); -} - -// ------------------------------------------------------------------- - -class AdapterPromiseNodeBase: public PromiseNode { -public: - void onReady(Event& event) noexcept override; - -protected: - inline void setReady() { - onReadyEvent.arm(); - } - -private: - OnReadyEvent onReadyEvent; -}; - -template -class AdapterPromiseNode final: public AdapterPromiseNodeBase, - private PromiseFulfiller> { - // A PromiseNode that wraps a PromiseAdapter. - -public: - template - AdapterPromiseNode(Params&&... params) - : adapter(static_cast>&>(*this), kj::fwd(params)...) {} - - void get(ExceptionOrValue& output) noexcept override { - KJ_IREQUIRE(!isWaiting()); - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; - bool waiting = true; - Adapter adapter; - - void fulfill(T&& value) override { - if (waiting) { - waiting = false; - result = ExceptionOr(kj::mv(value)); - setReady(); - } - } - - void reject(Exception&& exception) override { - if (waiting) { - waiting = false; - result = ExceptionOr(false, kj::mv(exception)); - setReady(); - } - } - - bool isWaiting() override { - return waiting; - } -}; - -} // namespace _ (private) - -// ======================================================================================= - -template -Promise::Promise(_::FixVoid value) - : PromiseBase(heap<_::ImmediatePromiseNode<_::FixVoid>>(kj::mv(value))) {} - -template -Promise::Promise(kj::Exception&& exception) - : PromiseBase(heap<_::ImmediateBrokenPromiseNode>(kj::mv(exception))) {} - -template -template -PromiseForResult Promise::then(Func&& func, ErrorFunc&& errorHandler) { - typedef _::FixVoid<_::ReturnType> ResultT; - - Own<_::PromiseNode> intermediate = - heap<_::TransformPromiseNode, Func, ErrorFunc>>( - kj::mv(node), kj::fwd(func), kj::fwd(errorHandler)); - return PromiseForResult(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); -} - -namespace _ { // private - -template -struct IdentityFunc { - inline T operator()(T&& value) const { - return kj::mv(value); - } -}; -template -struct IdentityFunc> { - inline Promise operator()(T&& value) const { - return kj::mv(value); - } -}; -template <> -struct IdentityFunc { - inline void operator()() const {} -}; -template <> -struct IdentityFunc> { - Promise operator()() const; - // This can't be inline because it will make the translation unit depend on kj-async. Awkwardly, - // Cap'n Proto relies on being able to include this header without creating such a link-time - // dependency. -}; - -} // namespace _ (private) - -template -template -Promise Promise::catch_(ErrorFunc&& errorHandler) { - // then()'s ErrorFunc can only return a Promise if Func also returns a Promise. In this case, - // Func is being filled in automatically. We want to make sure ErrorFunc can return a Promise, - // but we don't want the extra overhead of promise chaining if ErrorFunc doesn't actually - // return a promise. So we make our Func return match ErrorFunc. - return then(_::IdentityFunc()))>(), - kj::fwd(errorHandler)); -} - -template -T Promise::wait(WaitScope& waitScope) { - _::ExceptionOr<_::FixVoid> result; - - waitImpl(kj::mv(node), result, waitScope); - - KJ_IF_MAYBE(value, result.value) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - return _::returnMaybeVoid(kj::mv(*value)); - } else KJ_IF_MAYBE(exception, result.exception) { - throwFatalException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template <> -inline void Promise::wait(WaitScope& waitScope) { - // Override case to use throwRecoverableException(). - - _::ExceptionOr<_::Void> result; - - waitImpl(kj::mv(node), result, waitScope); - - if (result.value != nullptr) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - } else KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template -ForkedPromise Promise::fork() { - return ForkedPromise(false, refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))); -} - -template -Promise ForkedPromise::addBranch() { - return hub->addBranch(); -} - -template -_::SplitTuplePromise Promise::split() { - return refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))->split(); -} - -template -Promise Promise::exclusiveJoin(Promise&& other) { - return Promise(false, heap<_::ExclusiveJoinPromiseNode>(kj::mv(node), kj::mv(other.node))); -} - -template -template -Promise Promise::attach(Attachments&&... attachments) { - return Promise(false, kj::heap<_::AttachmentPromiseNode>>( - kj::mv(node), kj::tuple(kj::fwd(attachments)...))); -} - -template -template -Promise Promise::eagerlyEvaluate(ErrorFunc&& errorHandler) { - // See catch_() for commentary. - return Promise(false, _::spark<_::FixVoid>(then( - _::IdentityFunc()))>(), - kj::fwd(errorHandler)).node)); -} - -template -Promise Promise::eagerlyEvaluate(decltype(nullptr)) { - return Promise(false, _::spark<_::FixVoid>(kj::mv(node))); -} - -template -kj::String Promise::trace() { - return PromiseBase::trace(); -} - -template -inline PromiseForResult evalLater(Func&& func) { - return _::yield().then(kj::fwd(func), _::PropagateException()); -} - -template -inline PromiseForResult evalNow(Func&& func) { - PromiseForResult result = nullptr; - KJ_IF_MAYBE(e, kj::runCatchingExceptions([&]() { - result = func(); - })) { - result = kj::mv(*e); - } - return result; -} - -template -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([](T&&) {}, kj::fwd(errorHandler))); -} - -template <> -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([]() {}, kj::fwd(errorHandler))); -} - -template -Promise> joinPromises(Array>&& promises) { - return Promise>(false, kj::heap<_::ArrayJoinPromiseNode>( - KJ_MAP(p, promises) { return kj::mv(p.node); }, - heapArray<_::ExceptionOr>(promises.size()))); -} - -// ======================================================================================= - -namespace _ { // private - -template -class WeakFulfiller final: public PromiseFulfiller, private kj::Disposer { - // A wrapper around PromiseFulfiller which can be detached. - // - // There are a couple non-trivialities here: - // - If the WeakFulfiller is discarded, we want the promise it fulfills to be implicitly - // rejected. - // - We cannot destroy the WeakFulfiller until the application has discarded it *and* it has been - // detached from the underlying fulfiller, because otherwise the later detach() call will go - // to a dangling pointer. Essentially, WeakFulfiller is reference counted, although the - // refcount never goes over 2 and we manually implement the refcounting because we need to do - // other special things when each side detaches anyway. To this end, WeakFulfiller is its own - // Disposer -- dispose() is called when the application discards its owned pointer to the - // fulfiller and detach() is called when the promise is destroyed. - -public: - KJ_DISALLOW_COPY(WeakFulfiller); - - static kj::Own make() { - WeakFulfiller* ptr = new WeakFulfiller; - return Own(ptr, *ptr); - } - - void fulfill(FixVoid&& value) override { - if (inner != nullptr) { - inner->fulfill(kj::mv(value)); - } - } - - void reject(Exception&& exception) override { - if (inner != nullptr) { - inner->reject(kj::mv(exception)); - } - } - - bool isWaiting() override { - return inner != nullptr && inner->isWaiting(); - } - - void attach(PromiseFulfiller& newInner) { - inner = &newInner; - } - - void detach(PromiseFulfiller& from) { - if (inner == nullptr) { - // Already disposed. - delete this; - } else { - KJ_IREQUIRE(inner == &from); - inner = nullptr; - } - } - -private: - mutable PromiseFulfiller* inner; - - WeakFulfiller(): inner(nullptr) {} - - void disposeImpl(void* pointer) const override { - // TODO(perf): Factor some of this out so it isn't regenerated for every fulfiller type? - - if (inner == nullptr) { - // Already detached. - delete this; - } else { - if (inner->isWaiting()) { - inner->reject(kj::Exception(kj::Exception::Type::FAILED, __FILE__, __LINE__, - kj::heapString("PromiseFulfiller was destroyed without fulfilling the promise."))); - } - inner = nullptr; - } - } -}; - -template -class PromiseAndFulfillerAdapter { -public: - PromiseAndFulfillerAdapter(PromiseFulfiller& fulfiller, - WeakFulfiller& wrapper) - : fulfiller(fulfiller), wrapper(wrapper) { - wrapper.attach(fulfiller); - } - - ~PromiseAndFulfillerAdapter() noexcept(false) { - wrapper.detach(fulfiller); - } - -private: - PromiseFulfiller& fulfiller; - WeakFulfiller& wrapper; -}; - -} // namespace _ (private) - -template -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams) { - return Promise(false, heap<_::AdapterPromiseNode<_::FixVoid, Adapter>>( - kj::fwd(adapterConstructorParams)...)); -} - -template -PromiseFulfillerPair newPromiseAndFulfiller() { - auto wrapper = _::WeakFulfiller::make(); - - Own<_::PromiseNode> intermediate( - heap<_::AdapterPromiseNode<_::FixVoid, _::PromiseAndFulfillerAdapter>>(*wrapper)); - Promise<_::JoinPromises> promise(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); - - return PromiseFulfillerPair { kj::mv(promise), kj::mv(wrapper) }; -} - -} // namespace kj - -#endif // KJ_ASYNC_INL_H_ diff --git a/external/capnp/include/kj/async-io.h b/external/capnp/include/kj/async-io.h deleted file mode 100644 index 2804ed7289..0000000000 --- a/external/capnp/include/kj/async-io.h +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_IO_H_ -#define KJ_ASYNC_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "function.h" -#include "thread.h" -#include "time.h" - -struct sockaddr; - -namespace kj { - -#if _WIN32 -class Win32EventPort; -#else -class UnixEventPort; -#endif - -class NetworkAddress; -class AsyncOutputStream; - -// ======================================================================================= -// Streaming I/O - -class AsyncInputStream { - // Asynchronous equivalent of InputStream (from io.h). - -public: - virtual Promise read(void* buffer, size_t minBytes, size_t maxBytes); - virtual Promise tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - - Promise read(void* buffer, size_t bytes); - - virtual Maybe tryGetLength(); - // Get the remaining number of bytes that will be produced by this stream, if known. - // - // This is used e.g. to fill in the Content-Length header of an HTTP message. If unknown, the - // HTTP implementation may need to fall back to Transfer-Encoding: chunked. - // - // The default implementation always returns null. - - virtual Promise pumpTo( - AsyncOutputStream& output, uint64_t amount = kj::maxValue); - // Read `amount` bytes from this stream (or to EOF) and write them to `output`, returning the - // total bytes actually pumped (which is only less than `amount` if EOF was reached). - // - // Override this if your stream type knows how to pump itself to certain kinds of output - // streams more efficiently than via the naive approach. You can use - // kj::dynamicDowncastIfAvailable() to test for stream types you recognize, and if none match, - // delegate to the default implementation. - // - // The default implementation first tries calling output.tryPumpFrom(), but if that fails, it - // performs a naive pump by allocating a buffer and reading to it / writing from it in a loop. - - Promise> readAllBytes(); - Promise readAllText(); - // Read until EOF and return as one big byte array or string. -}; - -class AsyncOutputStream { - // Asynchronous equivalent of OutputStream (from io.h). - -public: - virtual Promise write(const void* buffer, size_t size) KJ_WARN_UNUSED_RESULT = 0; - virtual Promise write(ArrayPtr> pieces) - KJ_WARN_UNUSED_RESULT = 0; - - virtual Maybe> tryPumpFrom( - AsyncInputStream& input, uint64_t amount = kj::maxValue); - // Implements double-dispatch for AsyncInputStream::pumpTo(). - // - // This method should only be called from within an implementation of pumpTo(). - // - // This method examines the type of `input` to find optimized ways to pump data from it to this - // output stream. If it finds one, it performs the pump. Otherwise, it returns null. - // - // The default implementation always returns null. -}; - -class AsyncIoStream: public AsyncInputStream, public AsyncOutputStream { - // A combination input and output stream. - -public: - virtual void shutdownWrite() = 0; - // Cleanly shut down just the write end of the stream, while keeping the read end open. - - virtual void abortRead() {} - // Similar to shutdownWrite, but this will shut down the read end of the stream, and should only - // be called when an error has occurred. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception - // if the stream is not a socket or the option is not appropriate for the socket type. The - // default implementations always throw "unimplemented". - - virtual void getsockname(struct sockaddr* addr, uint* length); - virtual void getpeername(struct sockaddr* addr, uint* length); - // Corresponds to getsockname() and getpeername() syscalls. Will throw an "unimplemented" - // exception if the stream is not a socket. The default implementations always throw - // "unimplemented". - // - // Note that we don't provide methods that return NetworkAddress because it usually wouldn't - // be useful. You can't connect() to or listen() on these addresses, obviously, because they are - // ephemeral addresses for a single connection. -}; - -struct OneWayPipe { - // A data pipe with an input end and an output end. (Typically backed by pipe() system call.) - - Own in; - Own out; -}; - -struct TwoWayPipe { - // A data pipe that supports sending in both directions. Each end's output sends data to the - // other end's input. (Typically backed by socketpair() system call.) - - Own ends[2]; -}; - -class ConnectionReceiver { - // Represents a server socket listening on a port. - -public: - virtual Promise> accept() = 0; - // Accept the next incoming connection. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Datagram I/O - -class AncillaryMessage { - // Represents an ancillary message (aka control message) received using the recvmsg() system - // call (or equivalent). Most apps will not use this. - -public: - inline AncillaryMessage(int level, int type, ArrayPtr data); - AncillaryMessage() = default; - - inline int getLevel() const; - // Originating protocol / socket level. - - inline int getType() const; - // Protocol-specific message type. - - template - inline Maybe as(); - // Interpret the ancillary message as the given struct type. Most ancillary messages are some - // sort of struct, so this is a convenient way to access it. Returns nullptr if the message - // is smaller than the struct -- this can happen if the message was truncated due to - // insufficient ancillary buffer space. - - template - inline ArrayPtr asArray(); - // Interpret the ancillary message as an array of items. If the message size does not evenly - // divide into elements of type T, the remainder is discarded -- this can happen if the message - // was truncated due to insufficient ancillary buffer space. - -private: - int level; - int type; - ArrayPtr data; - // Message data. In most cases you should use `as()` or `asArray()`. -}; - -class DatagramReceiver { - // Class encapsulating the recvmsg() system call. You must specify the DatagramReceiver's - // capacity in advance; if a received packet is larger than the capacity, it will be truncated. - -public: - virtual Promise receive() = 0; - // Receive a new message, overwriting this object's content. - // - // receive() may reuse the same buffers for content and ancillary data with each call. - - template - struct MaybeTruncated { - T value; - - bool isTruncated; - // True if the Receiver's capacity was insufficient to receive the value and therefore the - // value is truncated. - }; - - virtual MaybeTruncated> getContent() = 0; - // Get the content of the datagram. - - virtual MaybeTruncated> getAncillary() = 0; - // Ancilarry messages received with the datagram. See the recvmsg() system call and the cmsghdr - // struct. Most apps don't need this. - // - // If the returned value is truncated, then the last message in the array may itself be - // truncated, meaning its as() method will return nullptr or its asArray() method will - // return fewer elements than expected. Truncation can also mean that additional messages were - // available but discarded. - - virtual NetworkAddress& getSource() = 0; - // Get the datagram sender's address. - - struct Capacity { - size_t content = 8192; - // How much space to allocate for the datagram content. If a datagram is received that is - // larger than this, it will be truncated, with no way to recover the tail. - - size_t ancillary = 0; - // How much space to allocate for ancillary messages. As with content, if the ancillary data - // is larger than this, it will be truncated. - }; -}; - -class DatagramPort { -public: - virtual Promise send(const void* buffer, size_t size, NetworkAddress& destination) = 0; - virtual Promise send(ArrayPtr> pieces, - NetworkAddress& destination) = 0; - - virtual Own makeReceiver( - DatagramReceiver::Capacity capacity = DatagramReceiver::Capacity()) = 0; - // Create a new `Receiver` that can be used to receive datagrams. `capacity` specifies how much - // space to allocate for the received message. The `DatagramPort` must outlive the `Receiver`. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Networks - -class NetworkAddress { - // Represents a remote address to which the application can connect. - -public: - virtual Promise> connect() = 0; - // Make a new connection to this address. - // - // The address must not be a wildcard ("*"). If it is an IP address, it must have a port number. - - virtual Own listen() = 0; - // Listen for incoming connections on this address. - // - // The address must be local. - - virtual Own bindDatagramPort(); - // Open this address as a datagram (e.g. UDP) port. - // - // The address must be local. - - virtual Own clone() = 0; - // Returns an equivalent copy of this NetworkAddress. - - virtual String toString() = 0; - // Produce a human-readable string which hopefully can be passed to Network::parseAddress() - // to reproduce this address, although whether or not that works of course depends on the Network - // implementation. This should be called only to display the address to human users, who will - // hopefully know what they are able to do with it. -}; - -class Network { - // Factory for NetworkAddress instances, representing the network services offered by the - // operating system. - // - // This interface typically represents broad authority, and well-designed code should limit its - // use to high-level startup code and user interaction. Low-level APIs should accept - // NetworkAddress instances directly and work from there, if at all possible. - -public: - virtual Promise> parseAddress(StringPtr addr, uint portHint = 0) = 0; - // Construct a network address from a user-provided string. The format of the address - // strings is not specified at the API level, and application code should make no assumptions - // about them. These strings should always be provided by humans, and said humans will know - // what format to use in their particular context. - // - // `portHint`, if provided, specifies the "standard" IP port number for the application-level - // service in play. If the address turns out to be an IP address (v4 or v6), and it lacks a - // port number, this port will be used. If `addr` lacks a port number *and* `portHint` is - // omitted, then the returned address will only support listen() and bindDatagramPort() - // (not connect()), and an unused port will be chosen each time one of those methods is called. - - virtual Own getSockaddr(const void* sockaddr, uint len) = 0; - // Construct a network address from a legacy struct sockaddr. -}; - -// ======================================================================================= -// I/O Provider - -class AsyncIoProvider { - // Class which constructs asynchronous wrappers around the operating system's I/O facilities. - // - // Generally, the implementation of this interface must integrate closely with a particular - // `EventLoop` implementation. Typically, the EventLoop implementation itself will provide - // an AsyncIoProvider. - -public: - virtual OneWayPipe newOneWayPipe() = 0; - // Creates an input/output stream pair representing the ends of a one-way pipe (e.g. created with - // the pipe(2) system call). - - virtual TwoWayPipe newTwoWayPipe() = 0; - // Creates two AsyncIoStreams representing the two ends of a two-way pipe (e.g. created with - // socketpair(2) system call). Data written to one end can be read from the other. - - virtual Network& getNetwork() = 0; - // Creates a new `Network` instance representing the networks exposed by the operating system. - // - // DO NOT CALL THIS except at the highest levels of your code, ideally in the main() function. If - // you call this from low-level code, then you are preventing higher-level code from injecting an - // alternative implementation. Instead, if your code needs to use network functionality, it - // should ask for a `Network` as a constructor or method parameter, so that higher-level code can - // chose what implementation to use. The system network is essentially a singleton. See: - // http://www.object-oriented-security.org/lets-argue/singletons - // - // Code that uses the system network should not make any assumptions about what kinds of - // addresses it will parse, as this could differ across platforms. String addresses should come - // strictly from the user, who will know how to write them correctly for their system. - // - // With that said, KJ currently supports the following string address formats: - // - IPv4: "1.2.3.4", "1.2.3.4:80" - // - IPv6: "1234:5678::abcd", "[1234:5678::abcd]:80" - // - Local IP wildcard (covers both v4 and v6): "*", "*:80" - // - Symbolic names: "example.com", "example.com:80", "example.com:http", "1.2.3.4:http" - // - Unix domain: "unix:/path/to/socket" - - struct PipeThread { - // A combination of a thread and a two-way pipe that communicates with that thread. - // - // The fields are intentionally ordered so that the pipe will be destroyed (and therefore - // disconnected) before the thread is destroyed (and therefore joined). Thus if the thread - // arranges to exit when it detects disconnect, destruction should be clean. - - Own thread; - Own pipe; - }; - - virtual PipeThread newPipeThread( - Function startFunc) = 0; - // Create a new thread and set up a two-way pipe (socketpair) which can be used to communicate - // with it. One end of the pipe is passed to the thread's start function and the other end of - // the pipe is returned. The new thread also gets its own `AsyncIoProvider` instance and will - // already have an active `EventLoop` when `startFunc` is called. - // - // TODO(someday): I'm not entirely comfortable with this interface. It seems to be doing too - // much at once but I'm not sure how to cleanly break it down. - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -class LowLevelAsyncIoProvider { - // Similar to `AsyncIoProvider`, but represents a lower-level interface that may differ on - // different operating systems. You should prefer to use `AsyncIoProvider` over this interface - // whenever possible, as `AsyncIoProvider` is portable and friendlier to dependency-injection. - // - // On Unix, this interface can be used to import native file descriptors into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as poll vs. epoll vs. kqueue vs. some higher-level event library. - // - // On Windows, this interface can be used to import native HANDLEs into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as I/O completion ports vs. completion routines. - // - // TODO(port): Actually implement Windows support. - -public: - // --------------------------------------------------------------------------- - // Unix-specific stuff - - enum Flags { - // Flags controlling how to wrap a file descriptor. - - TAKE_OWNERSHIP = 1 << 0, - // The returned object should own the file descriptor, automatically closing it when destroyed. - // The close-on-exec flag will be set on the descriptor if it is not already. - // - // If this flag is not used, then the file descriptor is not automatically closed and the - // close-on-exec flag is not modified. - -#if !_WIN32 - ALREADY_CLOEXEC = 1 << 1, - // Indicates that the close-on-exec flag is known already to be set, so need not be set again. - // Only relevant when combined with TAKE_OWNERSHIP. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // set the close-on-exec flag immediately. Unfortunately, other OS's do not. - - ALREADY_NONBLOCK = 1 << 2 - // Indicates that the file descriptor is known already to be in non-blocking mode, so the flag - // need not be set again. Otherwise, all wrap*Fd() methods will enable non-blocking mode - // automatically. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // enable non-blocking mode immediately. Unfortunately, other OS's do not. -#endif - }; - -#if _WIN32 - typedef uintptr_t Fd; - // On Windows, the `fd` parameter to each of these methods must be a SOCKET, and must have the - // flag WSA_FLAG_OVERLAPPED (which socket() uses by default, but WSASocket() wants you to specify - // explicitly). -#else - typedef int Fd; - // On Unix, any arbitrary file descriptor is supported. -#endif - - virtual Own wrapInputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncInputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapOutputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncOutputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Promise> wrapConnectingSocketFd( - Fd fd, const struct sockaddr* addr, uint addrlen, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket and initiate a connection to the given address. - // The returned promise does not resolve until connection has completed. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapListenSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a listen socket file descriptor. This socket should already - // have had `bind()` and `listen()` called on it, so it's ready for `accept()`. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapDatagramSocketFd(Fd fd, uint flags = 0); - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -Own newAsyncIoProvider(LowLevelAsyncIoProvider& lowLevel); -// Make a new AsyncIoProvider wrapping a `LowLevelAsyncIoProvider`. - -struct AsyncIoContext { - Own lowLevelProvider; - Own provider; - WaitScope& waitScope; - -#if _WIN32 - Win32EventPort& win32EventPort; -#else - UnixEventPort& unixEventPort; - // TEMPORARY: Direct access to underlying UnixEventPort, mainly for waiting on signals. This - // field will go away at some point when we have a chance to improve these interfaces. -#endif -}; - -AsyncIoContext setupAsyncIo(); -// Convenience method which sets up the current thread with everything it needs to do async I/O. -// The returned objects contain an `EventLoop` which is wrapping an appropriate `EventPort` for -// doing I/O on the host system, so everything is ready for the thread to start making async calls -// and waiting on promises. -// -// You would typically call this in your main() loop or in the start function of a thread. -// Example: -// -// int main() { -// auto ioContext = kj::setupAsyncIo(); -// -// // Now we can call an async function. -// Promise textPromise = getHttp(*ioContext.provider, "http://example.com"); -// -// // And we can wait for the promise to complete. Note that you can only use `wait()` -// // from the top level, not from inside a promise callback. -// String text = textPromise.wait(ioContext.waitScope); -// print(text); -// return 0; -// } -// -// WARNING: An AsyncIoContext can only be used in the thread and process that created it. In -// particular, note that after a fork(), an AsyncIoContext created in the parent process will -// not work correctly in the child, even if the parent ceases to use its copy. In particular -// note that this means that server processes which daemonize themselves at startup must wait -// until after daemonization to create an AsyncIoContext. - -// ======================================================================================= -// inline implementation details - -inline AncillaryMessage::AncillaryMessage( - int level, int type, ArrayPtr data) - : level(level), type(type), data(data) {} - -inline int AncillaryMessage::getLevel() const { return level; } -inline int AncillaryMessage::getType() const { return type; } - -template -inline Maybe AncillaryMessage::as() { - if (data.size() >= sizeof(T)) { - return *reinterpret_cast(data.begin()); - } else { - return nullptr; - } -} - -template -inline ArrayPtr AncillaryMessage::asArray() { - return arrayPtr(reinterpret_cast(data.begin()), data.size() / sizeof(T)); -} - -} // namespace kj - -#endif // KJ_ASYNC_IO_H_ diff --git a/external/capnp/include/kj/async-prelude.h b/external/capnp/include/kj/async-prelude.h deleted file mode 100644 index 0a5843f88a..0000000000 --- a/external/capnp/include/kj/async-prelude.h +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before async.h can start. -// We don't define these directly in async.h because it makes the file hard to read. - -#ifndef KJ_ASYNC_PRELUDE_H_ -#define KJ_ASYNC_PRELUDE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "exception.h" -#include "tuple.h" - -namespace kj { - -class EventLoop; -template -class Promise; -class WaitScope; - -template -Promise> joinPromises(Array>&& promises); -Promise joinPromises(Array>&& promises); - -namespace _ { // private - -template struct JoinPromises_ { typedef T Type; }; -template struct JoinPromises_> { typedef T Type; }; - -template -using JoinPromises = typename JoinPromises_::Type; -// If T is Promise, resolves to U, otherwise resolves to T. -// -// TODO(cleanup): Rename to avoid confusion with joinPromises() call which is completely -// unrelated. - -class PropagateException { - // A functor which accepts a kj::Exception as a parameter and returns a broken promise of - // arbitrary type which simply propagates the exception. -public: - class Bottom { - public: - Bottom(Exception&& exception): exception(kj::mv(exception)) {} - - Exception asException() { return kj::mv(exception); } - - private: - Exception exception; - }; - - Bottom operator()(Exception&& e) { - return Bottom(kj::mv(e)); - } - Bottom operator()(const Exception& e) { - return Bottom(kj::cp(e)); - } -}; - -template -struct ReturnType_ { typedef decltype(instance()(instance())) Type; }; -template -struct ReturnType_ { typedef decltype(instance()()) Type; }; - -template -using ReturnType = typename ReturnType_::Type; -// The return type of functor Func given a parameter of type T, with the special exception that if -// T is void, this is the return type of Func called with no arguments. - -template struct SplitTuplePromise_ { typedef Promise Type; }; -template -struct SplitTuplePromise_> { - typedef kj::Tuple>...> Type; -}; - -template -using SplitTuplePromise = typename SplitTuplePromise_::Type; -// T -> Promise -// Tuple -> Tuple> - -struct Void {}; -// Application code should NOT refer to this! See `kj::READY_NOW` instead. - -template struct FixVoid_ { typedef T Type; }; -template <> struct FixVoid_ { typedef Void Type; }; -template using FixVoid = typename FixVoid_::Type; -// FixVoid is just T unless T is void in which case it is _::Void (an empty struct). - -template struct UnfixVoid_ { typedef T Type; }; -template <> struct UnfixVoid_ { typedef void Type; }; -template using UnfixVoid = typename UnfixVoid_::Type; -// UnfixVoid is the opposite of FixVoid. - -template -struct MaybeVoidCaller { - // Calls the function converting a Void input to an empty parameter list and a void return - // value to a Void output. - - template - static inline Out apply(Func& func, In&& in) { - return func(kj::mv(in)); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, In& in) { - return func(in); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, Void&& in) { - return func(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In&& in) { - func(kj::mv(in)); - return Void(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In& in) { - func(in); - return Void(); - } -}; -template <> -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, Void&& in) { - func(); - return Void(); - } -}; - -template -inline T&& returnMaybeVoid(T&& t) { - return kj::fwd(t); -} -inline void returnMaybeVoid(Void&& v) {} - -class ExceptionOrValue; -class PromiseNode; -class ChainPromiseNode; -template -class ForkHub; - -class TaskSetImpl; - -class Event; - -class PromiseBase { -public: - kj::String trace(); - // Dump debug info about this promise. - -private: - Own node; - - PromiseBase() = default; - PromiseBase(Own&& node): node(kj::mv(node)) {} - - friend class kj::EventLoop; - friend class ChainPromiseNode; - template - friend class kj::Promise; - friend class TaskSetImpl; - template - friend Promise> kj::joinPromises(Array>&& promises); - friend Promise kj::joinPromises(Array>&& promises); -}; - -void detach(kj::Promise&& promise); -void waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, WaitScope& waitScope); -Promise yield(); -Own neverDone(); - -class NeverDone { -public: - template - operator Promise() const { - return Promise(false, neverDone()); - } - - KJ_NORETURN(void wait(WaitScope& waitScope) const); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_ASYNC_PRELUDE_H_ diff --git a/external/capnp/include/kj/async-unix.h b/external/capnp/include/kj/async-unix.h deleted file mode 100644 index 06f128a50e..0000000000 --- a/external/capnp/include/kj/async-unix.h +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_UNIX_H_ -#define KJ_ASYNC_UNIX_H_ - -#if _WIN32 -#error "This file is Unix-specific. On Windows, include async-win32.h instead." -#endif - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "time.h" -#include "vector.h" -#include "io.h" -#include - -#if __linux__ && !__BIONIC__ && !defined(KJ_USE_EPOLL) -// Default to epoll on Linux, except on Bionic (Android) which doesn't have signalfd.h. -#define KJ_USE_EPOLL 1 -#endif - -namespace kj { - -class UnixEventPort: public EventPort { - // An EventPort implementation which can wait for events on file descriptors as well as signals. - // This API only makes sense on Unix. - // - // The implementation uses `poll()` or possibly a platform-specific API (e.g. epoll, kqueue). - // To also wait on signals without race conditions, the implementation may block signals until - // just before `poll()` while using a signal handler which `siglongjmp()`s back to just before - // the signal was unblocked, or it may use a nicer platform-specific API like signalfd. - // - // The implementation reserves a signal for internal use. By default, it uses SIGUSR1. If you - // need to use SIGUSR1 for something else, you must offer a different signal by calling - // setReservedSignal() at startup. - // - // WARNING: A UnixEventPort can only be used in the thread and process that created it. In - // particular, note that after a fork(), a UnixEventPort created in the parent process will - // not work correctly in the child, even if the parent ceases to use its copy. In particular - // note that this means that server processes which daemonize themselves at startup must wait - // until after daemonization to create a UnixEventPort. - -public: - UnixEventPort(); - ~UnixEventPort() noexcept(false); - - class FdObserver; - // Class that watches an fd for readability or writability. See definition below. - - Promise onSignal(int signum); - // When the given signal is delivered to this thread, return the corresponding siginfo_t. - // The signal must have been captured using `captureSignal()`. - // - // If `onSignal()` has not been called, the signal will remain blocked in this thread. - // Therefore, a signal which arrives before `onSignal()` was called will not be "missed" -- the - // next call to 'onSignal()' will receive it. Also, you can control which thread receives a - // process-wide signal by only calling `onSignal()` on that thread's event loop. - // - // The result of waiting on the same signal twice at once is undefined. - - static void captureSignal(int signum); - // Arranges for the given signal to be captured and handled via UnixEventPort, so that you may - // then pass it to `onSignal()`. This method is static because it registers a signal handler - // which applies process-wide. If any other threads exist in the process when `captureSignal()` - // is called, you *must* set the signal mask in those threads to block this signal, otherwise - // terrible things will happen if the signal happens to be delivered to those threads. If at - // all possible, call `captureSignal()` *before* creating threads, so that threads you create in - // the future will inherit the proper signal mask. - // - // To un-capture a signal, simply install a different signal handler and then un-block it from - // the signal mask. - - static void setReservedSignal(int signum); - // Sets the signal number which `UnixEventPort` reserves for internal use. If your application - // needs to use SIGUSR1, call this at startup (before any calls to `captureSignal()` and before - // constructing an `UnixEventPort`) to offer a different signal. - - Timer& getTimer() { return timerImpl; } - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - -private: - struct TimerSet; // Defined in source file to avoid STL include. - class TimerPromiseAdapter; - class SignalPromiseAdapter; - - TimerImpl timerImpl; - - SignalPromiseAdapter* signalHead = nullptr; - SignalPromiseAdapter** signalTail = &signalHead; - - TimePoint readClock(); - void gotSignal(const siginfo_t& siginfo); - - friend class TimerPromiseAdapter; - -#if KJ_USE_EPOLL - AutoCloseFd epollFd; - AutoCloseFd signalFd; - AutoCloseFd eventFd; // Used for cross-thread wakeups. - - sigset_t signalFdSigset; - // Signal mask as currently set on the signalFd. Tracked so we can detect whether or not it - // needs updating. - - bool doEpollWait(int timeout); - -#else - class PollContext; - - FdObserver* observersHead = nullptr; - FdObserver** observersTail = &observersHead; - - unsigned long long threadId; // actually pthread_t -#endif -}; - -class UnixEventPort::FdObserver { - // Object which watches a file descriptor to determine when it is readable or writable. - // - // For listen sockets, "readable" means that there is a connection to accept(). For everything - // else, it means that read() (or recv()) will return data. - // - // The presence of out-of-band data should NOT fire this event. However, the event may - // occasionally fire spuriously (when there is actually no data to read), and one thing that can - // cause such spurious events is the arrival of OOB data on certain platforms whose event - // interfaces fail to distinguish between regular and OOB data (e.g. Mac OSX). - // - // WARNING: The exact behavior of this class differs across systems, since event interfaces - // vary wildly. Be sure to read the documentation carefully and avoid depending on unspecified - // behavior. If at all possible, use the higher-level AsyncInputStream interface instead. - -public: - enum Flags { - OBSERVE_READ = 1, - OBSERVE_WRITE = 2, - OBSERVE_URGENT = 4, - OBSERVE_READ_WRITE = OBSERVE_READ | OBSERVE_WRITE - }; - - FdObserver(UnixEventPort& eventPort, int fd, uint flags); - // Begin watching the given file descriptor for readability. Only one ReadObserver may exist - // for a given file descriptor at a time. - - ~FdObserver() noexcept(false); - - KJ_DISALLOW_COPY(FdObserver); - - Promise whenBecomesReadable(); - // Resolves the next time the file descriptor transitions from having no data to read to having - // some data to read. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already data in the read buffer which has been there since - // prior to the last turn of the event loop or prior to creation FdWatcher. In this case, it is - // unspecified whether the promise will ever resolve -- it depends on the underlying event - // mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesReadable()` - // only at times when you know the buffer is empty. You know this for sure when one of the - // following happens: - // * read() or recv() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * The file descriptor is a regular byte-oriented object (like a socket or pipe), - // read() or recv() returns fewer than the number of bytes requested, and `atEndHint()` - // returns false. This can only happen if the buffer is empty but EOF is not reached. (Note, - // though, that for record-oriented file descriptors like Linux's inotify interface, this - // rule does not hold, because it could simply be that the next record did not fit into the - // space available.) - // - // It is an error to call `whenBecomesReadable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - inline Maybe atEndHint() { return atEnd; } - // Returns true if the event system has indicated that EOF has been received. There may still - // be data in the read buffer, but once that is gone, there's nothing left. - // - // Returns false if the event system has indicated that EOF had NOT been received as of the - // last turn of the event loop. - // - // Returns nullptr if the event system does not know whether EOF has been reached. In this - // case, the only way to know for sure is to call read() or recv() and check if it returns - // zero. - // - // This hint may be useful as an optimization to avoid an unnecessary system call. - - Promise whenBecomesWritable(); - // Resolves the next time the file descriptor transitions from having no space available in the - // write buffer to having some space available. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already space in the write buffer which has been there - // since prior to the last turn of the event loop or prior to creation FdWatcher. In this case, - // it is unspecified whether the promise will ever resolve -- it depends on the underlying - // event mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesWritable()` - // only at times when you know the buffer is full. You know this for sure when one of the - // following happens: - // * write() or send() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * write() or send() succeeds but accepts fewer than the number of bytes provided. This can - // only happen if the buffer is full. - // - // It is an error to call `whenBecomesWritable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - Promise whenUrgentDataAvailable(); - // Resolves the next time the file descriptor's read buffer contains "urgent" data. - // - // The conditions for availability of urgent data are specific to the file descriptor's - // underlying implementation. - // - // It is an error to call `whenUrgentDataAvailable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - // - // WARNING: This has some known weird behavior on macOS. See - // https://github.com/sandstorm-io/capnproto/issues/374. - -private: - UnixEventPort& eventPort; - int fd; - uint flags; - - kj::Maybe>> readFulfiller; - kj::Maybe>> writeFulfiller; - kj::Maybe>> urgentFulfiller; - // Replaced each time `whenBecomesReadable()` or `whenBecomesWritable()` is called. Reverted to - // null every time an event is fired. - - Maybe atEnd; - - void fire(short events); - -#if !KJ_USE_EPOLL - FdObserver* next; - FdObserver** prev; - // Linked list of observers which currently have a non-null readFulfiller or writeFulfiller. - // If `prev` is null then the observer is not currently in the list. - - short getEventMask(); -#endif - - friend class UnixEventPort; -}; - -} // namespace kj - -#endif // KJ_ASYNC_UNIX_H_ diff --git a/external/capnp/include/kj/async-win32.h b/external/capnp/include/kj/async-win32.h deleted file mode 100644 index b70c42e016..0000000000 --- a/external/capnp/include/kj/async-win32.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_WIN32_H_ -#define KJ_ASYNC_WIN32_H_ - -#if !_WIN32 -#error "This file is Windows-specific. On Unix, include async-unix.h instead." -#endif - -#include "async.h" -#include "time.h" -#include "io.h" -#include -#include - -// Include windows.h as lean as possible. (If you need more of the Windows API for your app, -// #include windows.h yourself before including this header.) -#define WIN32_LEAN_AND_MEAN 1 -#define NOSERVICE 1 -#define NOMCX 1 -#define NOIME 1 -#include -#include "windows-sanity.h" - -namespace kj { - -class Win32EventPort: public EventPort { - // Abstract base interface for EventPorts that can listen on Win32 event types. Due to the - // absurd complexity of the Win32 API, it's not possible to standardize on a single - // implementation of EventPort. In particular, there is no way for a single thread to use I/O - // completion ports (the most efficient way of handling I/O) while at the same time waiting for - // signalable handles or UI messages. - // - // Note that UI messages are not supported at all by this interface because the message queue - // is implemented by user32.dll and we want libkj to depend only on kernel32.dll. A separate - // compat library could provide a Win32EventPort implementation that works with the UI message - // queue. - -public: - // --------------------------------------------------------------------------- - // overlapped I/O - - struct IoResult { - DWORD errorCode; - DWORD bytesTransferred; - }; - - class IoOperation { - public: - virtual LPOVERLAPPED getOverlapped() = 0; - // Gets the OVERLAPPED structure to pass to the Win32 I/O call. Do NOT modify it; just pass it - // on. - - virtual Promise onComplete() = 0; - // After making the Win32 call, if the return value indicates that the operation was - // successfully queued (i.e. the completion event will definitely occur), call this to wait - // for completion. - // - // You MUST call this if the operation was successfully queued, and you MUST NOT call this - // otherwise. If the Win32 call failed (without queuing any operation or event) then you should - // simply drop the IoOperation object. - // - // Dropping the returned Promise cancels the operation via Win32's CancelIoEx(). The destructor - // will wait for the cancellation to complete, such that after dropping the proimse it is safe - // to free the buffer that the operation was reading from / writing to. - // - // You may safely drop the `IoOperation` while still waiting for this promise. You may not, - // however, drop the `IoObserver`. - }; - - class IoObserver { - public: - virtual Own newOperation(uint64_t offset) = 0; - // Begin an I/O operation. For file operations, `offset` is the offset within the file at - // which the operation will start. For stream operations, `offset` is ignored. - }; - - virtual Own observeIo(HANDLE handle) = 0; - // Given a handle which supports overlapped I/O, arrange to receive I/O completion events via - // this EventPort. - // - // Different Win32EventPort implementations may handle this in different ways, such as by using - // completion routines (APCs) or by using I/O completion ports. The caller should not assume - // any particular technique. - // - // WARNING: It is only safe to call observeIo() on a particular handle once during its lifetime. - // You cannot observe the same handle from multiple Win32EventPorts, even if not at the same - // time. This is because the Win32 API provides no way to disassociate a handle from an I/O - // completion port once it is associated. - - // --------------------------------------------------------------------------- - // signalable handles - // - // Warning: Due to limitations in the Win32 API, implementations of EventPort may be forced to - // spawn additional threads to wait for signaled objects. This is necessary if the EventPort - // implementation is based on I/O completion ports, or if you need to wait on more than 64 - // handles at once. - - class SignalObserver { - public: - virtual Promise onSignaled() = 0; - // Returns a promise that completes the next time the handle enters the signaled state. - // - // Depending on the type of handle, the handle may automatically be reset to a non-signaled - // state before the promise resolves. The underlying implementaiton uses WaitForSingleObject() - // or an equivalent wait call, so check the documentation for that to understand the semantics. - // - // If the handle is a mutex and it is abandoned without being unlocked, the promise breaks with - // an exception. - - virtual Promise onSignaledOrAbandoned() = 0; - // Like onSingaled(), but instead of throwing when a mutex is abandoned, resolves to `true`. - // Resolves to `false` for non-abandoned signals. - }; - - virtual Own observeSignalState(HANDLE handle) = 0; - // Given a handle that supports waiting for it to become "signaled" via WaitForSingleObject(), - // return an object that can wait for this state using the EventPort. - - // --------------------------------------------------------------------------- - // APCs - - virtual void allowApc() = 0; - // If this is ever called, the Win32EventPort will switch modes so that APCs can be scheduled - // on the thread, e.g. through the Win32 QueueUserAPC() call. In the future, this may be enabled - // by default. However, as of this writing, Wine does not support the necessary - // GetQueuedCompletionStatusEx() call, thus allowApc() breaks Wine support. (Tested on Wine - // 1.8.7.) - // - // If the event port implementation can't support APCs for some reason, this throws. - - // --------------------------------------------------------------------------- - // time - - virtual Timer& getTimer() = 0; -}; - -class Win32WaitObjectThreadPool { - // Helper class that implements Win32EventPort::observeSignalState() by spawning additional - // threads as needed to perform the actual waiting. - // - // This class is intended to be used to assist in building Win32EventPort implementations. - -public: - Win32WaitObjectThreadPool(uint mainThreadCount = 0); - // `mainThreadCount` indicates the number of objects the main thread is able to listen on - // directly. Typically this would be zero (e.g. if the main thread watches an I/O completion - // port) or MAXIMUM_WAIT_OBJECTS (e.g. if the main thread is a UI thread but can use - // MsgWaitForMultipleObjectsEx() to wait on some handles at the same time as messages). - - Own observeSignalState(HANDLE handle); - // Implemetns Win32EventPort::observeSignalState(). - - uint prepareMainThreadWait(HANDLE* handles[]); - // Call immediately before invoking WaitForMultipleObjects() or similar in the main thread. - // Fills in `handles` with the handle pointers to wait on, and returns the number of handles - // in this array. (The array should be allocated to be at least the size passed to the - // constructor). - // - // There's no need to call this if `mainThreadCount` as passed to the constructor was zero. - - bool finishedMainThreadWait(DWORD returnCode); - // Call immediately after invoking WaitForMultipleObjects() or similar in the main thread, - // passing the value returend by that call. Returns true if the event indicated by `returnCode` - // has been handled (i.e. it was WAIT_OBJECT_n or WAIT_ABANDONED_n where n is in-range for the - // last call to prepareMainThreadWait()). -}; - -class Win32IocpEventPort final: public Win32EventPort { - // An EventPort implementation which uses Windows I/O completion ports to listen for events. - // - // With this implementation, observeSignalState() requires spawning a separate thread. - -public: - Win32IocpEventPort(); - ~Win32IocpEventPort() noexcept(false); - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - - // implements Win32IocpEventPort --------------------------------------------- - Own observeIo(HANDLE handle) override; - Own observeSignalState(HANDLE handle) override; - Timer& getTimer() override { return timerImpl; } - void allowApc() override { isAllowApc = true; } - -private: - class IoPromiseAdapter; - class IoOperationImpl; - class IoObserverImpl; - - AutoCloseHandle iocp; - AutoCloseHandle thread; - Win32WaitObjectThreadPool waitThreads; - TimerImpl timerImpl; - mutable std::atomic sentWake {false}; - bool isAllowApc = false; - - static TimePoint readClock(); - - void waitIocp(DWORD timeoutMs); - // Wait on the I/O completion port for up to timeoutMs and pump events. Does not advance the - // timer; caller must do that. - - bool receivedWake(); - - static AutoCloseHandle newIocpHandle(); - static AutoCloseHandle openCurrentThread(); -}; - -} // namespace kj - -#endif // KJ_ASYNC_WIN32_H_ diff --git a/external/capnp/include/kj/async.h b/external/capnp/include/kj/async.h deleted file mode 100644 index 5a9d9bdae7..0000000000 --- a/external/capnp/include/kj/async.h +++ /dev/null @@ -1,682 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_H_ -#define KJ_ASYNC_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async-prelude.h" -#include "exception.h" -#include "refcount.h" - -namespace kj { - -class EventLoop; -class WaitScope; - -template -class Promise; -template -class ForkedPromise; -template -class PromiseFulfiller; -template -struct PromiseFulfillerPair; - -template -using PromiseForResult = Promise<_::JoinPromises<_::ReturnType>>; -// Evaluates to the type of Promise for the result of calling functor type Func with parameter type -// T. If T is void, then the promise is for the result of calling Func with no arguments. If -// Func itself returns a promise, the promises are joined, so you never get Promise>. - -// ======================================================================================= -// Promises - -template -class Promise: protected _::PromiseBase { - // The basic primitive of asynchronous computation in KJ. Similar to "futures", but designed - // specifically for event loop concurrency. Similar to E promises and JavaScript Promises/A. - // - // A Promise represents a promise to produce a value of type T some time in the future. Once - // that value has been produced, the promise is "fulfilled". Alternatively, a promise can be - // "broken", with an Exception describing what went wrong. You may implicitly convert a value of - // type T to an already-fulfilled Promise. You may implicitly convert the constant - // `kj::READY_NOW` to an already-fulfilled Promise. You may also implicitly convert a - // `kj::Exception` to an already-broken promise of any type. - // - // Promises are linear types -- they are moveable but not copyable. If a Promise is destroyed - // or goes out of scope (without being moved elsewhere), any ongoing asynchronous operations - // meant to fulfill the promise will be canceled if possible. All methods of `Promise` (unless - // otherwise noted) actually consume the promise in the sense of move semantics. (Arguably they - // should be rvalue-qualified, but at the time this interface was created compilers didn't widely - // support that yet and anyway it would be pretty ugly typing kj::mv(promise).whatever().) If - // you want to use one Promise in two different places, you must fork it with `fork()`. - // - // To use the result of a Promise, you must call `then()` and supply a callback function to - // call with the result. `then()` returns another promise, for the result of the callback. - // Any time that this would result in Promise>, the promises are collapsed into a - // simple Promise that first waits for the outer promise, then the inner. Example: - // - // // Open a remote file, read the content, and then count the - // // number of lines of text. - // // Note that none of the calls here block. `file`, `content` - // // and `lineCount` are all initialized immediately before any - // // asynchronous operations occur. The lambda callbacks are - // // called later. - // Promise> file = openFtp("ftp://host/foo/bar"); - // Promise content = file.then( - // [](Own file) -> Promise { - // return file.readAll(); - // }); - // Promise lineCount = content.then( - // [](String text) -> int { - // uint count = 0; - // for (char c: text) count += (c == '\n'); - // return count; - // }); - // - // For `then()` to work, the current thread must have an active `EventLoop`. Each callback - // is scheduled to execute in that loop. Since `then()` schedules callbacks only on the current - // thread's event loop, you do not need to worry about two callbacks running at the same time. - // You will need to set up at least one `EventLoop` at the top level of your program before you - // can use promises. - // - // To adapt a non-Promise-based asynchronous API to promises, use `newAdaptedPromise()`. - // - // Systems using promises should consider supporting the concept of "pipelining". Pipelining - // means allowing a caller to start issuing method calls against a promised object before the - // promise has actually been fulfilled. This is particularly useful if the promise is for a - // remote object living across a network, as this can avoid round trips when chaining a series - // of calls. It is suggested that any class T which supports pipelining implement a subclass of - // Promise which adds "eventual send" methods -- methods which, when called, say "please - // invoke the corresponding method on the promised value once it is available". These methods - // should in turn return promises for the eventual results of said invocations. Cap'n Proto, - // for example, implements the type `RemotePromise` which supports pipelining RPC requests -- see - // `capnp/capability.h`. - // - // KJ Promises are based on E promises: - // http://wiki.erights.org/wiki/Walnut/Distributed_Computing#Promises - // - // KJ Promises are also inspired in part by the evolving standards for JavaScript/ECMAScript - // promises, which are themselves influenced by E promises: - // http://promisesaplus.com/ - // https://github.com/domenic/promises-unwrapping - -public: - Promise(_::FixVoid value); - // Construct an already-fulfilled Promise from a value of type T. For non-void promises, the - // parameter type is simply T. So, e.g., in a function that returns `Promise`, you can - // say `return 123;` to return a promise that is already fulfilled to 123. - // - // For void promises, use `kj::READY_NOW` as the value, e.g. `return kj::READY_NOW`. - - Promise(kj::Exception&& e); - // Construct an already-broken Promise. - - inline Promise(decltype(nullptr)) {} - - template - PromiseForResult then(Func&& func, ErrorFunc&& errorHandler = _::PropagateException()) - KJ_WARN_UNUSED_RESULT; - // Register a continuation function to be executed when the promise completes. The continuation - // (`func`) takes the promised value (an rvalue of type `T`) as its parameter. The continuation - // may return a new value; `then()` itself returns a promise for the continuation's eventual - // result. If the continuation itself returns a `Promise`, then `then()` shall also return - // a `Promise` which first waits for the original promise, then executes the continuation, - // then waits for the inner promise (i.e. it automatically "unwraps" the promise). - // - // In all cases, `then()` returns immediately. The continuation is executed later. The - // continuation is always executed on the same EventLoop (and, therefore, the same thread) which - // called `then()`, therefore no synchronization is necessary on state shared by the continuation - // and the surrounding scope. If no EventLoop is running on the current thread, `then()` throws - // an exception. - // - // You may also specify an error handler continuation as the second parameter. `errorHandler` - // must be a functor taking a parameter of type `kj::Exception&&`. It must return the same - // type as `func` returns (except when `func` returns `Promise`, in which case `errorHandler` - // may return either `Promise` or just `U`). The default error handler simply propagates the - // exception to the returned promise. - // - // Either `func` or `errorHandler` may, of course, throw an exception, in which case the promise - // is broken. When compiled with -fno-exceptions, the framework will still detect when a - // recoverable exception was thrown inside of a continuation and will consider the promise - // broken even though a (presumably garbage) result was returned. - // - // If the returned promise is destroyed before the callback runs, the callback will be canceled - // (it will never run). - // - // Note that `then()` -- like all other Promise methods -- consumes the promise on which it is - // called, in the sense of move semantics. After returning, the original promise is no longer - // valid, but `then()` returns a new promise. - // - // *Advanced implementation tips:* Most users will never need to worry about the below, but - // it is good to be aware of. - // - // As an optimization, if the callback function `func` does _not_ return another promise, then - // execution of `func` itself may be delayed until its result is known to be needed. The - // expectation here is that `func` is just doing some transformation on the results, not - // scheduling any other actions, therefore the system doesn't need to be proactive about - // evaluating it. This way, a chain of trivial then() transformations can be executed all at - // once without repeatedly re-scheduling through the event loop. Use the `eagerlyEvaluate()` - // method to suppress this behavior. - // - // On the other hand, if `func` _does_ return another promise, then the system evaluates `func` - // as soon as possible, because the promise it returns might be for a newly-scheduled - // long-running asynchronous task. - // - // As another optimization, when a callback function registered with `then()` is actually - // scheduled, it is scheduled to occur immediately, preempting other work in the event queue. - // This allows a long chain of `then`s to execute all at once, improving cache locality by - // clustering operations on the same data. However, this implies that starvation can occur - // if a chain of `then()`s takes a very long time to execute without ever stopping to wait for - // actual I/O. To solve this, use `kj::evalLater()` to yield control; this way, all other events - // in the queue will get a chance to run before your callback is executed. - - Promise ignoreResult() KJ_WARN_UNUSED_RESULT { return then([](T&&) {}); } - // Convenience method to convert the promise to a void promise by ignoring the return value. - // - // You must still wait on the returned promise if you want the task to execute. - - template - Promise catch_(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - // Equivalent to `.then(identityFunc, errorHandler)`, where `identifyFunc` is a function that - // just returns its input. - - T wait(WaitScope& waitScope); - // Run the event loop until the promise is fulfilled, then return its result. If the promise - // is rejected, throw an exception. - // - // wait() is primarily useful at the top level of a program -- typically, within the function - // that allocated the EventLoop. For example, a program that performs one or two RPCs and then - // exits would likely use wait() in its main() function to wait on each RPC. On the other hand, - // server-side code generally cannot use wait(), because it has to be able to accept multiple - // requests at once. - // - // If the promise is rejected, `wait()` throws an exception. If the program was compiled without - // exceptions (-fno-exceptions), this will usually abort. In this case you really should first - // use `then()` to set an appropriate handler for the exception case, so that the promise you - // actually wait on never throws. - // - // `waitScope` is an object proving that the caller is in a scope where wait() is allowed. By - // convention, any function which might call wait(), or which might call another function which - // might call wait(), must take `WaitScope&` as one of its parameters. This is needed for two - // reasons: - // * `wait()` is not allowed during an event callback, because event callbacks are themselves - // called during some other `wait()`, and such recursive `wait()`s would only be able to - // complete in LIFO order, which might mean that the outer `wait()` ends up waiting longer - // than it is supposed to. To prevent this, a `WaitScope` cannot be constructed or used during - // an event callback. - // * Since `wait()` runs the event loop, unrelated event callbacks may execute before `wait()` - // returns. This means that anyone calling `wait()` must be reentrant -- state may change - // around them in arbitrary ways. Therefore, callers really need to know if a function they - // are calling might wait(), and the `WaitScope&` parameter makes this clear. - // - // TODO(someday): Implement fibers, and let them call wait() even when they are handling an - // event. - - ForkedPromise fork() KJ_WARN_UNUSED_RESULT; - // Forks the promise, so that multiple different clients can independently wait on the result. - // `T` must be copy-constructable for this to work. Or, in the special case where `T` is - // `Own`, `U` must have a method `Own addRef()` which returns a new reference to the same - // (or an equivalent) object (probably implemented via reference counting). - - _::SplitTuplePromise split(); - // Split a promise for a tuple into a tuple of promises. - // - // E.g. if you have `Promise>`, `split()` returns - // `kj::Tuple, Promise>`. - - Promise exclusiveJoin(Promise&& other) KJ_WARN_UNUSED_RESULT; - // Return a new promise that resolves when either the original promise resolves or `other` - // resolves (whichever comes first). The promise that didn't resolve first is canceled. - - // TODO(someday): inclusiveJoin(), or perhaps just join(), which waits for both completions - // and produces a tuple? - - template - Promise attach(Attachments&&... attachments) KJ_WARN_UNUSED_RESULT; - // "Attaches" one or more movable objects (often, Owns) to the promise, such that they will - // be destroyed when the promise resolves. This is useful when a promise's callback contains - // pointers into some object and you want to make sure the object still exists when the callback - // runs -- after calling then(), use attach() to add necessary objects to the result. - - template - Promise eagerlyEvaluate(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - Promise eagerlyEvaluate(decltype(nullptr)) KJ_WARN_UNUSED_RESULT; - // Force eager evaluation of this promise. Use this if you are going to hold on to the promise - // for awhile without consuming the result, but you want to make sure that the system actually - // processes it. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. We make you specify this because otherwise it's - // easy to forget to handle errors in a promise that you never use. You may specify nullptr for - // the error handler if you are sure that ignoring errors is fine, or if you know that you'll - // eventually wait on the promise somewhere. - - template - void detach(ErrorFunc&& errorHandler); - // Allows the promise to continue running in the background until it completes or the - // `EventLoop` is destroyed. Be careful when using this: since you can no longer cancel this - // promise, you need to make sure that the promise owns all the objects it touches or make sure - // those objects outlive the EventLoop. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. - // - // This function exists mainly to implement the Cap'n Proto requirement that RPC calls cannot be - // canceled unless the callee explicitly permits it. - - kj::String trace(); - // Returns a dump of debug info about this promise. Not for production use. Requires RTTI. - // This method does NOT consume the promise as other methods do. - -private: - Promise(bool, Own<_::PromiseNode>&& node): PromiseBase(kj::mv(node)) {} - // Second parameter prevent ambiguity with immediate-value constructor. - - template - friend class Promise; - friend class EventLoop; - template - friend Promise newAdaptedPromise(Params&&... adapterConstructorParams); - template - friend PromiseFulfillerPair newPromiseAndFulfiller(); - template - friend class _::ForkHub; - friend class _::TaskSetImpl; - friend Promise _::yield(); - friend class _::NeverDone; - template - friend Promise> joinPromises(Array>&& promises); - friend Promise joinPromises(Array>&& promises); -}; - -template -class ForkedPromise { - // The result of `Promise::fork()` and `EventLoop::fork()`. Allows branches to be created. - // Like `Promise`, this is a pass-by-move type. - -public: - inline ForkedPromise(decltype(nullptr)) {} - - Promise addBranch(); - // Add a new branch to the fork. The branch is equivalent to the original promise. - -private: - Own<_::ForkHub<_::FixVoid>> hub; - - inline ForkedPromise(bool, Own<_::ForkHub<_::FixVoid>>&& hub): hub(kj::mv(hub)) {} - - friend class Promise; - friend class EventLoop; -}; - -constexpr _::Void READY_NOW = _::Void(); -// Use this when you need a Promise that is already fulfilled -- this value can be implicitly -// cast to `Promise`. - -constexpr _::NeverDone NEVER_DONE = _::NeverDone(); -// The opposite of `READY_NOW`, return this when the promise should never resolve. This can be -// implicitly converted to any promise type. You may also call `NEVER_DONE.wait()` to wait -// forever (useful for servers). - -template -PromiseForResult evalLater(Func&& func) KJ_WARN_UNUSED_RESULT; -// Schedule for the given zero-parameter function to be executed in the event loop at some -// point in the near future. Returns a Promise for its result -- or, if `func()` itself returns -// a promise, `evalLater()` returns a Promise for the result of resolving that promise. -// -// Example usage: -// Promise x = evalLater([]() { return 123; }); -// -// The above is exactly equivalent to: -// Promise x = Promise(READY_NOW).then([]() { return 123; }); -// -// If the returned promise is destroyed before the callback runs, the callback will be canceled -// (never called). -// -// If you schedule several evaluations with `evalLater` during the same callback, they are -// guaranteed to be executed in order. - -template -PromiseForResult evalNow(Func&& func) KJ_WARN_UNUSED_RESULT; -// Run `func()` and return a promise for its result. `func()` executes before `evalNow()` returns. -// If `func()` throws an exception, the exception is caught and wrapped in a promise -- this is the -// main reason why `evalNow()` is useful. - -template -Promise> joinPromises(Array>&& promises); -// Join an array of promises into a promise for an array. - -// ======================================================================================= -// Hack for creating a lambda that holds an owned pointer. - -template -class CaptureByMove { -public: - inline CaptureByMove(Func&& func, MovedParam&& param) - : func(kj::mv(func)), param(kj::mv(param)) {} - - template - inline auto operator()(Params&&... params) - -> decltype(kj::instance()(kj::instance(), kj::fwd(params)...)) { - return func(kj::mv(param), kj::fwd(params)...); - } - -private: - Func func; - MovedParam param; -}; - -template -inline CaptureByMove> mvCapture(MovedParam&& param, Func&& func) { - // Hack to create a "lambda" which captures a variable by moving it rather than copying or - // referencing. C++14 generalized captures should make this obsolete, but for now in C++11 this - // is commonly needed for Promise continuations that own their state. Example usage: - // - // Own ptr = makeFoo(); - // Promise promise = callRpc(); - // promise.then(mvCapture(ptr, [](Own&& ptr, int result) { - // return ptr->finish(result); - // })); - - return CaptureByMove>(kj::fwd(func), kj::mv(param)); -} - -// ======================================================================================= -// Advanced promise construction - -template -class PromiseFulfiller { - // A callback which can be used to fulfill a promise. Only the first call to fulfill() or - // reject() matters; subsequent calls are ignored. - -public: - virtual void fulfill(T&& value) = 0; - // Fulfill the promise with the given value. - - virtual void reject(Exception&& exception) = 0; - // Reject the promise with an error. - - virtual bool isWaiting() = 0; - // Returns true if the promise is still unfulfilled and someone is potentially waiting for it. - // Returns false if fulfill()/reject() has already been called *or* if the promise to be - // fulfilled has been discarded and therefore the result will never be used anyway. - - template - bool rejectIfThrows(Func&& func); - // Call the function (with no arguments) and return true. If an exception is thrown, call - // `fulfiller.reject()` and then return false. When compiled with exceptions disabled, - // non-fatal exceptions are still detected and handled correctly. -}; - -template <> -class PromiseFulfiller { - // Specialization of PromiseFulfiller for void promises. See PromiseFulfiller. - -public: - virtual void fulfill(_::Void&& value = _::Void()) = 0; - // Call with zero parameters. The parameter is a dummy that only exists so that subclasses don't - // have to specialize for . - - virtual void reject(Exception&& exception) = 0; - virtual bool isWaiting() = 0; - - template - bool rejectIfThrows(Func&& func); -}; - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams); -// Creates a new promise which owns an instance of `Adapter` which encapsulates the operation -// that will eventually fulfill the promise. This is primarily useful for adapting non-KJ -// asynchronous APIs to use promises. -// -// An instance of `Adapter` will be allocated and owned by the returned `Promise`. A -// `PromiseFulfiller&` will be passed as the first parameter to the adapter's constructor, -// and `adapterConstructorParams` will be forwarded as the subsequent parameters. The adapter -// is expected to perform some asynchronous operation and call the `PromiseFulfiller` once -// it is finished. -// -// The adapter is destroyed when its owning Promise is destroyed. This may occur before the -// Promise has been fulfilled. In this case, the adapter's destructor should cancel the -// asynchronous operation. Once the adapter is destroyed, the fulfillment callback cannot be -// called. -// -// An adapter implementation should be carefully written to ensure that it cannot accidentally -// be left unfulfilled permanently because of an exception. Consider making liberal use of -// `PromiseFulfiller::rejectIfThrows()`. - -template -struct PromiseFulfillerPair { - Promise<_::JoinPromises> promise; - Own> fulfiller; -}; - -template -PromiseFulfillerPair newPromiseAndFulfiller(); -// Construct a Promise and a separate PromiseFulfiller which can be used to fulfill the promise. -// If the PromiseFulfiller is destroyed before either of its methods are called, the Promise is -// implicitly rejected. -// -// Although this function is easier to use than `newAdaptedPromise()`, it has the serious drawback -// that there is no way to handle cancellation (i.e. detect when the Promise is discarded). -// -// You can arrange to fulfill a promise with another promise by using a promise type for T. E.g. -// `newPromiseAndFulfiller>()` will produce a promise of type `Promise` but the -// fulfiller will be of type `PromiseFulfiller>`. Thus you pass a `Promise` to the -// `fulfill()` callback, and the promises are chained. - -// ======================================================================================= -// TaskSet - -class TaskSet { - // Holds a collection of Promises and ensures that each executes to completion. Memory - // associated with each promise is automatically freed when the promise completes. Destroying - // the TaskSet itself automatically cancels all unfinished promises. - // - // This is useful for "daemon" objects that perform background tasks which aren't intended to - // fulfill any particular external promise, but which may need to be canceled (and thus can't - // use `Promise::detach()`). The daemon object holds a TaskSet to collect these tasks it is - // working on. This way, if the daemon itself is destroyed, the TaskSet is detroyed as well, - // and everything the daemon is doing is canceled. - -public: - class ErrorHandler { - public: - virtual void taskFailed(kj::Exception&& exception) = 0; - }; - - TaskSet(ErrorHandler& errorHandler); - // `loop` will be used to wait on promises. `errorHandler` will be executed any time a task - // throws an exception, and will execute within the given EventLoop. - - ~TaskSet() noexcept(false); - - void add(Promise&& promise); - - kj::String trace(); - // Return debug info about all promises currently in the TaskSet. - -private: - Own<_::TaskSetImpl> impl; -}; - -// ======================================================================================= -// The EventLoop class - -class EventPort { - // Interfaces between an `EventLoop` and events originating from outside of the loop's thread. - // All such events come in through the `EventPort` implementation. - // - // An `EventPort` implementation may interface with low-level operating system APIs and/or other - // threads. You can also write an `EventPort` which wraps some other (non-KJ) event loop - // framework, allowing the two to coexist in a single thread. - -public: - virtual bool wait() = 0; - // Wait for an external event to arrive, sleeping if necessary. Once at least one event has - // arrived, queue it to the event loop (e.g. by fulfilling a promise) and return. - // - // This is called during `Promise::wait()` whenever the event queue becomes empty, in order to - // wait for new events to populate the queue. - // - // It is safe to return even if nothing has actually been queued, so long as calling `wait()` in - // a loop will eventually sleep. (That is to say, false positives are fine.) - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual bool poll() = 0; - // Check if any external events have arrived, but do not sleep. If any events have arrived, - // add them to the event queue (e.g. by fulfilling promises) before returning. - // - // This may be called during `Promise::wait()` when the EventLoop has been executing for a while - // without a break but is still non-empty. - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual void setRunnable(bool runnable); - // Called to notify the `EventPort` when the `EventLoop` has work to do; specifically when it - // transitions from empty -> runnable or runnable -> empty. This is typically useful when - // integrating with an external event loop; if the loop is currently runnable then you should - // arrange to call run() on it soon. The default implementation does nothing. - - virtual void wake() const; - // Wake up the EventPort's thread from another thread. - // - // Unlike all other methods on this interface, `wake()` may be called from another thread, hence - // it is `const`. - // - // Technically speaking, `wake()` causes the target thread to cease sleeping and not to sleep - // again until `wait()` or `poll()` has returned true at least once. - // - // The default implementation throws an UNIMPLEMENTED exception. -}; - -class EventLoop { - // Represents a queue of events being executed in a loop. Most code won't interact with - // EventLoop directly, but instead use `Promise`s to interact with it indirectly. See the - // documentation for `Promise`. - // - // Each thread can have at most one current EventLoop. To make an `EventLoop` current for - // the thread, create a `WaitScope`. Async APIs require that the thread has a current EventLoop, - // or they will throw exceptions. APIs that use `Promise::wait()` additionally must explicitly - // be passed a reference to the `WaitScope` to make the caller aware that they might block. - // - // Generally, you will want to construct an `EventLoop` at the top level of your program, e.g. - // in the main() function, or in the start function of a thread. You can then use it to - // construct some promises and wait on the result. Example: - // - // int main() { - // // `loop` becomes the official EventLoop for the thread. - // MyEventPort eventPort; - // EventLoop loop(eventPort); - // - // // Now we can call an async function. - // Promise textPromise = getHttp("http://example.com"); - // - // // And we can wait for the promise to complete. Note that you can only use `wait()` - // // from the top level, not from inside a promise callback. - // String text = textPromise.wait(); - // print(text); - // return 0; - // } - // - // Most applications that do I/O will prefer to use `setupAsyncIo()` from `async-io.h` rather - // than allocate an `EventLoop` directly. - -public: - EventLoop(); - // Construct an `EventLoop` which does not receive external events at all. - - explicit EventLoop(EventPort& port); - // Construct an `EventLoop` which receives external events through the given `EventPort`. - - ~EventLoop() noexcept(false); - - void run(uint maxTurnCount = maxValue); - // Run the event loop for `maxTurnCount` turns or until there is nothing left to be done, - // whichever comes first. This never calls the `EventPort`'s `sleep()` or `poll()`. It will - // call the `EventPort`'s `setRunnable(false)` if the queue becomes empty. - - bool isRunnable(); - // Returns true if run() would currently do anything, or false if the queue is empty. - -private: - EventPort& port; - - bool running = false; - // True while looping -- wait() is then not allowed. - - bool lastRunnableState = false; - // What did we last pass to port.setRunnable()? - - _::Event* head = nullptr; - _::Event** tail = &head; - _::Event** depthFirstInsertPoint = &head; - - Own<_::TaskSetImpl> daemons; - - bool turn(); - void setRunnable(bool runnable); - void enterScope(); - void leaveScope(); - - friend void _::detach(kj::Promise&& promise); - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); - friend class _::Event; - friend class WaitScope; -}; - -class WaitScope { - // Represents a scope in which asynchronous programming can occur. A `WaitScope` should usually - // be allocated on the stack and serves two purposes: - // * While the `WaitScope` exists, its `EventLoop` is registered as the current loop for the - // thread. Most operations dealing with `Promise` (including all of its methods) do not work - // unless the thread has a current `EventLoop`. - // * `WaitScope` may be passed to `Promise::wait()` to synchronously wait for a particular - // promise to complete. See `Promise::wait()` for an extended discussion. - -public: - inline explicit WaitScope(EventLoop& loop): loop(loop) { loop.enterScope(); } - inline ~WaitScope() { loop.leaveScope(); } - KJ_DISALLOW_COPY(WaitScope); - -private: - EventLoop& loop; - friend class EventLoop; - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); -}; - -} // namespace kj - -#include "async-inl.h" - -#endif // KJ_ASYNC_H_ diff --git a/external/capnp/include/kj/common.h b/external/capnp/include/kj/common.h deleted file mode 100644 index 4a908ae000..0000000000 --- a/external/capnp/include/kj/common.h +++ /dev/null @@ -1,1400 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Header that should be #included by everyone. -// -// This defines very simple utilities that are widely applicable. - -#ifndef KJ_COMMON_H_ -#define KJ_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef KJ_NO_COMPILER_CHECK -#if __cplusplus < 201103L && !__CDT_PARSER__ && !_MSC_VER - #error "This code requires C++11. Either your compiler does not support it or it is not enabled." - #ifdef __GNUC__ - // Compiler claims compatibility with GCC, so presumably supports -std. - #error "Pass -std=c++11 on the compiler command line to enable C++11." - #endif -#endif - -#ifdef __GNUC__ - #if __clang__ - #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 2) - #warning "This library requires at least Clang 3.2." - #elif defined(__apple_build_version__) && __apple_build_version__ <= 4250028 - #warning "This library requires at least Clang 3.2. XCode 4.6's Clang, which claims to be "\ - "version 4.2 (wat?), is actually built from some random SVN revision between 3.1 "\ - "and 3.2. Unfortunately, it is insufficient for compiling this library. You can "\ - "download the real Clang 3.2 (or newer) from the Clang web site. Step-by-step "\ - "instructions can be found in Cap'n Proto's documentation: "\ - "http://kentonv.github.io/capnproto/install.html#clang_32_on_mac_osx" - #elif __cplusplus >= 201103L && !__has_include() - #warning "Your compiler supports C++11 but your C++ standard library does not. If your "\ - "system has libc++ installed (as should be the case on e.g. Mac OSX), try adding "\ - "-stdlib=libc++ to your CXXFLAGS." - #endif - #else - #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) - #warning "This library requires at least GCC 4.7." - #endif - #endif -#elif defined(_MSC_VER) - #if _MSC_VER < 1900 - #error "You need Visual Studio 2015 or better to compile this code." - #endif -#else - #warning "I don't recognize your compiler. As of this writing, Clang and GCC are the only "\ - "known compilers with enough C++11 support for this library. "\ - "#define KJ_NO_COMPILER_CHECK to make this warning go away." -#endif -#endif - -#include -#include - -#if __linux__ && __cplusplus > 201200L -// Hack around stdlib bug with C++14 that exists on some Linux systems. -// Apparently in this mode the C library decides not to define gets() but the C++ library still -// tries to import it into the std namespace. This bug has been fixed at the source but is still -// widely present in the wild e.g. on Ubuntu 14.04. -#undef _GLIBCXX_HAVE_GETS -#endif - -#if defined(_MSC_VER) -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif -#include // __popcnt -#endif - -// ======================================================================================= - -namespace kj { - -typedef unsigned int uint; -typedef unsigned char byte; - -// ======================================================================================= -// Common macros, especially for common yet compiler-specific features. - -// Detect whether RTTI and exceptions are enabled, assuming they are unless we have specific -// evidence to the contrary. Clients can always define KJ_NO_RTTI or KJ_NO_EXCEPTIONS explicitly -// to override these checks. -#ifdef __GNUC__ - #if !defined(KJ_NO_RTTI) && !__GXX_RTTI - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !__EXCEPTIONS - #define KJ_NO_EXCEPTIONS 1 - #endif -#elif defined(_MSC_VER) - #if !defined(KJ_NO_RTTI) && !defined(_CPPRTTI) - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !defined(_CPPUNWIND) - #define KJ_NO_EXCEPTIONS 1 - #endif -#endif - -#if !defined(KJ_DEBUG) && !defined(KJ_NDEBUG) -// Heuristically decide whether to enable debug mode. If DEBUG or NDEBUG is defined, use that. -// Otherwise, fall back to checking whether optimization is enabled. -#if defined(DEBUG) || defined(_DEBUG) -#define KJ_DEBUG -#elif defined(NDEBUG) -#define KJ_NDEBUG -#elif __OPTIMIZE__ -#define KJ_NDEBUG -#else -#define KJ_DEBUG -#endif -#endif - -#define KJ_DISALLOW_COPY(classname) \ - classname(const classname&) = delete; \ - classname& operator=(const classname&) = delete -// Deletes the implicit copy constructor and assignment operator. - -#ifdef __GNUC__ -#define KJ_LIKELY(condition) __builtin_expect(condition, true) -#define KJ_UNLIKELY(condition) __builtin_expect(condition, false) -// Branch prediction macros. Evaluates to the condition given, but also tells the compiler that we -// expect the condition to be true/false enough of the time that it's worth hard-coding branch -// prediction. -#else -#define KJ_LIKELY(condition) (condition) -#define KJ_UNLIKELY(condition) (condition) -#endif - -#if defined(KJ_DEBUG) || __NO_INLINE__ -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ -// Don't force inline in debug mode. -#else -#if defined(_MSC_VER) -#define KJ_ALWAYS_INLINE(...) __forceinline __VA_ARGS__ -#else -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ __attribute__((always_inline)) -#endif -// Force a function to always be inlined. Apply only to the prototype, not to the definition. -#endif - -#if defined(_MSC_VER) -#define KJ_NOINLINE __declspec(noinline) -#else -#define KJ_NOINLINE __attribute__((noinline)) -#endif - -#if defined(_MSC_VER) -#define KJ_NORETURN(prototype) __declspec(noreturn) prototype -#define KJ_UNUSED -#define KJ_WARN_UNUSED_RESULT -// TODO(msvc): KJ_WARN_UNUSED_RESULT can use _Check_return_ on MSVC, but it's a prefix, so -// wrapping the whole prototype is needed. http://msdn.microsoft.com/en-us/library/jj159529.aspx -// Similarly, KJ_UNUSED could use __pragma(warning(suppress:...)), but again that's a prefix. -#else -#define KJ_NORETURN(prototype) prototype __attribute__((noreturn)) -#define KJ_UNUSED __attribute__((unused)) -#define KJ_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#endif - -#if __clang__ -#define KJ_UNUSED_MEMBER __attribute__((unused)) -// Inhibits "unused" warning for member variables. Only Clang produces such a warning, while GCC -// complains if the attribute is set on members. -#else -#define KJ_UNUSED_MEMBER -#endif - -#if __clang__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated(reason))) -#define KJ_UNAVAILABLE(reason) \ - __attribute__((unavailable(reason))) -#elif __GNUC__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated)) -#define KJ_UNAVAILABLE(reason) -#else -#define KJ_DEPRECATED(reason) -#define KJ_UNAVAILABLE(reason) -// TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated). -#endif - -namespace _ { // private - -KJ_NORETURN(void inlineRequireFailure( - const char* file, int line, const char* expectation, const char* macroArgs, - const char* message = nullptr)); - -KJ_NORETURN(void unreachable()); - -} // namespace _ (private) - -#ifdef KJ_DEBUG -#if _MSC_VER -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, "" #__VA_ARGS__, __VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#else -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, #__VA_ARGS__, ##__VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#endif -#else -#define KJ_IREQUIRE(condition, ...) -#endif - -#define KJ_IASSERT KJ_IREQUIRE - -#define KJ_UNREACHABLE ::kj::_::unreachable(); -// Put this on code paths that cannot be reached to suppress compiler warnings about missing -// returns. - -#if __clang__ -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT -#else -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT KJ_UNREACHABLE -#endif - -// #define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) -// -// Allocate an array, preferably on the stack, unless it is too big. On GCC this will use -// variable-sized arrays. For other compilers we could just use a fixed-size array. `minStack` -// is the stack array size to use if variable-width arrays are not supported. `maxStack` is the -// maximum stack array size if variable-width arrays *are* supported. -#if __GNUC__ && !__clang__ -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (maxStack); \ - type name##_stack[name##_isOnStack ? size : 0]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#else -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (minStack); \ - type name##_stack[minStack]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#endif - -#define KJ_CONCAT_(x, y) x##y -#define KJ_CONCAT(x, y) KJ_CONCAT_(x, y) -#define KJ_UNIQUE_NAME(prefix) KJ_CONCAT(prefix, __LINE__) -// Create a unique identifier name. We use concatenate __LINE__ rather than __COUNTER__ so that -// the name can be used multiple times in the same macro. - -#if _MSC_VER - -#define KJ_CONSTEXPR(...) __VA_ARGS__ -// Use in cases where MSVC barfs on constexpr. A replacement keyword (e.g. "const") can be -// provided, or just leave blank to remove the keyword entirely. -// -// TODO(msvc): Remove this hack once MSVC fully supports constexpr. - -#ifndef __restrict__ -#define __restrict__ __restrict -// TODO(msvc): Would it be better to define a KJ_RESTRICT macro? -#endif - -#pragma warning(disable: 4521 4522) -// This warning complains when there are two copy constructors, one for a const reference and -// one for a non-const reference. It is often quite necessary to do this in wrapper templates, -// therefore this warning is dumb and we disable it. - -#pragma warning(disable: 4458) -// Warns when a parameter name shadows a class member. Unfortunately my code does this a lot, -// since I don't use a special name format for members. - -#else // _MSC_VER -#define KJ_CONSTEXPR(...) constexpr -#endif - -// ======================================================================================= -// Template metaprogramming helpers. - -template struct NoInfer_ { typedef T Type; }; -template using NoInfer = typename NoInfer_::Type; -// Use NoInfer::Type in place of T for a template function parameter to prevent inference of -// the type based on the parameter value. - -template struct RemoveConst_ { typedef T Type; }; -template struct RemoveConst_ { typedef T Type; }; -template using RemoveConst = typename RemoveConst_::Type; - -template struct IsLvalueReference_ { static constexpr bool value = false; }; -template struct IsLvalueReference_ { static constexpr bool value = true; }; -template -inline constexpr bool isLvalueReference() { return IsLvalueReference_::value; } - -template struct Decay_ { typedef T Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template using Decay = typename Decay_::Type; - -template struct EnableIf_; -template <> struct EnableIf_ { typedef void Type; }; -template using EnableIf = typename EnableIf_::Type; -// Use like: -// -// template ()> -// void func(T&& t); - -template struct VoidSfinae_ { using Type = void; }; -template using VoidSfinae = typename VoidSfinae_::Type; -// Note: VoidSfinae is std::void_t from C++17. - -template -T instance() noexcept; -// Like std::declval, but doesn't transform T into an rvalue reference. If you want that, specify -// instance(). - -struct DisallowConstCopy { - // Inherit from this, or declare a member variable of this type, to prevent the class from being - // copyable from a const reference -- instead, it will only be copyable from non-const references. - // This is useful for enforcing transitive constness of contained pointers. - // - // For example, say you have a type T which contains a pointer. T has non-const methods which - // modify the value at that pointer, but T's const methods are designed to allow reading only. - // Unfortunately, if T has a regular copy constructor, someone can simply make a copy of T and - // then use it to modify the pointed-to value. However, if T inherits DisallowConstCopy, then - // callers will only be able to copy non-const instances of T. Ideally, there is some - // parallel type ImmutableT which is like a version of T that only has const methods, and can - // be copied from a const T. - // - // Note that due to C++ rules about implicit copy constructors and assignment operators, any - // type that contains or inherits from a type that disallows const copies will also automatically - // disallow const copies. Hey, cool, that's exactly what we want. - -#if CAPNP_DEBUG_TYPES - // Alas! Declaring a defaulted non-const copy constructor tickles a bug which causes GCC and - // Clang to disagree on ABI, using different calling conventions to pass this type, leading to - // immediate segfaults. See: - // https://bugs.llvm.org/show_bug.cgi?id=23764 - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58074 - // - // Because of this, we can't use this technique. We guard it by CAPNP_DEBUG_TYPES so that it - // still applies to the Cap'n Proto developers during internal testing. - - DisallowConstCopy() = default; - DisallowConstCopy(DisallowConstCopy&) = default; - DisallowConstCopy(DisallowConstCopy&&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&&) = default; -#endif -}; - -#if _MSC_VER - -#define KJ_CPCAP(obj) obj=::kj::cp(obj) -// TODO(msvc): MSVC refuses to invoke non-const versions of copy constructors in by-value lambda -// captures. Wrap your captured object in this macro to force the compiler to perform a copy. -// Example: -// -// struct Foo: DisallowConstCopy {}; -// Foo foo; -// auto lambda = [KJ_CPCAP(foo)] {}; - -#else - -#define KJ_CPCAP(obj) obj -// Clang and gcc both already perform copy capturing correctly with non-const copy constructors. - -#endif - -template -struct DisallowConstCopyIfNotConst: public DisallowConstCopy { - // Inherit from this when implementing a template that contains a pointer to T and which should - // enforce transitive constness. If T is a const type, this has no effect. Otherwise, it is - // an alias for DisallowConstCopy. -}; - -template -struct DisallowConstCopyIfNotConst {}; - -template struct IsConst_ { static constexpr bool value = false; }; -template struct IsConst_ { static constexpr bool value = true; }; -template constexpr bool isConst() { return IsConst_::value; } - -template struct EnableIfNotConst_ { typedef T Type; }; -template struct EnableIfNotConst_; -template using EnableIfNotConst = typename EnableIfNotConst_::Type; - -template struct EnableIfConst_; -template struct EnableIfConst_ { typedef T Type; }; -template using EnableIfConst = typename EnableIfConst_::Type; - -template struct RemoveConstOrDisable_ { struct Type; }; -template struct RemoveConstOrDisable_ { typedef T Type; }; -template using RemoveConstOrDisable = typename RemoveConstOrDisable_::Type; - -template struct IsReference_ { static constexpr bool value = false; }; -template struct IsReference_ { static constexpr bool value = true; }; -template constexpr bool isReference() { return IsReference_::value; } - -template -struct PropagateConst_ { typedef To Type; }; -template -struct PropagateConst_ { typedef const To Type; }; -template -using PropagateConst = typename PropagateConst_::Type; - -namespace _ { // private - -template -T refIfLvalue(T&&); - -} // namespace _ (private) - -#define KJ_DECLTYPE_REF(exp) decltype(::kj::_::refIfLvalue(exp)) -// Like decltype(exp), but if exp is an lvalue, produces a reference type. -// -// int i; -// decltype(i) i1(i); // i1 has type int. -// KJ_DECLTYPE_REF(i + 1) i2(i + 1); // i2 has type int. -// KJ_DECLTYPE_REF(i) i3(i); // i3 has type int&. -// KJ_DECLTYPE_REF(kj::mv(i)) i4(kj::mv(i)); // i4 has type int. - -template -struct CanConvert_ { - static int sfinae(T); - static bool sfinae(...); -}; - -template -constexpr bool canConvert() { - return sizeof(CanConvert_::sfinae(instance())) == sizeof(int); -} - -#if __GNUC__ && !__clang__ && __GNUC__ < 5 -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - // GCC 4 does not have __is_trivially_constructible and friends, and there doesn't seem to be - // any reliable alternative. __has_trivial_copy() and __has_trivial_assign() return the right - // thing at one point but later on they changed such that a deleted copy constructor was - // considered "trivial" (apparently technically correct, though useless). So, on GCC 4 we give up - // and assume we can't memcpy() at all, and must explicitly copy-construct everything. - return false; -} -#define KJ_ASSERT_CAN_MEMCPY(T) -#else -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - return __is_trivially_constructible(T, const T&) && __is_trivially_assignable(T, const T&); -} -#define KJ_ASSERT_CAN_MEMCPY(T) \ - static_assert(kj::canMemcpy(), "this code expects this type to be memcpy()-able"); -#endif - -// ======================================================================================= -// Equivalents to std::move() and std::forward(), since these are very commonly needed and the -// std header pulls in lots of other stuff. -// -// We use abbreviated names mv and fwd because these helpers (especially mv) are so commonly used -// that the cost of typing more letters outweighs the cost of being slightly harder to understand -// when first encountered. - -template constexpr T&& mv(T& t) noexcept { return static_cast(t); } -template constexpr T&& fwd(NoInfer& t) noexcept { return static_cast(t); } - -template constexpr T cp(T& t) noexcept { return t; } -template constexpr T cp(const T& t) noexcept { return t; } -// Useful to force a copy, particularly to pass into a function that expects T&&. - -template struct ChooseType_; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef U Type; }; - -template -using WiderType = typename ChooseType_= sizeof(U)>::Type; - -template -inline constexpr auto min(T&& a, U&& b) -> WiderType, Decay> { - return a < b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr auto max(T&& a, U&& b) -> WiderType, Decay> { - return a > b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr size_t size(T (&arr)[s]) { return s; } -template -inline constexpr size_t size(T&& arr) { return arr.size(); } -// Returns the size of the parameter, whether the parameter is a regular C array or a container -// with a `.size()` method. - -class MaxValue_ { -private: - template - inline constexpr T maxSigned() const { - return (1ull << (sizeof(T) * 8 - 1)) - 1; - } - template - inline constexpr T maxUnsigned() const { - return ~static_cast(0u); - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MaxValue_::maxSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MaxValue_::maxUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MaxValue_::maxSigned() - : MaxValue_::maxUnsigned(); - } -}; - -class MinValue_ { -private: - template - inline constexpr T minSigned() const { - return 1ull << (sizeof(T) * 8 - 1); - } - template - inline constexpr T minUnsigned() const { - return 0u; - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MinValue_::minSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MinValue_::minUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MinValue_::minSigned() - : MinValue_::minUnsigned(); - } -}; - -static KJ_CONSTEXPR(const) MaxValue_ maxValue = MaxValue_(); -// A special constant which, when cast to an integer type, takes on the maximum possible value of -// that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -static KJ_CONSTEXPR(const) MinValue_ minValue = MinValue_(); -// A special constant which, when cast to an integer type, takes on the minimum possible value -// of that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -template -inline bool operator==(T t, MaxValue_) { return t == Decay(maxValue); } -template -inline bool operator==(T t, MinValue_) { return t == Decay(minValue); } - -template -inline constexpr unsigned long long maxValueForBits() { - // Get the maximum integer representable in the given number of bits. - - // 1ull << 64 is unfortunately undefined. - return (bits == 64 ? 0 : (1ull << bits)) - 1; -} - -struct ThrowOverflow { - // Functor which throws an exception complaining about integer overflow. Usually this is used - // with the interfaces in units.h, but is defined here because Cap'n Proto wants to avoid - // including units.h when not using CAPNP_DEBUG_TYPES. - void operator()() const; -}; - -#if __GNUC__ -inline constexpr float inf() { return __builtin_huge_valf(); } -inline constexpr float nan() { return __builtin_nanf(""); } - -#elif _MSC_VER - -// Do what MSVC math.h does -#pragma warning(push) -#pragma warning(disable: 4756) // "overflow in constant arithmetic" -inline constexpr float inf() { return (float)(1e300 * 1e300); } -#pragma warning(pop) - -float nan(); -// Unfortunatley, inf() * 0.0f produces a NaN with the sign bit set, whereas our preferred -// canonical NaN should not have the sign bit set. std::numeric_limits::quiet_NaN() -// returns the correct NaN, but we don't want to #include that here. So, we give up and make -// this out-of-line on MSVC. -// -// TODO(msvc): Can we do better? - -#else -#error "Not sure how to support your compiler." -#endif - -inline constexpr bool isNaN(float f) { return f != f; } -inline constexpr bool isNaN(double f) { return f != f; } - -inline int popCount(unsigned int x) { -#if defined(_MSC_VER) - return __popcnt(x); - // Note: __popcnt returns unsigned int, but the value is clearly guaranteed to fit into an int -#else - return __builtin_popcount(x); -#endif -} - -// ======================================================================================= -// Useful fake containers - -template -class Range { -public: - inline constexpr Range(const T& begin, const T& end): begin_(begin), end_(end) {} - inline explicit constexpr Range(const T& end): begin_(0), end_(end) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value): value(value) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](size_t index) const { return value + index; } - inline Iterator& operator++() { ++value; return *this; } - inline Iterator operator++(int) { return Iterator(value++); } - inline Iterator& operator--() { --value; return *this; } - inline Iterator operator--(int) { return Iterator(value--); } - inline Iterator& operator+=(ptrdiff_t amount) { value += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { value -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return value - other.value; } - - inline bool operator==(const Iterator& other) const { return value == other.value; } - inline bool operator!=(const Iterator& other) const { return value != other.value; } - inline bool operator<=(const Iterator& other) const { return value <= other.value; } - inline bool operator>=(const Iterator& other) const { return value >= other.value; } - inline bool operator< (const Iterator& other) const { return value < other.value; } - inline bool operator> (const Iterator& other) const { return value > other.value; } - - private: - T value; - }; - - inline Iterator begin() const { return Iterator(begin_); } - inline Iterator end() const { return Iterator(end_); } - - inline auto size() const -> decltype(instance() - instance()) { return end_ - begin_; } - -private: - T begin_; - T end_; -}; - -template -inline constexpr Range, Decay>> range(T begin, U end) { - return Range, Decay>>(begin, end); -} - -template -inline constexpr Range> range(T begin, T end) { return Range>(begin, end); } -// Returns a fake iterable container containing all values of T from `begin` (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::range(1, 10)) { print(i); } - -template -inline constexpr Range> zeroTo(T end) { return Range>(end); } -// Returns a fake iterable container containing all values of T from zero (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::zeroTo(10)) { print(i); } - -template -inline constexpr Range indices(T&& container) { - // Shortcut for iterating over the indices of a container: - // - // for (size_t i: kj::indices(myArray)) { handle(myArray[i]); } - - return range(0, kj::size(container)); -} - -template -class Repeat { -public: - inline constexpr Repeat(const T& value, size_t count): value(value), count(count) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value, size_t index): value(value), index(index) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](ptrdiff_t index) const { return value; } - inline Iterator& operator++() { ++index; return *this; } - inline Iterator operator++(int) { return Iterator(value, index++); } - inline Iterator& operator--() { --index; return *this; } - inline Iterator operator--(int) { return Iterator(value, index--); } - inline Iterator& operator+=(ptrdiff_t amount) { index += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { index -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value, index + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value, index - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return index - other.index; } - - inline bool operator==(const Iterator& other) const { return index == other.index; } - inline bool operator!=(const Iterator& other) const { return index != other.index; } - inline bool operator<=(const Iterator& other) const { return index <= other.index; } - inline bool operator>=(const Iterator& other) const { return index >= other.index; } - inline bool operator< (const Iterator& other) const { return index < other.index; } - inline bool operator> (const Iterator& other) const { return index > other.index; } - - private: - T value; - size_t index; - }; - - inline Iterator begin() const { return Iterator(value, 0); } - inline Iterator end() const { return Iterator(value, count); } - - inline size_t size() const { return count; } - inline const T& operator[](ptrdiff_t) const { return value; } - -private: - T value; - size_t count; -}; - -template -inline constexpr Repeat> repeat(T&& value, size_t count) { - // Returns a fake iterable which contains `count` repeats of `value`. Useful for e.g. creating - // a bunch of spaces: `kj::repeat(' ', indent * 2)` - - return Repeat>(value, count); -} - -// ======================================================================================= -// Manually invoking constructors and destructors -// -// ctor(x, ...) and dtor(x) invoke x's constructor or destructor, respectively. - -// We want placement new, but we don't want to #include . operator new cannot be defined in -// a namespace, and defining it globally conflicts with the definition in . So we have to -// define a dummy type and an operator new that uses it. - -namespace _ { // private -struct PlacementNew {}; -} // namespace _ (private) -} // namespace kj - -inline void* operator new(size_t, kj::_::PlacementNew, void* __p) noexcept { - return __p; -} - -inline void operator delete(void*, kj::_::PlacementNew, void* __p) noexcept {} - -namespace kj { - -template -inline void ctor(T& location, Params&&... params) { - new (_::PlacementNew(), &location) T(kj::fwd(params)...); -} - -template -inline void dtor(T& location) { - location.~T(); -} - -// ======================================================================================= -// Maybe -// -// Use in cases where you want to indicate that a value may be null. Using Maybe instead of T* -// forces the caller to handle the null case in order to satisfy the compiler, thus reliably -// preventing null pointer dereferences at runtime. -// -// Maybe can be implicitly constructed from T and from nullptr. Additionally, it can be -// implicitly constructed from T*, in which case the pointer is checked for nullness at runtime. -// To read the value of a Maybe, do: -// -// KJ_IF_MAYBE(value, someFuncReturningMaybe()) { -// doSomething(*value); -// } else { -// maybeWasNull(); -// } -// -// KJ_IF_MAYBE's first parameter is a variable name which will be defined within the following -// block. The variable will behave like a (guaranteed non-null) pointer to the Maybe's value, -// though it may or may not actually be a pointer. -// -// Note that Maybe actually just wraps a pointer, whereas Maybe wraps a T and a boolean -// indicating nullness. - -template -class Maybe; - -namespace _ { // private - -template -class NullableValue { - // Class whose interface behaves much like T*, but actually contains an instance of T and a - // boolean flag indicating nullness. - -public: - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline NullableValue(NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline ~NullableValue() -#if _MSC_VER - // TODO(msvc): MSVC has a hard time with noexcept specifier expressions that are more complex - // than `true` or `false`. We had a workaround for VS2015, but VS2017 regressed. - noexcept(false) -#else - noexcept(noexcept(instance().~T())) -#endif - { - if (isSet) { - dtor(value); - } - } - - inline T& operator*() & { return value; } - inline const T& operator*() const & { return value; } - inline T&& operator*() && { return kj::mv(value); } - inline const T&& operator*() const && { return kj::mv(value); } - inline T* operator->() { return &value; } - inline const T* operator->() const { return &value; } - inline operator T*() { return isSet ? &value : nullptr; } - inline operator const T*() const { return isSet ? &value : nullptr; } - - template - inline T& emplace(Params&&... params) { - if (isSet) { - isSet = false; - dtor(value); - } - ctor(value, kj::fwd(params)...); - isSet = true; - return value; - } - -private: // internal interface used by friends only - inline NullableValue() noexcept: isSet(false) {} - inline NullableValue(T&& t) noexcept(noexcept(T(instance()))) - : isSet(true) { - ctor(value, kj::mv(t)); - } - inline NullableValue(T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T* t) - : isSet(t != nullptr) { - if (isSet) ctor(value, *t); - } - template - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, *other.ptr); - } - } - inline NullableValue(decltype(nullptr)): isSet(false) {} - - inline NullableValue& operator=(NullableValue&& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, kj::mv(other.value)); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(const NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline bool operator==(decltype(nullptr)) const { return !isSet; } - inline bool operator!=(decltype(nullptr)) const { return isSet; } - -private: - bool isSet; - -#if _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4624) -// Warns that the anonymous union has a deleted destructor when T is non-trivial. This warning -// seems broken. -#endif - - union { - T value; - }; - -#if _MSC_VER -#pragma warning(pop) -#endif - - friend class kj::Maybe; - template - friend NullableValue&& readMaybe(Maybe&& maybe); -}; - -template -inline NullableValue&& readMaybe(Maybe&& maybe) { return kj::mv(maybe.ptr); } -template -inline T* readMaybe(Maybe& maybe) { return maybe.ptr; } -template -inline const T* readMaybe(const Maybe& maybe) { return maybe.ptr; } -template -inline T* readMaybe(Maybe&& maybe) { return maybe.ptr; } -template -inline T* readMaybe(const Maybe& maybe) { return maybe.ptr; } - -template -inline T* readMaybe(T* ptr) { return ptr; } -// Allow KJ_IF_MAYBE to work on regular pointers. - -} // namespace _ (private) - -#define KJ_IF_MAYBE(name, exp) if (auto name = ::kj::_::readMaybe(exp)) - -template -class Maybe { - // A T, or nullptr. - - // IF YOU CHANGE THIS CLASS: Note that there is a specialization of it in memory.h. - -public: - Maybe(): ptr(nullptr) {} - Maybe(T&& t) noexcept(noexcept(T(instance()))): ptr(kj::mv(t)) {} - Maybe(T& t): ptr(t) {} - Maybe(const T& t): ptr(t) {} - Maybe(const T* t) noexcept: ptr(t) {} - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))): ptr(kj::mv(other.ptr)) {} - Maybe(const Maybe& other): ptr(other.ptr) {} - Maybe(Maybe& other): ptr(other.ptr) {} - - template - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))) { - KJ_IF_MAYBE(val, kj::mv(other)) { - ptr.emplace(kj::mv(*val)); - } - } - template - Maybe(const Maybe& other) { - KJ_IF_MAYBE(val, other) { - ptr.emplace(*val); - } - } - - Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - template - inline T& emplace(Params&&... params) { - // Replace this Maybe's content with a new value constructed by passing the given parametrs to - // T's constructor. This can be used to initialize a Maybe without copying or even moving a T. - // Returns a reference to the newly-constructed value. - - return ptr.emplace(kj::fwd(params)...); - } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - inline Maybe& operator=(Maybe& other) { ptr = other.ptr; return *this; } - inline Maybe& operator=(const Maybe& other) { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - -private: - _::NullableValue ptr; - - template - friend class Maybe; - template - friend _::NullableValue&& _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(Maybe& maybe); - template - friend const U* _::readMaybe(const Maybe& maybe); -}; - -template -class Maybe: public DisallowConstCopyIfNotConst { -public: - Maybe() noexcept: ptr(nullptr) {} - Maybe(T& t) noexcept: ptr(&t) {} - Maybe(T* t) noexcept: ptr(t) {} - - template - inline Maybe(Maybe& other) noexcept: ptr(other.ptr) {} - template - inline Maybe(const Maybe& other) noexcept: ptr(other.ptr) {} - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline Maybe& operator=(T& other) noexcept { ptr = &other; return *this; } - inline Maybe& operator=(T* other) noexcept { ptr = other; return *this; } - template - inline Maybe& operator=(Maybe& other) noexcept { ptr = other.ptr; return *this; } - template - inline Maybe& operator=(const Maybe& other) noexcept { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - -private: - T* ptr; - - template - friend class Maybe; - template - friend U* _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(const Maybe& maybe); -}; - -// ======================================================================================= -// ArrayPtr -// -// So common that we put it in common.h rather than array.h. - -template -class ArrayPtr: public DisallowConstCopyIfNotConst { - // A pointer to an array. Includes a size. Like any pointer, it doesn't own the target data, - // and passing by value only copies the pointer, not the target. - -public: - inline constexpr ArrayPtr(): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(decltype(nullptr)): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(T* ptr, size_t size): ptr(ptr), size_(size) {} - inline constexpr ArrayPtr(T* begin, T* end): ptr(begin), size_(end - begin) {} - inline KJ_CONSTEXPR() ArrayPtr(::std::initializer_list> init) - : ptr(init.begin()), size_(init.size()) {} - - template - inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) {} - // Construct an ArrayPtr from a native C-style array. - - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asConst() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline const T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - inline T& operator[](size_t index) { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr> asBytes() const { - // Reinterpret the array as a byte array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - inline ArrayPtr> asChars() const { - // Reinterpret the array as a char array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline bool operator==(const ArrayPtr& other) const { - if (size_ != other.size_) return false; - for (size_t i = 0; i < size_; i++) { - if (ptr[i] != other[i]) return false; - } - return true; - } - inline bool operator!=(const ArrayPtr& other) const { return !(*this == other); } - -private: - T* ptr; - size_t size_; -}; - -template -inline constexpr ArrayPtr arrayPtr(T* ptr, size_t size) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(ptr, size); -} - -template -inline constexpr ArrayPtr arrayPtr(T* begin, T* end) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(begin, end); -} - -// ======================================================================================= -// Casts - -template -To implicitCast(From&& from) { - // `implicitCast(value)` casts `value` to type `T` only if the conversion is implicit. Useful - // for e.g. resolving ambiguous overloads without sacrificing type-safety. - return kj::fwd(from); -} - -template -Maybe dynamicDowncastIfAvailable(From& from) { - // If RTTI is disabled, always returns nullptr. Otherwise, works like dynamic_cast. Useful - // in situations where dynamic_cast could allow an optimization, but isn't strictly necessary - // for correctness. It is highly recommended that you try to arrange all your dynamic_casts - // this way, as a dynamic_cast that is necessary for correctness implies a flaw in the interface - // design. - - // Force a compile error if To is not a subtype of From. Cross-casting is rare; if it is needed - // we should have a separate cast function like dynamicCrosscastIfAvailable(). - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if KJ_NO_RTTI - return nullptr; -#else - return dynamic_cast(&from); -#endif -} - -template -To& downcast(From& from) { - // Down-cast a value to a sub-type, asserting that the cast is valid. In opt mode this is a - // static_cast, but in debug mode (when RTTI is enabled) a dynamic_cast will be used to verify - // that the value really has the requested type. - - // Force a compile error if To is not a subtype of From. - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if !KJ_NO_RTTI - KJ_IREQUIRE(dynamic_cast(&from) != nullptr, "Value cannot be downcast() to requested type."); -#endif - - return static_cast(from); -} - -// ======================================================================================= -// Defer - -namespace _ { // private - -template -class Deferred { -public: - inline Deferred(Func&& func): func(kj::fwd(func)), canceled(false) {} - inline ~Deferred() noexcept(false) { if (!canceled) func(); } - KJ_DISALLOW_COPY(Deferred); - - // This move constructor is usually optimized away by the compiler. - inline Deferred(Deferred&& other): func(kj::mv(other.func)), canceled(false) { - other.canceled = true; - } -private: - Func func; - bool canceled; -}; - -} // namespace _ (private) - -template -_::Deferred defer(Func&& func) { - // Returns an object which will invoke the given functor in its destructor. The object is not - // copyable but is movable with the semantics you'd expect. Since the return type is private, - // you need to assign to an `auto` variable. - // - // The KJ_DEFER macro provides slightly more convenient syntax for the common case where you - // want some code to run at current scope exit. - - return _::Deferred(kj::fwd(func)); -} - -#define KJ_DEFER(code) auto KJ_UNIQUE_NAME(_kjDefer) = ::kj::defer([&](){code;}) -// Run the given code when the function exits, whether by return or exception. - -} // namespace kj - -#endif // KJ_COMMON_H_ diff --git a/external/capnp/include/kj/compat/gtest.h b/external/capnp/include/kj/compat/gtest.h deleted file mode 100644 index 016dbdfac3..0000000000 --- a/external/capnp/include/kj/compat/gtest.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_GTEST_H_ -#define KJ_COMPAT_GTEST_H_ -// This file defines compatibility macros converting Google Test tests into KJ tests. -// -// This is only intended to cover the most common functionality. Many tests will likely need -// additional tweaks. For instance: -// - Using operator<< to print information on failure is not supported. Instead, switch to -// KJ_ASSERT/KJ_EXPECT and pass in stuff to print as additional parameters. -// - Test fixtures are not supported. Allocate your "test fixture" on the stack instead. Do setup -// in the constructor, teardown in the destructor. - -#include "../test.h" - -namespace kj { - -namespace _ { // private - -template -T abs(T value) { return value < 0 ? -value : value; } - -inline bool floatAlmostEqual(float a, float b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-5; -} - -inline bool doubleAlmostEqual(double a, double b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-12; -} - -} // namespace _ (private) - -#define EXPECT_FALSE(x) KJ_EXPECT(!(x)) -#define EXPECT_TRUE(x) KJ_EXPECT(x) -#define EXPECT_EQ(x, y) KJ_EXPECT((x) == (y), x, y) -#define EXPECT_NE(x, y) KJ_EXPECT((x) != (y), x, y) -#define EXPECT_LE(x, y) KJ_EXPECT((x) <= (y), x, y) -#define EXPECT_GE(x, y) KJ_EXPECT((x) >= (y), x, y) -#define EXPECT_LT(x, y) KJ_EXPECT((x) < (y), x, y) -#define EXPECT_GT(x, y) KJ_EXPECT((x) > (y), x, y) -#define EXPECT_STREQ(x, y) KJ_EXPECT(::strcmp(x, y) == 0, x, y) -#define EXPECT_FLOAT_EQ(x, y) KJ_EXPECT(::kj::_::floatAlmostEqual(y, x), y, x); -#define EXPECT_DOUBLE_EQ(x, y) KJ_EXPECT(::kj::_::doubleAlmostEqual(y, x), y, x); - -#define ASSERT_FALSE(x) KJ_ASSERT(!(x)) -#define ASSERT_TRUE(x) KJ_ASSERT(x) -#define ASSERT_EQ(x, y) KJ_ASSERT((x) == (y), x, y) -#define ASSERT_NE(x, y) KJ_ASSERT((x) != (y), x, y) -#define ASSERT_LE(x, y) KJ_ASSERT((x) <= (y), x, y) -#define ASSERT_GE(x, y) KJ_ASSERT((x) >= (y), x, y) -#define ASSERT_LT(x, y) KJ_ASSERT((x) < (y), x, y) -#define ASSERT_GT(x, y) KJ_ASSERT((x) > (y), x, y) -#define ASSERT_STREQ(x, y) KJ_ASSERT(::strcmp(x, y) == 0, x, y) -#define ASSERT_FLOAT_EQ(x, y) KJ_ASSERT(::kj::_::floatAlmostEqual(y, x), y, x); -#define ASSERT_DOUBLE_EQ(x, y) KJ_ASSERT(::kj::_::doubleAlmostEqual(y, x), y, x); - -class AddFailureAdapter { -public: - AddFailureAdapter(const char* file, int line): file(file), line(line) {} - - ~AddFailureAdapter() { - if (!handled) { - _::Debug::log(file, line, LogSeverity::ERROR, "expectation failed"); - } - } - - template - void operator<<(T&& info) { - handled = true; - _::Debug::log(file, line, LogSeverity::ERROR, "\"expectation failed\", info", - "expectation failed", kj::fwd(info)); - } - -private: - bool handled = false; - const char* file; - int line; -}; - -#define ADD_FAILURE() ::kj::AddFailureAdapter(__FILE__, __LINE__) - -#if KJ_NO_EXCEPTIONS -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, nullptr, [&]() { code; })) -#else -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::runCatchingExceptions([&]() { code; }) != nullptr) -#endif - -#define EXPECT_NONFATAL_FAILURE(code) \ - EXPECT_TRUE(kj::runCatchingExceptions([&]() { code; }) != nullptr); - -#ifdef KJ_DEBUG -#define EXPECT_DEBUG_ANY_THROW EXPECT_ANY_THROW -#else -#define EXPECT_DEBUG_ANY_THROW(EXP) -#endif - -#define TEST(x, y) KJ_TEST("legacy test: " #x "/" #y) - -} // namespace kj - -#endif // KJ_COMPAT_GTEST_H_ diff --git a/external/capnp/include/kj/compat/http.h b/external/capnp/include/kj/compat/http.h deleted file mode 100644 index 8d455cc258..0000000000 --- a/external/capnp/include/kj/compat/http.h +++ /dev/null @@ -1,636 +0,0 @@ -// Copyright (c) 2017 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_HTTP_H_ -#define KJ_COMPAT_HTTP_H_ -// The KJ HTTP client/server library. -// -// This is a simple library which can be used to implement an HTTP client or server. Properties -// of this library include: -// - Uses KJ async framework. -// - Agnostic to transport layer -- you can provide your own. -// - Header parsing is zero-copy -- it results in strings that point directly into the buffer -// received off the wire. -// - Application code which reads and writes headers refers to headers by symbolic names, not by -// string literals, with lookups being array-index-based, not map-based. To make this possible, -// the application announces what headers it cares about in advance, in order to assign numeric -// values to them. -// - Methods are identified by an enum. - -#include -#include -#include -#include -#include - -namespace kj { - -#define KJ_HTTP_FOR_EACH_METHOD(MACRO) \ - MACRO(GET) \ - MACRO(HEAD) \ - MACRO(POST) \ - MACRO(PUT) \ - MACRO(DELETE) \ - MACRO(PATCH) \ - MACRO(PURGE) \ - MACRO(OPTIONS) \ - MACRO(TRACE) \ - /* standard methods */ \ - /* */ \ - /* (CONNECT is intentionally omitted since it is handled specially in HttpHandler) */ \ - \ - MACRO(COPY) \ - MACRO(LOCK) \ - MACRO(MKCOL) \ - MACRO(MOVE) \ - MACRO(PROPFIND) \ - MACRO(PROPPATCH) \ - MACRO(SEARCH) \ - MACRO(UNLOCK) \ - /* WebDAV */ \ - \ - MACRO(REPORT) \ - MACRO(MKACTIVITY) \ - MACRO(CHECKOUT) \ - MACRO(MERGE) \ - /* Subversion */ \ - \ - MACRO(MSEARCH) \ - MACRO(NOTIFY) \ - MACRO(SUBSCRIBE) \ - MACRO(UNSUBSCRIBE) - /* UPnP */ - -#define KJ_HTTP_FOR_EACH_CONNECTION_HEADER(MACRO) \ - MACRO(connection, "Connection") \ - MACRO(contentLength, "Content-Length") \ - MACRO(keepAlive, "Keep-Alive") \ - MACRO(te, "TE") \ - MACRO(trailer, "Trailer") \ - MACRO(transferEncoding, "Transfer-Encoding") \ - MACRO(upgrade, "Upgrade") - -enum class HttpMethod { - // Enum of known HTTP methods. - // - // We use an enum rather than a string to allow for faster parsing and switching and to reduce - // ambiguity. - -#define DECLARE_METHOD(id) id, -KJ_HTTP_FOR_EACH_METHOD(DECLARE_METHOD) -#undef DECLARE_METHOD -}; - -kj::StringPtr KJ_STRINGIFY(HttpMethod method); -kj::Maybe tryParseHttpMethod(kj::StringPtr name); - -class HttpHeaderTable; - -class HttpHeaderId { - // Identifies an HTTP header by numeric ID that indexes into an HttpHeaderTable. - // - // The KJ HTTP API prefers that headers be identified by these IDs for a few reasons: - // - Integer lookups are much more efficient than string lookups. - // - Case-insensitivity is awkward to deal with when const strings are being passed to the lookup - // method. - // - Writing out strings less often means fewer typos. - // - // See HttpHeaderTable for usage hints. - -public: - HttpHeaderId() = default; - - inline bool operator==(const HttpHeaderId& other) const { return id == other.id; } - inline bool operator!=(const HttpHeaderId& other) const { return id != other.id; } - inline bool operator< (const HttpHeaderId& other) const { return id < other.id; } - inline bool operator> (const HttpHeaderId& other) const { return id > other.id; } - inline bool operator<=(const HttpHeaderId& other) const { return id <= other.id; } - inline bool operator>=(const HttpHeaderId& other) const { return id >= other.id; } - - inline size_t hashCode() const { return id; } - - kj::StringPtr toString() const; - - void requireFrom(HttpHeaderTable& table) const; - // In debug mode, throws an exception if the HttpHeaderId is not from the given table. - // - // In opt mode, no-op. - -#define KJ_HTTP_FOR_EACH_BUILTIN_HEADER(MACRO) \ - MACRO(HOST, "Host") \ - MACRO(DATE, "Date") \ - MACRO(LOCATION, "Location") \ - MACRO(CONTENT_TYPE, "Content-Type") - // For convenience, these very-common headers are valid for all HttpHeaderTables. You can refer - // to them like: - // - // HttpHeaderId::HOST - // - // TODO(0.7): Fill this out with more common headers. - -#define DECLARE_HEADER(id, name) \ - static const HttpHeaderId id; - // Declare a constant for each builtin header, e.g.: HttpHeaderId::CONNECTION - - KJ_HTTP_FOR_EACH_BUILTIN_HEADER(DECLARE_HEADER); -#undef DECLARE_HEADER - -private: - HttpHeaderTable* table; - uint id; - - inline explicit constexpr HttpHeaderId(HttpHeaderTable* table, uint id): table(table), id(id) {} - friend class HttpHeaderTable; - friend class HttpHeaders; -}; - -class HttpHeaderTable { - // Construct an HttpHeaderTable to declare which headers you'll be interested in later on, and - // to manufacture IDs for them. - // - // Example: - // - // // Build a header table with the headers we are interested in. - // kj::HttpHeaderTable::Builder builder; - // const HttpHeaderId accept = builder.add("Accept"); - // const HttpHeaderId contentType = builder.add("Content-Type"); - // kj::HttpHeaderTable table(kj::mv(builder)); - // - // // Create an HTTP client. - // auto client = kj::newHttpClient(table, network); - // - // // Get http://example.com. - // HttpHeaders headers(table); - // headers.set(accept, "text/html"); - // auto response = client->send(kj::HttpMethod::GET, "http://example.com", headers) - // .wait(waitScope); - // auto msg = kj::str("Response content type: ", response.headers.get(contentType)); - - struct IdsByNameMap; - -public: - HttpHeaderTable(); - // Constructs a table that only contains the builtin headers. - - class Builder { - public: - Builder(); - HttpHeaderId add(kj::StringPtr name); - Own build(); - - HttpHeaderTable& getFutureTable(); - // Get the still-unbuilt header table. You cannot actually use it until build() has been - // called. - // - // This method exists to help when building a shared header table -- the Builder may be passed - // to several components, each of which will register the headers they need and get a reference - // to the future table. - - private: - kj::Own table; - }; - - KJ_DISALLOW_COPY(HttpHeaderTable); // Can't copy because HttpHeaderId points to the table. - ~HttpHeaderTable() noexcept(false); - - uint idCount(); - // Return the number of IDs in the table. - - kj::Maybe stringToId(kj::StringPtr name); - // Try to find an ID for the given name. The matching is case-insensitive, per the HTTP spec. - // - // Note: if `name` contains characters that aren't allowed in HTTP header names, this may return - // a bogus value rather than null, due to optimizations used in case-insensitive matching. - - kj::StringPtr idToString(HttpHeaderId id); - // Get the canonical string name for the given ID. - -private: - kj::Vector namesById; - kj::Own idsByName; -}; - -class HttpHeaders { - // Represents a set of HTTP headers. - // - // This class guards against basic HTTP header injection attacks: Trying to set a header name or - // value containing a newline, carriage return, or other invalid character will throw an - // exception. - -public: - explicit HttpHeaders(HttpHeaderTable& table); - - KJ_DISALLOW_COPY(HttpHeaders); - HttpHeaders(HttpHeaders&&) = default; - HttpHeaders& operator=(HttpHeaders&&) = default; - - void clear(); - // Clears all contents, as if the object was freshly-allocated. However, calling this rather - // than actually re-allocating the object may avoid re-allocation of internal objects. - - HttpHeaders clone() const; - // Creates a deep clone of the HttpHeaders. The returned object owns all strings it references. - - HttpHeaders cloneShallow() const; - // Creates a shallow clone of the HttpHeaders. The returned object references the same strings - // as the original, owning none of them. - - kj::Maybe get(HttpHeaderId id) const; - // Read a header. - - template - void forEach(Func&& func) const; - // Calls `func(name, value)` for each header in the set -- including headers that aren't mapped - // to IDs in the header table. Both inputs are of type kj::StringPtr. - - void set(HttpHeaderId id, kj::StringPtr value); - void set(HttpHeaderId id, kj::String&& value); - // Sets a header value, overwriting the existing value. - // - // The String&& version is equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `value` remains valid until the - // HttpHeaders object is destroyed. This allows string literals to be passed without making a - // copy, but complicates the use of dynamic values. Hint: Consider using `takeOwnership()`. - - void add(kj::StringPtr name, kj::StringPtr value); - void add(kj::StringPtr name, kj::String&& value); - void add(kj::String&& name, kj::String&& value); - // Append a header. `name` will be looked up in the header table, but if it's not mapped, the - // header will be added to the list of unmapped headers. - // - // The String&& versions are equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `name` and `value` remain valid - // until the HttpHeaders object is destroyed. This allows string literals to be passed without - // making a copy, but complicates the use of dynamic values. Hint: Consider using - // `takeOwnership()`. - - void unset(HttpHeaderId id); - // Removes a header. - // - // It's not possible to remove a header by string name because non-indexed headers would take - // O(n) time to remove. Instead, construct a new HttpHeaders object and copy contents. - - void takeOwnership(kj::String&& string); - void takeOwnership(kj::Array&& chars); - void takeOwnership(HttpHeaders&& otherHeaders); - // Takes overship of a string so that it lives until the HttpHeaders object is destroyed. Useful - // when you've passed a dynamic value to set() or add() or parse*(). - - struct ConnectionHeaders { - // These headers govern details of the specific HTTP connection or framing of the content. - // Hence, they are managed internally within the HTTP library, and never appear in an - // HttpHeaders structure. - -#define DECLARE_HEADER(id, name) \ - kj::StringPtr id; - KJ_HTTP_FOR_EACH_CONNECTION_HEADER(DECLARE_HEADER) -#undef DECLARE_HEADER - }; - - struct Request { - HttpMethod method; - kj::StringPtr url; - ConnectionHeaders connectionHeaders; - }; - struct Response { - uint statusCode; - kj::StringPtr statusText; - ConnectionHeaders connectionHeaders; - }; - - kj::Maybe tryParseRequest(kj::ArrayPtr content); - kj::Maybe tryParseResponse(kj::ArrayPtr content); - // Parse an HTTP header blob and add all the headers to this object. - // - // `content` should be all text from the start of the request to the first occurrance of two - // newlines in a row -- including the first of these two newlines, but excluding the second. - // - // The parse is performed with zero copies: The callee clobbers `content` with '\0' characters - // to split it into a bunch of shorter strings. The caller must keep `content` valid until the - // `HttpHeaders` is destroyed, or pass it to `takeOwnership()`. - - kj::String serializeRequest(HttpMethod method, kj::StringPtr url, - const ConnectionHeaders& connectionHeaders) const; - kj::String serializeResponse(uint statusCode, kj::StringPtr statusText, - const ConnectionHeaders& connectionHeaders) const; - // Serialize the headers as a complete request or response blob. The blob uses '\r\n' newlines - // and includes the double-newline to indicate the end of the headers. - - kj::String toString() const; - -private: - HttpHeaderTable* table; - - kj::Array indexedHeaders; - // Size is always table->idCount(). - - struct Header { - kj::StringPtr name; - kj::StringPtr value; - }; - kj::Vector

unindexedHeaders; - - kj::Vector> ownedStrings; - - kj::Maybe addNoCheck(kj::StringPtr name, kj::StringPtr value); - - kj::StringPtr cloneToOwn(kj::StringPtr str); - - kj::String serialize(kj::ArrayPtr word1, - kj::ArrayPtr word2, - kj::ArrayPtr word3, - const ConnectionHeaders& connectionHeaders) const; - - bool parseHeaders(char* ptr, char* end, ConnectionHeaders& connectionHeaders); - - // TODO(perf): Arguably we should store a map, but header sets are never very long - // TODO(perf): We could optimize for common headers by storing them directly as fields. We could - // also add direct accessors for those headers. -}; - -class WebSocket { -public: - WebSocket(kj::Own stream); - // Create a WebSocket wrapping the given I/O stream. - - kj::Promise send(kj::ArrayPtr message); - kj::Promise send(kj::ArrayPtr message); -}; - -class HttpClient { - // Interface to the client end of an HTTP connection. - // - // There are two kinds of clients: - // * Host clients are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests.) - // * Proxy clients are used when the target could be any arbitrary host on the internet. - // The `url` specified in a request is a full URL including protocol and hostname. - -public: - struct Response { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::Own body; - // `statusText` and `headers` remain valid until `body` is dropped. - }; - - struct Request { - kj::Own body; - // Write the request entity body to this stream, then drop it when done. - // - // May be null for GET and HEAD requests (which have no body) and requests that have - // Content-Length: 0. - - kj::Promise response; - // Promise for the eventual respnose. - }; - - virtual Request request(HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the client is a proxy client or a host client. - // - // `url` and `headers` need only remain valid until `request()` returns (they can be - // stack-allocated). - // - // `expectedBodySize`, if provided, must be exactly the number of bytes that will be written to - // the body. This will trigger use of the `Content-Length` connection header. Otherwise, - // `Transfer-Encoding: chunked` will be used. - - struct WebSocketResponse { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::OneOf, kj::Own> upstreamOrBody; - // `statusText` and `headers` remain valid until `upstreamOrBody` is dropped. - }; - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, kj::Own downstream); - // Tries to open a WebSocket. Default implementation calls send() and never returns a WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy clients. Default implementation throws - // UNIMPLEMENTED. -}; - -class HttpService { - // Interface which HTTP services should implement. - // - // This interface is functionally equivalent to HttpClient, but is intended for applications to - // implement rather than call. The ergonomics and performance of the method signatures are - // optimized for the serving end. - // - // As with clients, there are two kinds of services: - // * Host services are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests, and the service - // may in fact serve multiple origins via this header.) - // * Proxy services are used when the target could be any arbitrary host on the internet, i.e. to - // implement an HTTP proxy. The `url` specified in a request is a full URL including protocol - // and hostname. - -public: - class Response { - public: - virtual kj::Own send( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Begin the response. - // - // `statusText` and `headers` need only remain valid until send() returns (they can be - // stack-allocated). - }; - - virtual kj::Promise request( - HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::AsyncInputStream& requestBody, Response& response) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the service is a proxy service or a host service. - // - // `url` and `headers` are invalidated on the first read from `requestBody` or when the returned - // promise resolves, whichever comes first. - - class WebSocketResponse: public Response { - public: - kj::Own startWebSocket( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - WebSocket& upstream); - // Begin the response. - // - // `statusText` and `headers` need only remain valid until startWebSocket() returns (they can - // be stack-allocated). - }; - - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, WebSocketResponse& response); - // Tries to open a WebSocket. Default implementation calls request() and never returns a - // WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy services. Default implementation throws - // UNIMPLEMENTED. -}; - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::Network& network, - kj::Maybe tlsNetwork = nullptr); -// Creates a proxy HttpClient that connects to hosts over the given network. -// -// `responseHeaderTable` is used when parsing HTTP responses. Requests can use any header table. -// -// `tlsNetwork` is required to support HTTPS destination URLs. Otherwise, only HTTP URLs can be -// fetched. - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::AsyncIoStream& stream); -// Creates an HttpClient that speaks over the given pre-established connection. The client may -// be used as a proxy client or a host client depending on whether the peer is operating as -// a proxy. -// -// Note that since this client has only one stream to work with, it will try to pipeline all -// requests on this stream. If one request or response has an I/O failure, all subsequent requests -// fail as well. If the destination server chooses to close the connection after a response, -// subsequent requests will fail. If a response takes a long time, it blocks subsequent responses. -// If a WebSocket is opened successfully, all subsequent requests fail. - -kj::Own newHttpClient(HttpService& service); -kj::Own newHttpService(HttpClient& client); -// Adapts an HttpClient to an HttpService and vice versa. - -struct HttpServerSettings { - kj::Duration headerTimeout = 15 * kj::SECONDS; - // After initial connection open, or after receiving the first byte of a pipelined request, - // the client must send the complete request within this time. - - kj::Duration pipelineTimeout = 5 * kj::SECONDS; - // After one request/response completes, we'll wait up to this long for a pipelined request to - // arrive. -}; - -class HttpServer: private kj::TaskSet::ErrorHandler { - // Class which listens for requests on ports or connections and sends them to an HttpService. - -public: - typedef HttpServerSettings Settings; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings = Settings()); - // Set up an HttpServer that directs incoming connections to the given service. The service - // may be a host service or a proxy service depending on whether you are intending to implement - // an HTTP server or an HTTP proxy. - - kj::Promise drain(); - // Stop accepting new connections or new requests on existing connections. Finish any requests - // that are already executing, then close the connections. Returns once no more requests are - // in-flight. - - kj::Promise listenHttp(kj::ConnectionReceiver& port); - // Accepts HTTP connections on the given port and directs them to the handler. - // - // The returned promise never completes normally. It may throw if port.accept() throws. Dropping - // the returned promise will cause the server to stop listening on the port, but already-open - // connections will continue to be served. Destroy the whole HttpServer to cancel all I/O. - - kj::Promise listenHttp(kj::Own connection); - // Reads HTTP requests from the given connection and directs them to the handler. A successful - // completion of the promise indicates that all requests received on the connection resulted in - // a complete response, and the client closed the connection gracefully or drain() was called. - // The promise throws if an unparseable request is received or if some I/O error occurs. Dropping - // the returned promise will cancel all I/O on the connection and cancel any in-flight requests. - -private: - class Connection; - - kj::Timer& timer; - HttpHeaderTable& requestHeaderTable; - HttpService& service; - Settings settings; - - bool draining = false; - kj::ForkedPromise onDrain; - kj::Own> drainFulfiller; - - uint connectionCount = 0; - kj::Maybe>> zeroConnectionsFulfiller; - - kj::TaskSet tasks; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings, kj::PromiseFulfillerPair paf); - - kj::Promise listenLoop(kj::ConnectionReceiver& port); - - void taskFailed(kj::Exception&& exception) override; -}; - -// ======================================================================================= -// inline implementation - -inline void HttpHeaderId::requireFrom(HttpHeaderTable& table) const { - KJ_IREQUIRE(this->table == nullptr || this->table == &table, - "the provided HttpHeaderId is from the wrong HttpHeaderTable"); -} - -inline kj::Own HttpHeaderTable::Builder::build() { return kj::mv(table); } -inline HttpHeaderTable& HttpHeaderTable::Builder::getFutureTable() { return *table; } - -inline uint HttpHeaderTable::idCount() { return namesById.size(); } - -inline kj::StringPtr HttpHeaderTable::idToString(HttpHeaderId id) { - id.requireFrom(*this); - return namesById[id.id]; -} - -inline kj::Maybe HttpHeaders::get(HttpHeaderId id) const { - id.requireFrom(*table); - auto result = indexedHeaders[id.id]; - return result == nullptr ? kj::Maybe(nullptr) : result; -} - -inline void HttpHeaders::unset(HttpHeaderId id) { - id.requireFrom(*table); - indexedHeaders[id.id] = nullptr; -} - -template -inline void HttpHeaders::forEach(Func&& func) const { - for (auto i: kj::indices(indexedHeaders)) { - if (indexedHeaders[i] != nullptr) { - func(table->idToString(HttpHeaderId(table, i)), indexedHeaders[i]); - } - } - - for (auto& header: unindexedHeaders) { - func(header.name, header.value); - } -} - -} // namespace kj - -#endif // KJ_COMPAT_HTTP_H_ diff --git a/external/capnp/include/kj/debug.h b/external/capnp/include/kj/debug.h deleted file mode 100644 index fff7f98bc0..0000000000 --- a/external/capnp/include/kj/debug.h +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file declares convenient macros for debug logging and error handling. The macros make -// it excessively easy to extract useful context information from code. Example: -// -// KJ_ASSERT(a == b, a, b, "a and b must be the same."); -// -// On failure, this will throw an exception whose description looks like: -// -// myfile.c++:43: bug in code: expected a == b; a = 14; b = 72; a and b must be the same. -// -// As you can see, all arguments after the first provide additional context. -// -// The macros available are: -// -// * `KJ_LOG(severity, ...)`: Just writes a log message, to stderr by default (but you can -// intercept messages by implementing an ExceptionCallback). `severity` is `INFO`, `WARNING`, -// `ERROR`, or `FATAL`. By default, `INFO` logs are not written, but for command-line apps the -// user should be able to pass a flag like `--verbose` to enable them. Other log levels are -// enabled by default. Log messages -- like exceptions -- can be intercepted by registering an -// ExceptionCallback. -// -// * `KJ_DBG(...)`: Like `KJ_LOG`, but intended specifically for temporary log lines added while -// debugging a particular problem. Calls to `KJ_DBG` should always be deleted before committing -// code. It is suggested that you set up a pre-commit hook that checks for this. -// -// * `KJ_ASSERT(condition, ...)`: Throws an exception if `condition` is false, or aborts if -// exceptions are disabled. This macro should be used to check for bugs in the surrounding code -// and its dependencies, but NOT to check for invalid input. The macro may be followed by a -// brace-delimited code block; if so, the block will be executed in the case where the assertion -// fails, before throwing the exception. If control jumps out of the block (e.g. with "break", -// "return", or "goto"), then the error is considered "recoverable" -- in this case, if -// exceptions are disabled, execution will continue normally rather than aborting (but if -// exceptions are enabled, an exception will still be thrown on exiting the block). A "break" -// statement in particular will jump to the code immediately after the block (it does not break -// any surrounding loop or switch). Example: -// -// KJ_ASSERT(value >= 0, "Value cannot be negative.", value) { -// // Assertion failed. Set value to zero to "recover". -// value = 0; -// // Don't abort if exceptions are disabled. Continue normally. -// // (Still throw an exception if they are enabled, though.) -// break; -// } -// // When exceptions are disabled, we'll get here even if the assertion fails. -// // Otherwise, we get here only if the assertion passes. -// -// * `KJ_REQUIRE(condition, ...)`: Like `KJ_ASSERT` but used to check preconditions -- e.g. to -// validate parameters passed from a caller. A failure indicates that the caller is buggy. -// -// * `KJ_SYSCALL(code, ...)`: Executes `code` assuming it makes a system call. A negative result -// is considered an error, with error code reported via `errno`. EINTR is handled by retrying. -// Other errors are handled by throwing an exception. If you need to examine the return code, -// assign it to a variable like so: -// -// int fd; -// KJ_SYSCALL(fd = open(filename, O_RDONLY), filename); -// -// `KJ_SYSCALL` can be followed by a recovery block, just like `KJ_ASSERT`. -// -// * `KJ_NONBLOCKING_SYSCALL(code, ...)`: Like KJ_SYSCALL, but will not throw an exception on -// EAGAIN/EWOULDBLOCK. The calling code should check the syscall's return value to see if it -// indicates an error; in this case, it can assume the error was EAGAIN because any other error -// would have caused an exception to be thrown. -// -// * `KJ_CONTEXT(...)`: Notes additional contextual information relevant to any exceptions thrown -// from within the current scope. That is, until control exits the block in which KJ_CONTEXT() -// is used, if any exception is generated, it will contain the given information in its context -// chain. This is helpful because it can otherwise be very difficult to come up with error -// messages that make sense within low-level helper code. Note that the parameters to -// KJ_CONTEXT() are only evaluated if an exception is thrown. This implies that any variables -// used must remain valid until the end of the scope. -// -// Notes: -// * Do not write expressions with side-effects in the message content part of the macro, as the -// message will not necessarily be evaluated. -// * For every macro `FOO` above except `LOG`, there is also a `FAIL_FOO` macro used to report -// failures that already happened. For the macros that check a boolean condition, `FAIL_FOO` -// omits the first parameter and behaves like it was `false`. `FAIL_SYSCALL` and -// `FAIL_RECOVERABLE_SYSCALL` take a string and an OS error number as the first two parameters. -// The string should be the name of the failed system call. -// * For every macro `FOO` above, there is a `DFOO` version (or `RECOVERABLE_DFOO`) which is only -// executed in debug mode, i.e. when KJ_DEBUG is defined. KJ_DEBUG is defined automatically -// by common.h when compiling without optimization (unless NDEBUG is defined), but you can also -// define it explicitly (e.g. -DKJ_DEBUG). Generally, production builds should NOT use KJ_DEBUG -// as it may enable expensive checks that are unlikely to fail. - -#ifndef KJ_DEBUG_H_ -#define KJ_DEBUG_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" -#include "exception.h" - -#ifdef ERROR -// This is problematic because windows.h #defines ERROR, which we use in an enum here. -#error "Make sure to to undefine ERROR (or just #include ) before this file" -#endif - -namespace kj { - -#if _MSC_VER -// MSVC does __VA_ARGS__ differently from GCC: -// - A trailing comma before an empty __VA_ARGS__ is removed automatically, whereas GCC wants -// you to request this behavior with "##__VA_ARGS__". -// - If __VA_ARGS__ is passed directly as an argument to another macro, it will be treated as a -// *single* argument rather than an argument list. This can be worked around by wrapping the -// outer macro call in KJ_EXPAND(), which appraently forces __VA_ARGS__ to be expanded before -// the macro is evaluated. I don't understand the C preprocessor. -// - Using "#__VA_ARGS__" to stringify __VA_ARGS__ expands to zero tokens when __VA_ARGS__ is -// empty, rather than expanding to an empty string literal. We can work around by concatenating -// with an empty string literal. - -#define KJ_EXPAND(X) X - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - "" #__VA_ARGS__, __VA_ARGS__) - -#define KJ_DBG(...) KJ_EXPAND(KJ_LOG(DBG, __VA_ARGS__)) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -// TODO(msvc): MSVC mis-deduces `ContextImpl` as `ContextImpl` in some edge -// cases, such as inside nested lambdas inside member functions. Wrapping the type in -// `decltype(instance<...>())` helps it deduce the context function's type correctly. -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)); \ - }; \ - decltype(::kj::instance<::kj::_::Debug::ContextImpl>()) \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*[&] { \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", "" #__VA_ARGS__, __VA_ARGS__).fatal(); \ - } \ - return _kj_result; \ - }()) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)) - -#else - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - #__VA_ARGS__, ##__VA_ARGS__) - -#define KJ_DBG(...) KJ_LOG(DBG, ##__VA_ARGS__) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)); \ - }; \ - ::kj::_::Debug::ContextImpl \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*({ \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", #__VA_ARGS__, ##__VA_ARGS__).fatal(); \ - } \ - kj::mv(_kj_result); \ - })) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)) - -#endif - -#define KJ_SYSCALL_HANDLE_ERRORS(call) \ - if (int _kjSyscallError = ::kj::_::Debug::syscallError([&](){return (call);}, false)) \ - switch (int error = _kjSyscallError) -// Like KJ_SYSCALL, but doesn't throw. Instead, the block after the macro is a switch block on the -// error. Additionally, the int value `error` is defined within the block. So you can do: -// -// KJ_SYSCALL_HANDLE_ERRORS(foo()) { -// case ENOENT: -// handleNoSuchFile(); -// break; -// case EEXIST: -// handleExists(); -// break; -// default: -// KJ_FAIL_SYSCALL("foo()", error); -// } else { -// handleSuccessCase(); -// } - -#define KJ_ASSERT KJ_REQUIRE -#define KJ_FAIL_ASSERT KJ_FAIL_REQUIRE -#define KJ_ASSERT_NONNULL KJ_REQUIRE_NONNULL -// Use "ASSERT" in place of "REQUIRE" when the problem is local to the immediate surrounding code. -// That is, if the assert ever fails, it indicates that the immediate surrounding code is broken. - -#ifdef KJ_DEBUG -#define KJ_DLOG KJ_LOG -#define KJ_DASSERT KJ_ASSERT -#define KJ_DREQUIRE KJ_REQUIRE -#else -#define KJ_DLOG(...) do {} while (false) -#define KJ_DASSERT(...) do {} while (false) -#define KJ_DREQUIRE(...) do {} while (false) -#endif - -namespace _ { // private - -class Debug { -public: - Debug() = delete; - - typedef LogSeverity Severity; // backwards-compatibility - -#if _WIN32 - struct Win32Error { - // Hack for overloading purposes. - uint number; - inline explicit Win32Error(uint number): number(number) {} - }; -#endif - - static inline bool shouldLog(LogSeverity severity) { return severity >= minSeverity; } - // Returns whether messages of the given severity should be logged. - - static inline void setLogLevel(LogSeverity severity) { minSeverity = severity; } - // Set the minimum message severity which will be logged. - // - // TODO(someday): Expose publicly. - - template - static void log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params); - - class Fault { - public: - template - Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params); - Fault(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs); - Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs); -#if _WIN32 - Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs); -#endif - ~Fault() noexcept(false); - - KJ_NOINLINE KJ_NORETURN(void fatal()); - // Throw the exception. - - private: - void init(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs, ArrayPtr argValues); - void init(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#if _WIN32 - void init(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#endif - - Exception* exception; - }; - - class SyscallResult { - public: - inline SyscallResult(int errorNumber): errorNumber(errorNumber) {} - inline operator void*() { return errorNumber == 0 ? this : nullptr; } - inline int getErrorNumber() { return errorNumber; } - - private: - int errorNumber; - }; - - template - static SyscallResult syscall(Call&& call, bool nonblocking); - template - static int syscallError(Call&& call, bool nonblocking); - -#if _WIN32 - static bool isWin32Success(int boolean); - static bool isWin32Success(void* handle); - static Win32Error getWin32Error(); -#endif - - class Context: public ExceptionCallback { - public: - Context(); - KJ_DISALLOW_COPY(Context); - virtual ~Context() noexcept(false); - - struct Value { - const char* file; - int line; - String description; - - inline Value(const char* file, int line, String&& description) - : file(file), line(line), description(mv(description)) {} - }; - - virtual Value evaluate() = 0; - - virtual void onRecoverableException(Exception&& exception) override; - virtual void onFatalException(Exception&& exception) override; - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - - private: - bool logged; - Maybe value; - - Value ensureInitialized(); - }; - - template - class ContextImpl: public Context { - public: - inline ContextImpl(Func& func): func(func) {} - KJ_DISALLOW_COPY(ContextImpl); - - Value evaluate() override { - return func(); - } - private: - Func& func; - }; - - template - static String makeDescription(const char* macroArgs, Params&&... params); - -private: - static LogSeverity minSeverity; - - static void logInternal(const char* file, int line, LogSeverity severity, const char* macroArgs, - ArrayPtr argValues); - static String makeDescriptionInternal(const char* macroArgs, ArrayPtr argValues); - - static int getOsErrorNumber(bool nonblocking); - // Get the error code of the last error (e.g. from errno). Returns -1 on EINTR. -}; - -template -void Debug::log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - logInternal(file, line, severity, macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline void Debug::log<>(const char* file, int line, LogSeverity severity, const char* macroArgs) { - logInternal(file, line, severity, macroArgs, nullptr); -} - -template -Debug::Fault::Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params) - : exception(nullptr) { - String argValues[sizeof...(Params)] = {str(params)...}; - init(file, line, code, condition, macroArgs, - arrayPtr(argValues, sizeof...(Params))); -} - -inline Debug::Fault::Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline Debug::Fault::Fault(const char* file, int line, kj::Exception::Type type, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, type, condition, macroArgs, nullptr); -} - -#if _WIN32 -inline Debug::Fault::Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline bool Debug::isWin32Success(int boolean) { - return boolean; -} -inline bool Debug::isWin32Success(void* handle) { - // Assume null and INVALID_HANDLE_VALUE mean failure. - return handle != nullptr && handle != (void*)-1; -} -#endif - -template -Debug::SyscallResult Debug::syscall(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return SyscallResult(errorNum); - } - } - return SyscallResult(0); -} - -template -int Debug::syscallError(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return errorNum; - } - } - return 0; -} - -template -String Debug::makeDescription(const char* macroArgs, Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - return makeDescriptionInternal(macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline String Debug::makeDescription<>(const char* macroArgs) { - return makeDescriptionInternal(macroArgs, nullptr); -} - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_DEBUG_H_ diff --git a/external/capnp/include/kj/exception.h b/external/capnp/include/kj/exception.h deleted file mode 100644 index f6c0b2daa6..0000000000 --- a/external/capnp/include/kj/exception.h +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_EXCEPTION_H_ -#define KJ_EXCEPTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class ExceptionImpl; - -class Exception { - // Exception thrown in case of fatal errors. - // - // Actually, a subclass of this which also implements std::exception will be thrown, but we hide - // that fact from the interface to avoid #including . - -public: - enum class Type { - // What kind of failure? - - FAILED = 0, - // Something went wrong. This is the usual error type. KJ_ASSERT and KJ_REQUIRE throw this - // error type. - - OVERLOADED = 1, - // The call failed because of a temporary lack of resources. This could be space resources - // (out of memory, out of disk space) or time resources (request queue overflow, operation - // timed out). - // - // The operation might work if tried again, but it should NOT be repeated immediately as this - // may simply exacerbate the problem. - - DISCONNECTED = 2, - // The call required communication over a connection that has been lost. The callee will need - // to re-establish connections and try again. - - UNIMPLEMENTED = 3 - // The requested method is not implemented. The caller may wish to revert to a fallback - // approach based on other methods. - - // IF YOU ADD A NEW VALUE: - // - Update the stringifier. - // - Update Cap'n Proto's RPC protocol's Exception.Type enum. - }; - - Exception(Type type, const char* file, int line, String description = nullptr) noexcept; - Exception(Type type, String file, int line, String description = nullptr) noexcept; - Exception(const Exception& other) noexcept; - Exception(Exception&& other) = default; - ~Exception() noexcept; - - const char* getFile() const { return file; } - int getLine() const { return line; } - Type getType() const { return type; } - StringPtr getDescription() const { return description; } - ArrayPtr getStackTrace() const { return arrayPtr(trace, traceCount); } - - struct Context { - // Describes a bit about what was going on when the exception was thrown. - - const char* file; - int line; - String description; - Maybe> next; - - Context(const char* file, int line, String&& description, Maybe>&& next) - : file(file), line(line), description(mv(description)), next(mv(next)) {} - Context(const Context& other) noexcept; - }; - - inline Maybe getContext() const { - KJ_IF_MAYBE(c, context) { - return **c; - } else { - return nullptr; - } - } - - void wrapContext(const char* file, int line, String&& description); - // Wraps the context in a new node. This becomes the head node returned by getContext() -- it - // is expected that contexts will be added in reverse order as the exception passes up the - // callback stack. - - KJ_NOINLINE void extendTrace(uint ignoreCount); - // Append the current stack trace to the exception's trace, ignoring the first `ignoreCount` - // frames (see `getStackTrace()` for discussion of `ignoreCount`). - - KJ_NOINLINE void truncateCommonTrace(); - // Remove the part of the stack trace which the exception shares with the caller of this method. - // This is used by the async library to remove the async infrastructure from the stack trace - // before replacing it with the async trace. - - void addTrace(void* ptr); - // Append the given pointer to the backtrace, if it is not already full. This is used by the - // async library to trace through the promise chain that led to the exception. - -private: - String ownFile; - const char* file; - int line; - Type type; - String description; - Maybe> context; - void* trace[32]; - uint traceCount; - - friend class ExceptionImpl; -}; - -StringPtr KJ_STRINGIFY(Exception::Type type); -String KJ_STRINGIFY(const Exception& e); - -// ======================================================================================= - -enum class LogSeverity { - INFO, // Information describing what the code is up to, which users may request to see - // with a flag like `--verbose`. Does not indicate a problem. Not printed by - // default; you must call setLogLevel(INFO) to enable. - WARNING, // A problem was detected but execution can continue with correct output. - ERROR, // Something is wrong, but execution can continue with garbage output. - FATAL, // Something went wrong, and execution cannot continue. - DBG // Temporary debug logging. See KJ_DBG. - - // Make sure to update the stringifier if you add a new severity level. -}; - -StringPtr KJ_STRINGIFY(LogSeverity severity); - -class ExceptionCallback { - // If you don't like C++ exceptions, you may implement and register an ExceptionCallback in order - // to perform your own exception handling. For example, a reasonable thing to do is to have - // onRecoverableException() set a flag indicating that an error occurred, and then check for that - // flag just before writing to storage and/or returning results to the user. If the flag is set, - // discard whatever you have and return an error instead. - // - // ExceptionCallbacks must always be allocated on the stack. When an exception is thrown, the - // newest ExceptionCallback on the calling thread's stack is called. The default implementation - // of each method calls the next-oldest ExceptionCallback for that thread. Thus the callbacks - // behave a lot like try/catch blocks, except that they are called before any stack unwinding - // occurs. - -public: - ExceptionCallback(); - KJ_DISALLOW_COPY(ExceptionCallback); - virtual ~ExceptionCallback() noexcept(false); - - virtual void onRecoverableException(Exception&& exception); - // Called when an exception has been raised, but the calling code has the ability to continue by - // producing garbage output. This method _should_ throw the exception, but is allowed to simply - // return if garbage output is acceptable. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void onFatalException(Exception&& exception); - // Called when an exception has been raised and the calling code cannot continue. If this method - // returns normally, abort() will be called. The method must throw the exception to avoid - // aborting. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text); - // Called when something wants to log some debug text. `contextDepth` indicates how many levels - // of context the message passed through; it may make sense to indent the message accordingly. - // - // The global default implementation writes the text to stderr. - - enum class StackTraceMode { - FULL, - // Stringifying a stack trace will attempt to determine source file and line numbers. This may - // be expensive. For example, on Linux, this shells out to `addr2line`. - // - // This is the default in debug builds. - - ADDRESS_ONLY, - // Stringifying a stack trace will only generate a list of code addresses. - // - // This is the default in release builds. - - NONE - // Generating a stack trace will always return an empty array. - // - // This avoids ever unwinding the stack. On Windows in particular, the stack unwinding library - // has been observed to be pretty slow, so exception-heavy code might benefit significantly - // from this setting. (But exceptions should be rare...) - }; - - virtual StackTraceMode stackTraceMode(); - // Returns the current preferred stack trace mode. - -protected: - ExceptionCallback& next; - -private: - ExceptionCallback(ExceptionCallback& next); - - class RootExceptionCallback; - friend ExceptionCallback& getExceptionCallback(); -}; - -ExceptionCallback& getExceptionCallback(); -// Returns the current exception callback. - -KJ_NOINLINE KJ_NORETURN(void throwFatalException(kj::Exception&& exception, uint ignoreCount = 0)); -// Invoke the exception callback to throw the given fatal exception. If the exception callback -// returns, abort. - -KJ_NOINLINE void throwRecoverableException(kj::Exception&& exception, uint ignoreCount = 0); -// Invoke the exception callback to throw the given recoverable exception. If the exception -// callback returns, return normally. - -// ======================================================================================= - -namespace _ { class Runnable; } - -template -Maybe runCatchingExceptions(Func&& func) noexcept; -// Executes the given function (usually, a lambda returning nothing) catching any exceptions that -// are thrown. Returns the Exception if there was one, or null if the operation completed normally. -// Non-KJ exceptions will be wrapped. -// -// If exception are disabled (e.g. with -fno-exceptions), this will still detect whether any -// recoverable exceptions occurred while running the function and will return those. - -class UnwindDetector { - // Utility for detecting when a destructor is called due to unwind. Useful for: - // - Avoiding throwing exceptions in this case, which would terminate the program. - // - Detecting whether to commit or roll back a transaction. - // - // To use this class, either inherit privately from it or declare it as a member. The detector - // works by comparing the exception state against that when the constructor was called, so for - // an object that was actually constructed during exception unwind, it will behave as if no - // unwind is taking place. This is usually the desired behavior. - -public: - UnwindDetector(); - - bool isUnwinding() const; - // Returns true if the current thread is in a stack unwind that it wasn't in at the time the - // object was constructed. - - template - void catchExceptionsIfUnwinding(Func&& func) const; - // Runs the given function (e.g., a lambda). If isUnwinding() is true, any exceptions are - // caught and treated as secondary faults, meaning they are considered to be side-effects of the - // exception that is unwinding the stack. Otherwise, exceptions are passed through normally. - -private: - uint uncaughtCount; - - void catchExceptionsAsSecondaryFaults(_::Runnable& runnable) const; -}; - -namespace _ { // private - -class Runnable { -public: - virtual void run() = 0; -}; - -template -class RunnableImpl: public Runnable { -public: - RunnableImpl(Func&& func): func(kj::mv(func)) {} - void run() override { - func(); - } -private: - Func func; -}; - -Maybe runCatchingExceptions(Runnable& runnable) noexcept; - -} // namespace _ (private) - -template -Maybe runCatchingExceptions(Func&& func) noexcept { - _::RunnableImpl> runnable(kj::fwd(func)); - return _::runCatchingExceptions(runnable); -} - -template -void UnwindDetector::catchExceptionsIfUnwinding(Func&& func) const { - if (isUnwinding()) { - _::RunnableImpl> runnable(kj::fwd(func)); - catchExceptionsAsSecondaryFaults(runnable); - } else { - func(); - } -} - -#define KJ_ON_SCOPE_SUCCESS(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (!KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited normally (not due to an exception). - -#define KJ_ON_SCOPE_FAILURE(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited due to an exception. - -// ======================================================================================= - -KJ_NOINLINE ArrayPtr getStackTrace(ArrayPtr space, uint ignoreCount); -// Attempt to get the current stack trace, returning a list of pointers to instructions. The -// returned array is a slice of `space`. Provide a larger `space` to get a deeper stack trace. -// If the platform doesn't support stack traces, returns an empty array. -// -// `ignoreCount` items will be truncated from the front of the trace. This is useful for chopping -// off a prefix of the trace that is uninteresting to the developer because it's just locations -// inside the debug infrastructure that is requesting the trace. Be careful to mark functions as -// KJ_NOINLINE if you intend to count them in `ignoreCount`. Note that, unfortunately, the -// ignored entries will still waste space in the `space` array (and the returned array's `begin()` -// is never exactly equal to `space.begin()` due to this effect, even if `ignoreCount` is zero -// since `getStackTrace()` needs to ignore its own internal frames). - -String stringifyStackTrace(ArrayPtr); -// Convert the stack trace to a string with file names and line numbers. This may involve executing -// suprocesses. - -String getStackTrace(); -// Get a stack trace right now and stringify it. Useful for debugging. - -void printStackTraceOnCrash(); -// Registers signal handlers on common "crash" signals like SIGSEGV that will (attempt to) print -// a stack trace. You should call this as early as possible on program startup. Programs using -// KJ_MAIN get this automatically. - -kj::StringPtr trimSourceFilename(kj::StringPtr filename); -// Given a source code file name, trim off noisy prefixes like "src/" or -// "/ekam-provider/canonical/". - -} // namespace kj - -#endif // KJ_EXCEPTION_H_ diff --git a/external/capnp/include/kj/function.h b/external/capnp/include/kj/function.h deleted file mode 100644 index ba6601b560..0000000000 --- a/external/capnp/include/kj/function.h +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_FUNCTION_H_ -#define KJ_FUNCTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" - -namespace kj { - -template -class Function; -// Function wrapper using virtual-based polymorphism. Use this when template polymorphism is -// not possible. You can, for example, accept a Function as a parameter: -// -// void setFilter(Function filter); -// -// The caller of `setFilter()` may then pass any callable object as the parameter. The callable -// object does not have to have the exact signature specified, just one that is "compatible" -- -// i.e. the return type is covariant and the parameters are contravariant. -// -// Unlike `std::function`, `kj::Function`s are movable but not copyable, just like `kj::Own`. This -// is to avoid unexpected heap allocation or slow atomic reference counting. -// -// When a `Function` is constructed from an lvalue, it captures only a reference to the value. -// When constructed from an rvalue, it invokes the value's move constructor. So, for example: -// -// struct AddN { -// int n; -// int operator(int i) { return i + n; } -// } -// -// Function f1 = AddN{2}; -// // f1 owns an instance of AddN. It may safely be moved out -// // of the local scope. -// -// AddN adder(2); -// Function f2 = adder; -// // f2 contains a reference to `adder`. Thus, it becomes invalid -// // when `adder` goes out-of-scope. -// -// AddN adder2(2); -// Function f3 = kj::mv(adder2); -// // f3 owns an insatnce of AddN moved from `adder2`. f3 may safely -// // be moved out of the local scope. -// -// Additionally, a Function may be bound to a class method using KJ_BIND_METHOD(object, methodName). -// For example: -// -// class Printer { -// public: -// void print(int i); -// void print(kj::StringPtr s); -// }; -// -// Printer p; -// -// Function intPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(int). -// -// Function strPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(kj::StringPtr). -// -// Notice how KJ_BIND_METHOD is able to figure out which overload to use depending on the kind of -// Function it is binding to. - -template -class ConstFunction; -// Like Function, but wraps a "const" (i.e. thread-safe) call. - -template -class Function { -public: - template - inline Function(F&& f): impl(heap>(kj::fwd(f))) {} - Function() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(Function); - Function(Function&) = delete; - Function& operator=(Function&) = delete; - template Function(const Function&) = delete; - template Function& operator=(const Function&) = delete; - template Function(const ConstFunction&) = delete; - template Function& operator=(const ConstFunction&) = delete; - Function(Function&&) = default; - Function& operator=(Function&&) = default; - - inline Return operator()(Params... params) { - return (*impl)(kj::fwd(params)...); - } - - Function reference() { - // Forms a new Function of the same type that delegates to this Function by reference. - // Therefore, this Function must outlive the returned Function, but otherwise they behave - // exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -template -class ConstFunction { -public: - template - inline ConstFunction(F&& f): impl(heap>(kj::fwd(f))) {} - ConstFunction() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(ConstFunction); - ConstFunction(ConstFunction&) = delete; - ConstFunction& operator=(ConstFunction&) = delete; - template ConstFunction(const ConstFunction&) = delete; - template ConstFunction& operator=(const ConstFunction&) = delete; - template ConstFunction(const Function&) = delete; - template ConstFunction& operator=(const Function&) = delete; - ConstFunction(ConstFunction&&) = default; - ConstFunction& operator=(ConstFunction&&) = default; - - inline Return operator()(Params... params) const { - return (*impl)(kj::fwd(params)...); - } - - ConstFunction reference() const { - // Forms a new ConstFunction of the same type that delegates to this ConstFunction by reference. - // Therefore, this ConstFunction must outlive the returned ConstFunction, but otherwise they - // behave exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) const = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) const override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -#if 1 - -namespace _ { // private - -template -class BoundMethod; - -template ::*method)(Params...)> -class BoundMethod::*)(Params...), method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -template ::*method)(Params...) const> -class BoundMethod::*)(Params...) const, method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) const { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -} // namespace _ (private) - -#define KJ_BIND_METHOD(obj, method) \ - ::kj::_::BoundMethod::method), \ - &::kj::Decay::method>(obj) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. -// -// The current implementation requires that the method is not overloaded. -// -// TODO(someday): C++14's generic lambdas may be able to simplify this code considerably, and -// probably make it work with overloaded methods. - -#else -// Here's a better implementation of the above that doesn't work with GCC (but does with Clang) -// because it uses a local class with a template method. Sigh. This implementation supports -// overloaded methods. - -#define KJ_BIND_METHOD(obj, method) \ - ({ \ - typedef KJ_DECLTYPE_REF(obj) T; \ - class F { \ - public: \ - inline F(T&& t): t(::kj::fwd(t)) {} \ - template \ - auto operator()(Params&&... params) \ - -> decltype(::kj::instance().method(::kj::fwd(params)...)) { \ - return t.method(::kj::fwd(params)...); \ - } \ - private: \ - T t; \ - }; \ - (F(obj)); \ - }) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. - -#endif - -} // namespace kj - -#endif // KJ_FUNCTION_H_ diff --git a/external/capnp/include/kj/io.h b/external/capnp/include/kj/io.h deleted file mode 100644 index f5c03bfe7b..0000000000 --- a/external/capnp/include/kj/io.h +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_IO_H_ -#define KJ_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "common.h" -#include "array.h" -#include "exception.h" - -namespace kj { - -// ======================================================================================= -// Abstract interfaces - -class InputStream { -public: - virtual ~InputStream() noexcept(false); - - size_t read(void* buffer, size_t minBytes, size_t maxBytes); - // Reads at least minBytes and at most maxBytes, copying them into the given buffer. Returns - // the size read. Throws an exception on errors. Implemented in terms of tryRead(). - // - // maxBytes is the number of bytes the caller really wants, but minBytes is the minimum amount - // needed by the caller before it can start doing useful processing. If the stream returns less - // than maxBytes, the caller will usually call read() again later to get the rest. Returning - // less than maxBytes is useful when it makes sense for the caller to parallelize processing - // with I/O. - // - // Never blocks if minBytes is zero. If minBytes is zero and maxBytes is non-zero, this may - // attempt a non-blocking read or may just return zero. To force a read, use a non-zero minBytes. - // To detect EOF without throwing an exception, use tryRead(). - // - // If the InputStream can't produce minBytes, it MUST throw an exception, as the caller is not - // expected to understand how to deal with partial reads. - - virtual size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - // Like read(), but may return fewer than minBytes on EOF. - - inline void read(void* buffer, size_t bytes) { read(buffer, bytes, bytes); } - // Convenience method for reading an exact number of bytes. - - virtual void skip(size_t bytes); - // Skips past the given number of bytes, discarding them. The default implementation read()s - // into a scratch buffer. -}; - -class OutputStream { -public: - virtual ~OutputStream() noexcept(false); - - virtual void write(const void* buffer, size_t size) = 0; - // Always writes the full size. Throws exception on error. - - virtual void write(ArrayPtr> pieces); - // Equivalent to write()ing each byte array in sequence, which is what the default implementation - // does. Override if you can do something better, e.g. use writev() to do the write in a single - // syscall. -}; - -class BufferedInputStream: public InputStream { - // An input stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An input stream that actually reads from some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedInputStream() noexcept(false); - - ArrayPtr getReadBuffer(); - // Get a direct pointer into the read buffer, which contains the next bytes in the input. If the - // caller consumes any bytes, it should then call skip() to indicate this. This always returns a - // non-empty buffer or throws an exception. Implemented in terms of tryGetReadBuffer(). - - virtual ArrayPtr tryGetReadBuffer() = 0; - // Like getReadBuffer() but may return an empty buffer on EOF. -}; - -class BufferedOutputStream: public OutputStream { - // An output stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An output stream that actually writes into some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedOutputStream() noexcept(false); - - virtual ArrayPtr getWriteBuffer() = 0; - // Get a direct pointer into the write buffer. The caller may choose to fill in some prefix of - // this buffer and then pass it to write(), in which case write() may avoid a copy. It is - // incorrect to pass to write any slice of this buffer which is not a prefix. -}; - -// ======================================================================================= -// Buffered streams implemented as wrappers around regular streams - -class BufferedInputStreamWrapper: public BufferedInputStream { - // Implements BufferedInputStream in terms of an InputStream. - // - // Note that the underlying stream's position is unpredictable once the wrapper is destroyed, - // unless the entire stream was consumed. To read a predictable number of bytes in a buffered - // way without going over, you'd need this wrapper to wrap some other wrapper which itself - // implements an artificial EOF at the desired point. Such a stream should be trivial to write - // but is not provided by the library at this time. - -public: - explicit BufferedInputStreamWrapper(InputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. No guarantee is made about - // the position of the inner stream after a buffered wrapper has been created unless the entire - // input is read. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedInputStreamWrapper); - ~BufferedInputStreamWrapper() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - InputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - ArrayPtr bufferAvailable; -}; - -class BufferedOutputStreamWrapper: public BufferedOutputStream { - // Implements BufferedOutputStream in terms of an OutputStream. Note that writes to the - // underlying stream may be delayed until flush() is called or the wrapper is destroyed. - -public: - explicit BufferedOutputStreamWrapper(OutputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedOutputStreamWrapper); - ~BufferedOutputStreamWrapper() noexcept(false); - - void flush(); - // Force the wrapper to write any remaining bytes in its buffer to the inner stream. Note that - // this only flushes this object's buffer; this object has no idea how to flush any other buffers - // that may be present in the underlying stream. - - // implements BufferedOutputStream --------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - OutputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - byte* bufferPos; - UnwindDetector unwindDetector; -}; - -// ======================================================================================= -// Array I/O - -class ArrayInputStream: public BufferedInputStream { -public: - explicit ArrayInputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayInputStream); - ~ArrayInputStream() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - ArrayPtr array; -}; - -class ArrayOutputStream: public BufferedOutputStream { -public: - explicit ArrayOutputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayOutputStream); - ~ArrayOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(array.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - ArrayPtr array; - byte* fillPos; -}; - -class VectorOutputStream: public BufferedOutputStream { -public: - explicit VectorOutputStream(size_t initialCapacity = 4096); - KJ_DISALLOW_COPY(VectorOutputStream); - ~VectorOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(vector.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - Array vector; - byte* fillPos; - - void grow(size_t minSize); -}; - -// ======================================================================================= -// File descriptor I/O - -class AutoCloseFd { - // A wrapper around a file descriptor which automatically closes the descriptor when destroyed. - // The wrapper supports move construction for transferring ownership of the descriptor. If - // close() returns an error, the destructor throws an exception, UNLESS the destructor is being - // called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseFd. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseFd(): fd(-1) {} - inline AutoCloseFd(decltype(nullptr)): fd(-1) {} - inline explicit AutoCloseFd(int fd): fd(fd) {} - inline AutoCloseFd(AutoCloseFd&& other) noexcept: fd(other.fd) { other.fd = -1; } - KJ_DISALLOW_COPY(AutoCloseFd); - ~AutoCloseFd() noexcept(false); - - inline AutoCloseFd& operator=(AutoCloseFd&& other) { - AutoCloseFd old(kj::mv(*this)); - fd = other.fd; - other.fd = -1; - return *this; - } - - inline AutoCloseFd& operator=(decltype(nullptr)) { - AutoCloseFd old(kj::mv(*this)); - return *this; - } - - inline operator int() const { return fd; } - inline int get() const { return fd; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the int conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return fd < 0; } - inline bool operator!=(decltype(nullptr)) { return fd >= 0; } - -private: - int fd; - UnwindDetector unwindDetector; -}; - -inline auto KJ_STRINGIFY(const AutoCloseFd& fd) - -> decltype(kj::toCharSequence(implicitCast(fd))) { - return kj::toCharSequence(implicitCast(fd)); -} - -class FdInputStream: public InputStream { - // An InputStream wrapping a file descriptor. - -public: - explicit FdInputStream(int fd): fd(fd) {} - explicit FdInputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdInputStream); - ~FdInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -class FdOutputStream: public OutputStream { - // An OutputStream wrapping a file descriptor. - -public: - explicit FdOutputStream(int fd): fd(fd) {} - explicit FdOutputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdOutputStream); - ~FdOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - void write(ArrayPtr> pieces) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -// ======================================================================================= -// Win32 Handle I/O - -#ifdef _WIN32 - -class AutoCloseHandle { - // A wrapper around a Win32 HANDLE which automatically closes the handle when destroyed. - // The wrapper supports move construction for transferring ownership of the handle. If - // CloseHandle() returns an error, the destructor throws an exception, UNLESS the destructor is - // being called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseHandle. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseHandle(): handle((void*)-1) {} - inline AutoCloseHandle(decltype(nullptr)): handle((void*)-1) {} - inline explicit AutoCloseHandle(void* handle): handle(handle) {} - inline AutoCloseHandle(AutoCloseHandle&& other) noexcept: handle(other.handle) { - other.handle = (void*)-1; - } - KJ_DISALLOW_COPY(AutoCloseHandle); - ~AutoCloseHandle() noexcept(false); - - inline AutoCloseHandle& operator=(AutoCloseHandle&& other) { - AutoCloseHandle old(kj::mv(*this)); - handle = other.handle; - other.handle = (void*)-1; - return *this; - } - - inline AutoCloseHandle& operator=(decltype(nullptr)) { - AutoCloseHandle old(kj::mv(*this)); - return *this; - } - - inline operator void*() const { return handle; } - inline void* get() const { return handle; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the void* conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return handle != (void*)-1; } - inline bool operator!=(decltype(nullptr)) { return handle == (void*)-1; } - -private: - void* handle; // -1 (aka INVALID_HANDLE_VALUE) if not valid. -}; - -class HandleInputStream: public InputStream { - // An InputStream wrapping a Win32 HANDLE. - -public: - explicit HandleInputStream(void* handle): handle(handle) {} - explicit HandleInputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleInputStream); - ~HandleInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -class HandleOutputStream: public OutputStream { - // An OutputStream wrapping a Win32 HANDLE. - -public: - explicit HandleOutputStream(void* handle): handle(handle) {} - explicit HandleOutputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleOutputStream); - ~HandleOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -#endif // _WIN32 - -} // namespace kj - -#endif // KJ_IO_H_ diff --git a/external/capnp/include/kj/main.h b/external/capnp/include/kj/main.h deleted file mode 100644 index 4dcd804fd4..0000000000 --- a/external/capnp/include/kj/main.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MAIN_H_ -#define KJ_MAIN_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" -#include "string.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class ProcessContext { - // Context for command-line programs. - -public: - virtual StringPtr getProgramName() = 0; - // Get argv[0] as passed to main(). - - KJ_NORETURN(virtual void exit()) = 0; - // Indicates program completion. The program is considered successful unless `error()` was - // called. Typically this exits with _Exit(), meaning that the stack is not unwound, buffers - // are not flushed, etc. -- it is the responsibility of the caller to flush any buffers that - // matter. However, an alternate context implementation e.g. for unit testing purposes could - // choose to throw an exception instead. - // - // At first this approach may sound crazy. Isn't it much better to shut down cleanly? What if - // you lose data? However, it turns out that if you look at each common class of program, _Exit() - // is almost always preferable. Let's break it down: - // - // * Commands: A typical program you might run from the command line is single-threaded and - // exits quickly and deterministically. Commands often use buffered I/O and need to flush - // those buffers before exit. However, most of the work performed by destructors is not - // flushing buffers, but rather freeing up memory, placing objects into freelists, and closing - // file descriptors. All of this is irrelevant if the process is about to exit anyway, and - // for a command that runs quickly, time wasted freeing heap space may make a real difference - // in the overall runtime of a script. Meanwhile, it is usually easy to determine exactly what - // resources need to be flushed before exit, and easy to tell if they are not being flushed - // (because the command fails to produce the expected output). Therefore, it is reasonably - // easy for commands to explicitly ensure all output is flushed before exiting, and it is - // probably a good idea for them to do so anyway, because write failures should be detected - // and handled. For commands, a good strategy is to allocate any objects that require clean - // destruction on the stack, and allow them to go out of scope before the command exits. - // Meanwhile, any resources which do not need to be cleaned up should be allocated as members - // of the command's main class, whose destructor normally will not be called. - // - // * Interactive apps: Programs that interact with the user (whether they be graphical apps - // with windows or console-based apps like emacs) generally exit only when the user asks them - // to. Such applications may store large data structures in memory which need to be synced - // to disk, such as documents or user preferences. However, relying on stack unwind or global - // destructors as the mechanism for ensuring such syncing occurs is probably wrong. First of - // all, it's 2013, and applications ought to be actively syncing changes to non-volatile - // storage the moment those changes are made. Applications can crash at any time and a crash - // should never lose data that is more than half a second old. Meanwhile, if a user actually - // does try to close an application while unsaved changes exist, the application UI should - // prompt the user to decide what to do. Such a UI mechanism is obviously too high level to - // be implemented via destructors, so KJ's use of _Exit() shouldn't make a difference here. - // - // * Servers: A good server is fault-tolerant, prepared for the possibility that at any time - // it could crash, the OS could decide to kill it off, or the machine it is running on could - // just die. So, using _Exit() should be no problem. In fact, servers generally never even - // call exit anyway; they are killed externally. - // - // * Batch jobs: A long-running batch job is something between a command and a server. It - // probably knows exactly what needs to be flushed before exiting, and it probably should be - // fault-tolerant. - // - // Meanwhile, regardless of program type, if you are adhering to KJ style, then the use of - // _Exit() shouldn't be a problem anyway: - // - // * KJ style forbids global mutable state (singletons) in general and global constructors and - // destructors in particular. Therefore, everything that could possibly need cleanup either - // lives on the stack or is transitively owned by something living on the stack. - // - // * Calling exit() simply means "Don't clean up anything older than this stack frame.". If you - // have resources that require cleanup before exit, make sure they are owned by stack frames - // beyond the one that eventually calls exit(). To be as safe as possible, don't place any - // state in your program's main class, and don't call exit() yourself. Then, runMainAndExit() - // will do it, and the only thing on the stack at that time will be your main class, which - // has no state anyway. - // - // TODO(someday): Perhaps we should use the new std::quick_exit(), so that at_quick_exit() is - // available for those who really think they need it. Unfortunately, it is not yet available - // on many platforms. - - virtual void warning(StringPtr message) = 0; - // Print the given message to standard error. A newline is printed after the message if it - // doesn't already have one. - - virtual void error(StringPtr message) = 0; - // Like `warning()`, but also sets a flag indicating that the process has failed, and that when - // it eventually exits it should indicate an error status. - - KJ_NORETURN(virtual void exitError(StringPtr message)) = 0; - // Equivalent to `error(message)` followed by `exit()`. - - KJ_NORETURN(virtual void exitInfo(StringPtr message)) = 0; - // Displays the given non-error message to the user and then calls `exit()`. This is used to - // implement things like --help. - - virtual void increaseLoggingVerbosity() = 0; - // Increase the level of detail produced by the debug logging system. `MainBuilder` invokes - // this if the caller uses the -v flag. - - // TODO(someday): Add interfaces representing standard OS resources like the filesystem, so that - // these things can be mocked out. -}; - -class TopLevelProcessContext final: public ProcessContext { - // A ProcessContext implementation appropriate for use at the actual entry point of a process - // (as opposed to when you are trying to call a program's main function from within some other - // program). This implementation writes errors to stderr, and its `exit()` method actually - // calls the C `quick_exit()` function. - -public: - explicit TopLevelProcessContext(StringPtr programName); - - struct CleanShutdownException { int exitCode; }; - // If the environment variable KJ_CLEAN_SHUTDOWN is set, then exit() will actually throw this - // exception rather than exiting. `kj::runMain()` catches this exception and returns normally. - // This is useful primarily for testing purposes, to assist tools like memory leak checkers that - // are easily confused by quick_exit(). - - StringPtr getProgramName() override; - KJ_NORETURN(void exit() override); - void warning(StringPtr message) override; - void error(StringPtr message) override; - KJ_NORETURN(void exitError(StringPtr message) override); - KJ_NORETURN(void exitInfo(StringPtr message) override); - void increaseLoggingVerbosity() override; - -private: - StringPtr programName; - bool cleanShutdown; - bool hadErrors = false; -}; - -typedef Function params)> MainFunc; - -int runMainAndExit(ProcessContext& context, MainFunc&& func, int argc, char* argv[]); -// Runs the given main function and then exits using the given context. If an exception is thrown, -// this will catch it, report it via the context and exit with an error code. -// -// Normally this function does not return, because returning would probably lead to wasting time -// on cleanup when the process is just going to exit anyway. However, to facilitate memory leak -// checkers and other tools that require a clean shutdown to do their job, if the environment -// variable KJ_CLEAN_SHUTDOWN is set, the function will in fact return an exit code, which should -// then be returned from main(). -// -// Most users will use the KJ_MAIN() macro rather than call this function directly. - -#define KJ_MAIN(MainClass) \ - int main(int argc, char* argv[]) { \ - ::kj::TopLevelProcessContext context(argv[0]); \ - MainClass mainObject(context); \ - return ::kj::runMainAndExit(context, mainObject.getMain(), argc, argv); \ - } -// Convenience macro for declaring a main function based on the given class. The class must have -// a constructor that accepts a ProcessContext& and a method getMain() which returns -// kj::MainFunc (probably building it using a MainBuilder). - -class MainBuilder { - // Builds a main() function with nice argument parsing. As options and arguments are parsed, - // corresponding callbacks are called, so that you never have to write a massive switch() - // statement to interpret arguments. Additionally, this approach encourages you to write - // main classes that have a reasonable API that can be used as an alternative to their - // command-line interface. - // - // All StringPtrs passed to MainBuilder must remain valid until option parsing completes. The - // assumption is that these strings will all be literals, making this an easy requirement. If - // not, consider allocating them in an Arena. - // - // Some flags are automatically recognized by the main functions built by this class: - // --help: Prints help text and exits. The help text is constructed based on the - // information you provide to the builder as you define each flag. - // --verbose: Increase logging verbosity. - // --version: Print version information and exit. - // - // Example usage: - // - // class FooMain { - // public: - // FooMain(kj::ProcessContext& context): context(context) {} - // - // bool setAll() { all = true; return true; } - // // Enable the --all flag. - // - // kj::MainBuilder::Validity setOutput(kj::StringPtr name) { - // // Set the output file. - // - // if (name.endsWith(".foo")) { - // outputFile = name; - // return true; - // } else { - // return "Output file must have extension .foo."; - // } - // } - // - // kj::MainBuilder::Validity processInput(kj::StringPtr name) { - // // Process an input file. - // - // if (!exists(name)) { - // return kj::str(name, ": file not found"); - // } - // // ... process the input file ... - // return true; - // } - // - // kj::MainFunc getMain() { - // return MainBuilder(context, "Foo Builder v1.5", "Reads s and builds a Foo.") - // .addOption({'a', "all"}, KJ_BIND_METHOD(*this, setAll), - // "Frob all the widgets. Otherwise, only some widgets are frobbed.") - // .addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to . Must be a .foo file.") - // .expectOneOrMoreArgs("", KJ_BIND_METHOD(*this, processInput)) - // .build(); - // } - // - // private: - // bool all = false; - // kj::StringPtr outputFile; - // kj::ProcessContext& context; - // }; - -public: - MainBuilder(ProcessContext& context, StringPtr version, - StringPtr briefDescription, StringPtr extendedDescription = nullptr); - ~MainBuilder() noexcept(false); - - class OptionName { - public: - OptionName() = default; - inline OptionName(char shortName): isLong(false), shortName(shortName) {} - inline OptionName(const char* longName): isLong(true), longName(longName) {} - - private: - bool isLong; - union { - char shortName; - const char* longName; - }; - friend class MainBuilder; - }; - - class Validity { - public: - inline Validity(bool valid) { - if (!valid) errorMessage = heapString("invalid argument"); - } - inline Validity(const char* errorMessage) - : errorMessage(heapString(errorMessage)) {} - inline Validity(String&& errorMessage) - : errorMessage(kj::mv(errorMessage)) {} - - inline const Maybe& getError() const { return errorMessage; } - inline Maybe releaseError() { return kj::mv(errorMessage); } - - private: - Maybe errorMessage; - friend class MainBuilder; - }; - - MainBuilder& addOption(std::initializer_list names, Function callback, - StringPtr helpText); - // Defines a new option (flag). `names` is a list of characters and strings that can be used to - // specify the option on the command line. Single-character names are used with "-" while string - // names are used with "--". `helpText` is a natural-language description of the flag. - // - // `callback` is called when the option is seen. Its return value indicates whether the option - // was accepted. If not, further option processing stops, and error is written, and the process - // exits. - // - // Example: - // - // builder.addOption({'a', "all"}, KJ_BIND_METHOD(*this, showAll), "Show all files."); - // - // This option could be specified in the following ways: - // - // -a - // --all - // - // Note that single-character option names can be combined into a single argument. For example, - // `-abcd` is equivalent to `-a -b -c -d`. - // - // The help text for this option would look like: - // - // -a, --all - // Show all files. - // - // Note that help text is automatically word-wrapped. - - MainBuilder& addOptionWithArg(std::initializer_list names, - Function callback, - StringPtr argumentTitle, StringPtr helpText); - // Like `addOption()`, but adds an option which accepts an argument. `argumentTitle` is used in - // the help text. The argument text is passed to the callback. - // - // Example: - // - // builder.addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to ."); - // - // This option could be specified with an argument of "foo" in the following ways: - // - // -ofoo - // -o foo - // --output=foo - // --output foo - // - // Note that single-character option names can be combined, but only the last option can have an - // argument, since the characters after the option letter are interpreted as the argument. E.g. - // `-abofoo` would be equivalent to `-a -b -o foo`. - // - // The help text for this option would look like: - // - // -o FILENAME, --output=FILENAME - // Output to FILENAME. - - MainBuilder& addSubCommand(StringPtr name, Function getSubParser, - StringPtr briefHelpText); - // If exactly the given name is seen as an argument, invoke getSubParser() and then pass all - // remaining arguments to the parser it returns. This is useful for implementing commands which - // have lots of sub-commands, like "git" (which has sub-commands "checkout", "branch", "pull", - // etc.). - // - // `getSubParser` is only called if the command is seen. This avoids building main functions - // for commands that aren't used. - // - // `briefHelpText` should be brief enough to show immediately after the command name on a single - // line. It will not be wrapped. Users can use the built-in "help" command to get extended - // help on a particular command. - - MainBuilder& expectArg(StringPtr title, Function callback); - MainBuilder& expectOptionalArg(StringPtr title, Function callback); - MainBuilder& expectZeroOrMoreArgs(StringPtr title, Function callback); - MainBuilder& expectOneOrMoreArgs(StringPtr title, Function callback); - // Set callbacks to handle arguments. `expectArg()` and `expectOptionalArg()` specify positional - // arguments with special handling, while `expect{Zero,One}OrMoreArgs()` specifies a handler for - // an argument list (the handler is called once for each argument in the list). `title` - // specifies how the argument should be represented in the usage text. - // - // All options callbacks are called before argument callbacks, regardless of their ordering on - // the command line. This matches GNU getopt's behavior of permuting non-flag arguments to the - // end of the argument list. Also matching getopt, the special option "--" indicates that the - // rest of the command line is all arguments, not options, even if they start with '-'. - // - // The interpretation of positional arguments is fairly flexible. The non-optional arguments can - // be expected at the beginning, end, or in the middle. If more arguments are specified than - // the number of non-optional args, they are assigned to the optional argument handlers in the - // order of registration. - // - // For example, say you called: - // builder.expectArg("", ...); - // builder.expectOptionalArg("", ...); - // builder.expectArg("", ...); - // builder.expectZeroOrMoreArgs("", ...); - // builder.expectArg("", ...); - // - // This command requires at least three arguments: foo, baz, and corge. If four arguments are - // given, the second is assigned to bar. If five or more arguments are specified, then the - // arguments between the third and last are assigned to qux. Note that it never makes sense - // to call `expect*OrMoreArgs()` more than once since only the first call would ever be used. - // - // In practice, you probably shouldn't create such complicated commands as in the above example. - // But, this flexibility seems necessary to support commands where the first argument is special - // as well as commands (like `cp`) where the last argument is special. - - MainBuilder& callAfterParsing(Function callback); - // Call the given function after all arguments have been parsed. - - MainFunc build(); - // Build the "main" function, which simply parses the arguments. Once this returns, the - // `MainBuilder` is no longer valid. - -private: - struct Impl; - Own impl; - - class MainImpl; -}; - -} // namespace kj - -#endif // KJ_MAIN_H_ diff --git a/external/capnp/include/kj/memory.h b/external/capnp/include/kj/memory.h deleted file mode 100644 index 60912b0a34..0000000000 --- a/external/capnp/include/kj/memory.h +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MEMORY_H_ -#define KJ_MEMORY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -// ======================================================================================= -// Disposer -- Implementation details. - -class Disposer { - // Abstract interface for a thing that "disposes" of objects, where "disposing" usually means - // calling the destructor followed by freeing the underlying memory. `Own` encapsulates an - // object pointer with corresponding Disposer. - // - // Few developers will ever touch this interface. It is primarily useful for those implementing - // custom memory allocators. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for each HeapDisposer - // instance. Eww! - - virtual void disposeImpl(void* pointer) const = 0; - // Disposes of the object, given a pointer to the beginning of the object. If the object is - // polymorphic, this pointer is determined by dynamic_cast(). For non-polymorphic types, - // Own does not allow any casting, so the pointer exactly matches the original one given to - // Own. - -public: - - template - void dispose(T* object) const; - // Helper wrapper around disposeImpl(). - // - // If T is polymorphic, calls `disposeImpl(dynamic_cast(object))`, otherwise calls - // `disposeImpl(implicitCast(object))`. - // - // Callers must not call dispose() on the same pointer twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -template -class DestructorOnlyDisposer: public Disposer { - // A disposer that merely calls the type's destructor and nothing else. - -public: - static const DestructorOnlyDisposer instance; - - void disposeImpl(void* pointer) const override { - reinterpret_cast(pointer)->~T(); - } -}; - -template -const DestructorOnlyDisposer DestructorOnlyDisposer::instance = DestructorOnlyDisposer(); - -class NullDisposer: public Disposer { - // A disposer that does nothing. - -public: - static const NullDisposer instance; - - void disposeImpl(void* pointer) const override {} -}; - -// ======================================================================================= -// Own -- An owned pointer. - -template -class Own { - // A transferrable title to a T. When an Own goes out of scope, the object's Disposer is - // called to dispose of it. An Own can be efficiently passed by move, without relocating the - // underlying object; this transfers ownership. - // - // This is much like std::unique_ptr, except: - // - You cannot release(). An owned object is not necessarily allocated with new (see next - // point), so it would be hard to use release() correctly. - // - The deleter is made polymorphic by virtual call rather than by template. This is much - // more powerful -- it allows the use of custom allocators, freelists, etc. This could - // _almost_ be accomplished with unique_ptr by forcing everyone to use something like - // std::unique_ptr, except that things get hairy in the presence of multiple - // inheritance and upcasting, and anyway if you force everyone to use a custom deleter - // then you've lost any benefit to interoperating with the "standard" unique_ptr. - -public: - KJ_DISALLOW_COPY(Own); - inline Own(): disposer(nullptr), ptr(nullptr) {} - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - inline Own(Own>&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - template ()>> - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { - static_assert(__is_polymorphic(T), - "Casting owned pointers requires that the target type is polymorphic."); - other.ptr = nullptr; - } - inline Own(T* ptr, const Disposer& disposer) noexcept: disposer(&disposer), ptr(ptr) {} - - ~Own() noexcept(false) { dispose(); } - - inline Own& operator=(Own&& other) { - // Move-assingnment operator. - - // Careful, this might own `other`. Therefore we have to transfer the pointers first, then - // dispose. - const Disposer* disposerCopy = disposer; - T* ptrCopy = ptr; - disposer = other.disposer; - ptr = other.ptr; - other.ptr = nullptr; - if (ptrCopy != nullptr) { - disposerCopy->dispose(const_cast*>(ptrCopy)); - } - return *this; - } - - inline Own& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - Own downcast() { - // Downcast the pointer to Own, destroying the original pointer. If this pointer does not - // actually point at an instance of U, the results are undefined (throws an exception in debug - // mode if RTTI is enabled, otherwise you're on your own). - - Own result; - if (ptr != nullptr) { - result.ptr = &kj::downcast(*ptr); - result.disposer = disposer; - ptr = nullptr; - } - return result; - } - -#define NULLCHECK KJ_IREQUIRE(ptr != nullptr, "null Own<> dereference") - inline T* operator->() { NULLCHECK; return ptr; } - inline const T* operator->() const { NULLCHECK; return ptr; } - inline T& operator*() { NULLCHECK; return *ptr; } - inline const T& operator*() const { NULLCHECK; return *ptr; } -#undef NULLCHECK - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - const Disposer* disposer; // Only valid if ptr != nullptr. - T* ptr; - - inline explicit Own(decltype(nullptr)): disposer(nullptr), ptr(nullptr) {} - - inline bool operator==(decltype(nullptr)) { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) { return ptr != nullptr; } - // Only called by Maybe>. - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - if (ptrCopy != nullptr) { - ptr = nullptr; - disposer->dispose(const_cast*>(ptrCopy)); - } - } - - template - friend class Own; - friend class Maybe>; -}; - -namespace _ { // private - -template -class OwnOwn { -public: - inline OwnOwn(Own&& value) noexcept: value(kj::mv(value)) {} - - inline Own& operator*() & { return value; } - inline const Own& operator*() const & { return value; } - inline Own&& operator*() && { return kj::mv(value); } - inline const Own&& operator*() const && { return kj::mv(value); } - inline Own* operator->() { return &value; } - inline const Own* operator->() const { return &value; } - inline operator Own*() { return value ? &value : nullptr; } - inline operator const Own*() const { return value ? &value : nullptr; } - -private: - Own value; -}; - -template -OwnOwn readMaybe(Maybe>&& maybe) { return OwnOwn(kj::mv(maybe.ptr)); } -template -Own* readMaybe(Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } -template -const Own* readMaybe(const Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } - -} // namespace _ (private) - -template -class Maybe> { -public: - inline Maybe(): ptr(nullptr) {} - inline Maybe(Own&& t) noexcept: ptr(kj::mv(t)) {} - inline Maybe(Maybe&& other) noexcept: ptr(kj::mv(other.ptr)) {} - - template - inline Maybe(Maybe>&& other): ptr(mv(other.ptr)) {} - template - inline Maybe(Own&& other): ptr(mv(other)) {} - - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline operator Maybe() { return ptr.get(); } - inline operator Maybe() const { return ptr.get(); } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - Own& orDefault(Own& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - const Own& orDefault(const Own& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - - template - auto map(Func&& f) & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - -private: - Own ptr; - - template - friend class Maybe; - template - friend _::OwnOwn _::readMaybe(Maybe>&& maybe); - template - friend Own* _::readMaybe(Maybe>& maybe); - template - friend const Own* _::readMaybe(const Maybe>& maybe); -}; - -namespace _ { // private - -template -class HeapDisposer final: public Disposer { -public: - virtual void disposeImpl(void* pointer) const override { delete reinterpret_cast(pointer); } - - static const HeapDisposer instance; -}; - -template -const HeapDisposer HeapDisposer::instance = HeapDisposer(); - -} // namespace _ (private) - -template -Own heap(Params&&... params) { - // heap(...) allocates a T on the heap, forwarding the parameters to its constructor. The - // exact heap implementation is unspecified -- for now it is operator new, but you should not - // assume this. (Since we know the object size at delete time, we could actually implement an - // allocator that is more efficient than operator new.) - - return Own(new T(kj::fwd(params)...), _::HeapDisposer::instance); -} - -template -Own> heap(T&& orig) { - // Allocate a copy (or move) of the argument on the heap. - // - // The purpose of this overload is to allow you to omit the template parameter as there is only - // one argument and the purpose is to copy it. - - typedef Decay T2; - return Own(new T2(kj::fwd(orig)), _::HeapDisposer::instance); -} - -// ======================================================================================= -// SpaceFor -- assists in manual allocation - -template -class SpaceFor { - // A class which has the same size and alignment as T but does not call its constructor or - // destructor automatically. Instead, call construct() to construct a T in the space, which - // returns an Own which will take care of calling T's destructor later. - -public: - inline SpaceFor() {} - inline ~SpaceFor() {} - - template - Own construct(Params&&... params) { - ctor(value, kj::fwd(params)...); - return Own(&value, DestructorOnlyDisposer::instance); - } - -private: - union { - T value; - }; -}; - -// ======================================================================================= -// Inline implementation details - -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - // Note that dynamic_cast does not require RTTI to be enabled, because the offset to - // the top of the object is in the vtable -- as it obviously needs to be to correctly implement - // operator delete. - disposer.disposeImpl(dynamic_cast(object)); - } -}; -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - disposer.disposeImpl(static_cast(object)); - } -}; - -template -void Disposer::dispose(T* object) const { - Dispose_::dispose(object, *this); -} - -} // namespace kj - -#endif // KJ_MEMORY_H_ diff --git a/external/capnp/include/kj/mutex.h b/external/capnp/include/kj/mutex.h deleted file mode 100644 index d211ebfeb1..0000000000 --- a/external/capnp/include/kj/mutex.h +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MUTEX_H_ -#define KJ_MUTEX_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include - -#if __linux__ && !defined(KJ_USE_FUTEX) -#define KJ_USE_FUTEX 1 -#endif - -#if !KJ_USE_FUTEX && !_WIN32 -// On Linux we use futex. On other platforms we wrap pthreads. -// TODO(someday): Write efficient low-level locking primitives for other platforms. -#include -#endif - -namespace kj { - -// ======================================================================================= -// Private details -- public interfaces follow below. - -namespace _ { // private - -class Mutex { - // Internal implementation details. See `MutexGuarded`. - -public: - Mutex(); - ~Mutex(); - KJ_DISALLOW_COPY(Mutex); - - enum Exclusivity { - EXCLUSIVE, - SHARED - }; - - void lock(Exclusivity exclusivity); - void unlock(Exclusivity exclusivity); - - void assertLockedByCaller(Exclusivity exclusivity); - // In debug mode, assert that the mutex is locked by the calling thread, or if that is - // non-trivial, assert that the mutex is locked (which should be good enough to catch problems - // in unit tests). In non-debug builds, do nothing. - -private: -#if KJ_USE_FUTEX - uint futex; - // bit 31 (msb) = set if exclusive lock held - // bit 30 (msb) = set if threads are waiting for exclusive lock - // bits 0-29 = count of readers; If an exclusive lock is held, this is the count of threads - // waiting for a read lock, otherwise it is the count of threads that currently hold a read - // lock. - - static constexpr uint EXCLUSIVE_HELD = 1u << 31; - static constexpr uint EXCLUSIVE_REQUESTED = 1u << 30; - static constexpr uint SHARED_COUNT_MASK = EXCLUSIVE_REQUESTED - 1; - -#elif _WIN32 - uintptr_t srwLock; // Actually an SRWLOCK, but don't want to #include in header. - -#else - mutable pthread_rwlock_t mutex; -#endif -}; - -class Once { - // Internal implementation details. See `Lazy`. - -public: -#if KJ_USE_FUTEX - inline Once(bool startInitialized = false) - : futex(startInitialized ? INITIALIZED : UNINITIALIZED) {} -#else - Once(bool startInitialized = false); - ~Once(); -#endif - KJ_DISALLOW_COPY(Once); - - class Initializer { - public: - virtual void run() = 0; - }; - - void runOnce(Initializer& init); - -#if _WIN32 // TODO(perf): Can we make this inline on win32 somehow? - bool isInitialized() noexcept; - -#else - inline bool isInitialized() noexcept { - // Fast path check to see if runOnce() would simply return immediately. -#if KJ_USE_FUTEX - return __atomic_load_n(&futex, __ATOMIC_ACQUIRE) == INITIALIZED; -#else - return __atomic_load_n(&state, __ATOMIC_ACQUIRE) == INITIALIZED; -#endif - } -#endif - - void reset(); - // Returns the state from initialized to uninitialized. It is an error to call this when - // not already initialized, or when runOnce() or isInitialized() might be called concurrently in - // another thread. - -private: -#if KJ_USE_FUTEX - uint futex; - - enum State { - UNINITIALIZED, - INITIALIZING, - INITIALIZING_WITH_WAITERS, - INITIALIZED - }; - -#elif _WIN32 - uintptr_t initOnce; // Actually an INIT_ONCE, but don't want to #include in header. - -#else - enum State { - UNINITIALIZED, - INITIALIZED - }; - State state; - pthread_mutex_t mutex; -#endif -}; - -} // namespace _ (private) - -// ======================================================================================= -// Public interface - -template -class Locked { - // Return type for `MutexGuarded::lock()`. `Locked` provides access to the bounded object - // and unlocks the mutex when it goes out of scope. - -public: - KJ_DISALLOW_COPY(Locked); - inline Locked(): mutex(nullptr), ptr(nullptr) {} - inline Locked(Locked&& other): mutex(other.mutex), ptr(other.ptr) { - other.mutex = nullptr; - other.ptr = nullptr; - } - inline ~Locked() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - } - - inline Locked& operator=(Locked&& other) { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = other.mutex; - ptr = other.ptr; - other.mutex = nullptr; - other.ptr = nullptr; - return *this; - } - - inline void release() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = nullptr; - ptr = nullptr; - } - - inline T* operator->() { return ptr; } - inline const T* operator->() const { return ptr; } - inline T& operator*() { return *ptr; } - inline const T& operator*() const { return *ptr; } - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - _::Mutex* mutex; - T* ptr; - - inline Locked(_::Mutex& mutex, T& value): mutex(&mutex), ptr(&value) {} - - template - friend class MutexGuarded; -}; - -template -class MutexGuarded { - // An object of type T, bounded by a mutex. In order to access the object, you must lock it. - // - // Write locks are not "recursive" -- trying to lock again in a thread that already holds a lock - // will deadlock. Recursive write locks are usually a sign of bad design. - // - // Unfortunately, **READ LOCKS ARE NOT RECURSIVE** either. Common sense says they should be. - // But on many operating systems (BSD, OSX), recursively read-locking a pthread_rwlock is - // actually unsafe. The problem is that writers are "prioritized" over readers, so a read lock - // request will block if any write lock requests are outstanding. So, if thread A takes a read - // lock, thread B requests a write lock (and starts waiting), and then thread A tries to take - // another read lock recursively, the result is deadlock. - -public: - template - explicit MutexGuarded(Params&&... params); - // Initialize the mutex-bounded object by passing the given parameters to its constructor. - - Locked lockExclusive() const; - // Exclusively locks the object and returns it. The returned `Locked` can be passed by - // move, similar to `Own`. - // - // This method is declared `const` in accordance with KJ style rules which say that constness - // should be used to indicate thread-safety. It is safe to share a const pointer between threads, - // but it is not safe to share a mutable pointer. Since the whole point of MutexGuarded is to - // be shared between threads, its methods should be const, even though locking it produces a - // non-const pointer to the contained object. - - Locked lockShared() const; - // Lock the value for shared access. Multiple shared locks can be taken concurrently, but cannot - // be held at the same time as a non-shared lock. - - inline const T& getWithoutLock() const { return value; } - inline T& getWithoutLock() { return value; } - // Escape hatch for cases where some external factor guarantees that it's safe to get the - // value. You should treat these like const_cast -- be highly suspicious of any use. - - inline const T& getAlreadyLockedShared() const; - inline T& getAlreadyLockedShared(); - inline T& getAlreadyLockedExclusive() const; - // Like `getWithoutLock()`, but asserts that the lock is already held by the calling thread. - -private: - mutable _::Mutex mutex; - mutable T value; -}; - -template -class MutexGuarded { - // MutexGuarded cannot guard a const type. This would be pointless anyway, and would complicate - // the implementation of Locked, which uses constness to decide what kind of lock it holds. - static_assert(sizeof(T) < 0, "MutexGuarded's type cannot be const."); -}; - -template -class Lazy { - // A lazily-initialized value. - -public: - template - T& get(Func&& init); - template - const T& get(Func&& init) const; - // The first thread to call get() will invoke the given init function to construct the value. - // Other threads will block until construction completes, then return the same value. - // - // `init` is a functor(typically a lambda) which takes `SpaceFor&` as its parameter and returns - // `Own`. If `init` throws an exception, the exception is propagated out of that thread's - // call to `get()`, and subsequent calls behave as if `get()` hadn't been called at all yet -- - // in other words, subsequent calls retry initialization until it succeeds. - -private: - mutable _::Once once; - mutable SpaceFor space; - mutable Own value; - - template - class InitImpl; -}; - -// ======================================================================================= -// Inline implementation details - -template -template -inline MutexGuarded::MutexGuarded(Params&&... params) - : value(kj::fwd(params)...) {} - -template -inline Locked MutexGuarded::lockExclusive() const { - mutex.lock(_::Mutex::EXCLUSIVE); - return Locked(mutex, value); -} - -template -inline Locked MutexGuarded::lockShared() const { - mutex.lock(_::Mutex::SHARED); - return Locked(mutex, value); -} - -template -inline const T& MutexGuarded::getAlreadyLockedShared() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedShared() { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedExclusive() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::EXCLUSIVE); -#endif - return const_cast(value); -} - -template -template -class Lazy::InitImpl: public _::Once::Initializer { -public: - inline InitImpl(const Lazy& lazy, Func&& func): lazy(lazy), func(kj::fwd(func)) {} - - void run() override { - lazy.value = func(lazy.space); - } - -private: - const Lazy& lazy; - Func func; -}; - -template -template -inline T& Lazy::get(Func&& init) { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -template -template -inline const T& Lazy::get(Func&& init) const { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -} // namespace kj - -#endif // KJ_MUTEX_H_ diff --git a/external/capnp/include/kj/one-of.h b/external/capnp/include/kj/one-of.h deleted file mode 100644 index 6e143c44cf..0000000000 --- a/external/capnp/include/kj/one-of.h +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ONE_OF_H_ -#define KJ_ONE_OF_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -namespace _ { // private - -template -struct TypeIndex_ { static constexpr uint value = TypeIndex_::value; }; -template -struct TypeIndex_ { static constexpr uint value = i; }; - -} // namespace _ (private) - -template -class OneOf { - template - static inline constexpr uint typeIndex() { return _::TypeIndex_<1, Key, Variants...>::value; } - // Get the 1-based index of Key within the type list Types. - -public: - inline OneOf(): tag(0) {} - OneOf(const OneOf& other) { copyFrom(other); } - OneOf(OneOf&& other) { moveFrom(other); } - ~OneOf() { destroy(); } - - OneOf& operator=(const OneOf& other) { if (tag != 0) destroy(); copyFrom(other); return *this; } - OneOf& operator=(OneOf&& other) { if (tag != 0) destroy(); moveFrom(other); return *this; } - - inline bool operator==(decltype(nullptr)) const { return tag == 0; } - inline bool operator!=(decltype(nullptr)) const { return tag != 0; } - - template - bool is() const { - return tag == typeIndex(); - } - - template - T& get() { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - template - const T& get() const { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - - template - T& init(Params&&... params) { - if (tag != 0) destroy(); - ctor(*reinterpret_cast(space), kj::fwd(params)...); - tag = typeIndex(); - return *reinterpret_cast(space); - } - -private: - uint tag; - - static inline constexpr size_t maxSize(size_t a) { - return a; - } - template - static inline constexpr size_t maxSize(size_t a, size_t b, Rest... rest) { - return maxSize(kj::max(a, b), rest...); - } - // Returns the maximum of all the parameters. - // TODO(someday): Generalize the above template and make it common. I tried, but C++ decided to - // be difficult so I cut my losses. - - static constexpr auto spaceSize = maxSize(sizeof(Variants)...); - // TODO(msvc): This constant could just as well go directly inside space's bracket's, where it's - // used, but MSVC suffers a parse error on `...`. - - union { - byte space[spaceSize]; - - void* forceAligned; - // TODO(someday): Use C++11 alignas() once we require GCC 4.8 / Clang 3.3. - }; - - template - inline void doAll(T... t) {} - - template - inline bool destroyVariant() { - if (tag == typeIndex()) { - tag = 0; - dtor(*reinterpret_cast(space)); - } - return false; - } - void destroy() { - doAll(destroyVariant()...); - } - - template - inline bool copyVariantFrom(const OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), other.get()); - } - return false; - } - void copyFrom(const OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(copyVariantFrom(other)...); - } - - template - inline bool moveVariantFrom(OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), kj::mv(other.get())); - } - return false; - } - void moveFrom(OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(moveVariantFrom(other)...); - } -}; - -} // namespace kj - -#endif // KJ_ONE_OF_H_ diff --git a/external/capnp/include/kj/parse/char.h b/external/capnp/include/kj/parse/char.h deleted file mode 100644 index 2e6d51921d..0000000000 --- a/external/capnp/include/kj/parse/char.h +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains parsers useful for character stream inputs, including parsers to parse -// common kinds of tokens like identifiers, numbers, and quoted strings. - -#ifndef KJ_PARSE_CHAR_H_ -#define KJ_PARSE_CHAR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "../string.h" -#include - -namespace kj { -namespace parse { - -// ======================================================================================= -// Exact char/string. - -class ExactString_ { -public: - constexpr inline ExactString_(const char* str): str(str) {} - - template - Maybe> operator()(Input& input) const { - const char* ptr = str; - - while (*ptr != '\0') { - if (input.atEnd() || input.current() != *ptr) return nullptr; - input.next(); - ++ptr; - } - - return Tuple<>(); - } - -private: - const char* str; -}; - -constexpr inline ExactString_ exactString(const char* str) { - return ExactString_(str); -} - -template -constexpr ExactlyConst_ exactChar() { - // Returns a parser that matches exactly the character given by the template argument (returning - // no result). - return ExactlyConst_(); -} - -// ======================================================================================= -// Char ranges / sets - -class CharGroup_ { -public: - constexpr inline CharGroup_(): bits{0, 0, 0, 0} {} - - constexpr inline CharGroup_ orRange(unsigned char first, unsigned char last) const { - return CharGroup_(bits[0] | (oneBits(last + 1) & ~oneBits(first )), - bits[1] | (oneBits(last - 63) & ~oneBits(first - 64)), - bits[2] | (oneBits(last - 127) & ~oneBits(first - 128)), - bits[3] | (oneBits(last - 191) & ~oneBits(first - 192))); - } - - constexpr inline CharGroup_ orAny(const char* chars) const { - return *chars == 0 ? *this : orChar(*chars).orAny(chars + 1); - } - - constexpr inline CharGroup_ orChar(unsigned char c) const { - return CharGroup_(bits[0] | bit(c), - bits[1] | bit(c - 64), - bits[2] | bit(c - 128), - bits[3] | bit(c - 256)); - } - - constexpr inline CharGroup_ orGroup(CharGroup_ other) const { - return CharGroup_(bits[0] | other.bits[0], - bits[1] | other.bits[1], - bits[2] | other.bits[2], - bits[3] | other.bits[3]); - } - - constexpr inline CharGroup_ invert() const { - return CharGroup_(~bits[0], ~bits[1], ~bits[2], ~bits[3]); - } - - constexpr inline bool contains(unsigned char c) const { - return (bits[c / 64] & (1ll << (c % 64))) != 0; - } - - template - Maybe operator()(Input& input) const { - if (input.atEnd()) return nullptr; - unsigned char c = input.current(); - if (contains(c)) { - input.next(); - return c; - } else { - return nullptr; - } - } - -private: - typedef unsigned long long Bits64; - - constexpr inline CharGroup_(Bits64 a, Bits64 b, Bits64 c, Bits64 d): bits{a, b, c, d} {} - Bits64 bits[4]; - - static constexpr inline Bits64 oneBits(int count) { - return count <= 0 ? 0ll : count >= 64 ? -1ll : ((1ll << count) - 1); - } - static constexpr inline Bits64 bit(int index) { - return index < 0 ? 0 : index >= 64 ? 0 : (1ll << index); - } -}; - -constexpr inline CharGroup_ charRange(char first, char last) { - // Create a parser which accepts any character in the range from `first` to `last`, inclusive. - // For example: `charRange('a', 'z')` matches all lower-case letters. The parser's result is the - // character matched. - // - // The returned object has methods which can be used to match more characters. The following - // produces a parser which accepts any letter as well as '_', '+', '-', and '.'. - // - // charRange('a', 'z').orRange('A', 'Z').orChar('_').orAny("+-.") - // - // You can also use `.invert()` to match the opposite set of characters. - - return CharGroup_().orRange(first, last); -} - -#if _MSC_VER -#define anyOfChars(chars) CharGroup_().orAny(chars) -// TODO(msvc): MSVC ICEs on the proper definition of `anyOfChars()`, which in turn prevents us from -// building the compiler or schema parser. We don't know why this happens, but Harris found that -// this horrible, horrible hack makes things work. This is awful, but it's better than nothing. -// Hopefully, MSVC will get fixed soon and we'll be able to remove this. -#else -constexpr inline CharGroup_ anyOfChars(const char* chars) { - // Returns a parser that accepts any of the characters in the given string (which should usually - // be a literal). The returned parser is of the same type as returned by `charRange()` -- see - // that function for more info. - - return CharGroup_().orAny(chars); -} -#endif - -// ======================================================================================= - -namespace _ { // private - -struct ArrayToString { - inline String operator()(const Array& arr) const { - return heapString(arr); - } -}; - -} // namespace _ (private) - -template -constexpr inline auto charsToString(SubParser&& subParser) - -> decltype(transform(kj::fwd(subParser), _::ArrayToString())) { - // Wraps a parser that returns Array such that it returns String instead. - return parse::transform(kj::fwd(subParser), _::ArrayToString()); -} - -// ======================================================================================= -// Basic character classes. - -constexpr auto alpha = charRange('a', 'z').orRange('A', 'Z'); -constexpr auto digit = charRange('0', '9'); -constexpr auto alphaNumeric = alpha.orGroup(digit); -constexpr auto nameStart = alpha.orChar('_'); -constexpr auto nameChar = alphaNumeric.orChar('_'); -constexpr auto hexDigit = charRange('0', '9').orRange('a', 'f').orRange('A', 'F'); -constexpr auto octDigit = charRange('0', '7'); -constexpr auto whitespaceChar = anyOfChars(" \f\n\r\t\v"); -constexpr auto controlChar = charRange(0, 0x1f).invert().orGroup(whitespaceChar).invert(); - -constexpr auto whitespace = many(anyOfChars(" \f\n\r\t\v")); - -constexpr auto discardWhitespace = discard(many(discard(anyOfChars(" \f\n\r\t\v")))); -// Like discard(whitespace) but avoids some memory allocation. - -// ======================================================================================= -// Identifiers - -namespace _ { // private - -struct IdentifierToString { - inline String operator()(char first, const Array& rest) const { - String result = heapString(rest.size() + 1); - result[0] = first; - memcpy(result.begin() + 1, rest.begin(), rest.size()); - return result; - } -}; - -} // namespace _ (private) - -constexpr auto identifier = transform(sequence(nameStart, many(nameChar)), _::IdentifierToString()); -// Parses an identifier (e.g. a C variable name). - -// ======================================================================================= -// Integers - -namespace _ { // private - -inline char parseDigit(char c) { - if (c < 'A') return c - '0'; - if (c < 'a') return c - 'A' + 10; - return c - 'a' + 10; -} - -template -struct ParseInteger { - inline uint64_t operator()(const Array& digits) const { - return operator()('0', digits); - } - uint64_t operator()(char first, const Array& digits) const { - uint64_t result = parseDigit(first); - for (char digit: digits) { - result = result * base + parseDigit(digit); - } - return result; - } -}; - - -} // namespace _ (private) - -constexpr auto integer = sequence( - oneOf( - transform(sequence(exactChar<'0'>(), exactChar<'x'>(), oneOrMore(hexDigit)), _::ParseInteger<16>()), - transform(sequence(exactChar<'0'>(), many(octDigit)), _::ParseInteger<8>()), - transform(sequence(charRange('1', '9'), many(digit)), _::ParseInteger<10>())), - notLookingAt(alpha.orAny("_."))); - -// ======================================================================================= -// Numbers (i.e. floats) - -namespace _ { // private - -struct ParseFloat { - double operator()(const Array& digits, - const Maybe>& fraction, - const Maybe, Array>>& exponent) const; -}; - -} // namespace _ (private) - -constexpr auto number = transform( - sequence( - oneOrMore(digit), - optional(sequence(exactChar<'.'>(), many(digit))), - optional(sequence(discard(anyOfChars("eE")), optional(anyOfChars("+-")), many(digit))), - notLookingAt(alpha.orAny("_."))), - _::ParseFloat()); - -// ======================================================================================= -// Quoted strings - -namespace _ { // private - -struct InterpretEscape { - char operator()(char c) const { - switch (c) { - case 'a': return '\a'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'n': return '\n'; - case 'r': return '\r'; - case 't': return '\t'; - case 'v': return '\v'; - default: return c; - } - } -}; - -struct ParseHexEscape { - inline char operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseHexByte { - inline byte operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseOctEscape { - inline char operator()(char first, Maybe second, Maybe third) const { - char result = first - '0'; - KJ_IF_MAYBE(digit1, second) { - result = (result << 3) | (*digit1 - '0'); - KJ_IF_MAYBE(digit2, third) { - result = (result << 3) | (*digit2 - '0'); - } - } - return result; - } -}; - -} // namespace _ (private) - -constexpr auto escapeSequence = - sequence(exactChar<'\\'>(), oneOf( - transform(anyOfChars("abfnrtv'\"\\\?"), _::InterpretEscape()), - transform(sequence(exactChar<'x'>(), hexDigit, hexDigit), _::ParseHexEscape()), - transform(sequence(octDigit, optional(octDigit), optional(octDigit)), - _::ParseOctEscape()))); -// A parser that parses a C-string-style escape sequence (starting with a backslash). Returns -// a char. - -constexpr auto doubleQuotedString = charsToString(sequence( - exactChar<'\"'>(), - many(oneOf(anyOfChars("\\\n\"").invert(), escapeSequence)), - exactChar<'\"'>())); -// Parses a C-style double-quoted string. - -constexpr auto singleQuotedString = charsToString(sequence( - exactChar<'\''>(), - many(oneOf(anyOfChars("\\\n\'").invert(), escapeSequence)), - exactChar<'\''>())); -// Parses a C-style single-quoted string. - -constexpr auto doubleQuotedHexBinary = sequence( - exactChar<'0'>(), exactChar<'x'>(), exactChar<'\"'>(), - oneOrMore(transform(sequence(discardWhitespace, hexDigit, hexDigit), _::ParseHexByte())), - discardWhitespace, - exactChar<'\"'>()); -// Parses a double-quoted hex binary literal. Returns Array. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_CHAR_H_ diff --git a/external/capnp/include/kj/parse/common.h b/external/capnp/include/kj/parse/common.h deleted file mode 100644 index 3af3a8760d..0000000000 --- a/external/capnp/include/kj/parse/common.h +++ /dev/null @@ -1,824 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Parser combinator framework! -// -// This file declares several functions which construct parsers, usually taking other parsers as -// input, thus making them parser combinators. -// -// A valid parser is any functor which takes a reference to an input cursor (defined below) as its -// input and returns a Maybe. The parser returns null on parse failure, or returns the parsed -// result on success. -// -// An "input cursor" is any type which implements the same interface as IteratorInput, below. Such -// a type acts as a pointer to the current input location. When a parser returns successfully, it -// will have updated the input cursor to point to the position just past the end of what was parsed. -// On failure, the cursor position is unspecified. - -#ifndef KJ_PARSE_COMMON_H_ -#define KJ_PARSE_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../common.h" -#include "../memory.h" -#include "../array.h" -#include "../tuple.h" -#include "../vector.h" -#if _MSC_VER -#include // result_of_t -#endif - -namespace kj { -namespace parse { - -template -class IteratorInput { - // A parser input implementation based on an iterator range. - -public: - IteratorInput(Iterator begin, Iterator end) - : parent(nullptr), pos(begin), end(end), best(begin) {} - explicit IteratorInput(IteratorInput& parent) - : parent(&parent), pos(parent.pos), end(parent.end), best(parent.pos) {} - ~IteratorInput() { - if (parent != nullptr) { - parent->best = kj::max(kj::max(pos, best), parent->best); - } - } - KJ_DISALLOW_COPY(IteratorInput); - - void advanceParent() { - parent->pos = pos; - } - void forgetParent() { - parent = nullptr; - } - - bool atEnd() { return pos == end; } - auto current() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos; - } - auto consume() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos++; - } - void next() { - KJ_IREQUIRE(!atEnd()); - ++pos; - } - - Iterator getBest() { return kj::max(pos, best); } - - Iterator getPosition() { return pos; } - -private: - IteratorInput* parent; - Iterator pos; - Iterator end; - Iterator best; // furthest we got with any sub-input -}; - -template struct OutputType_; -template struct OutputType_> { typedef T Type; }; -template -using OutputType = typename OutputType_< -#if _MSC_VER - std::result_of_t - // The instance() based version below results in: - // C2064: term does not evaluate to a function taking 1 arguments -#else - decltype(instance()(instance())) -#endif - >::Type; -// Synonym for the output type of a parser, given the parser type and the input type. - -// ======================================================================================= - -template -class ParserRef { - // Acts as a reference to some other parser, with simplified type. The referenced parser - // is polymorphic by virtual call rather than templates. For grammars of non-trivial size, - // it is important to inject refs into the grammar here and there to prevent the parser types - // from becoming ridiculous. Using too many of them can hurt performance, though. - -public: - ParserRef(): parser(nullptr), wrapper(nullptr) {} - ParserRef(const ParserRef&) = default; - ParserRef(ParserRef&&) = default; - ParserRef& operator=(const ParserRef& other) = default; - ParserRef& operator=(ParserRef&& other) = default; - - template - constexpr ParserRef(Other&& other) - : parser(&other), wrapper(&WrapperImplInstance>::instance) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - } - - template - inline ParserRef& operator=(Other&& other) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - parser = &other; - wrapper = &WrapperImplInstance>::instance; - return *this; - } - - KJ_ALWAYS_INLINE(Maybe operator()(Input& input) const) { - // Always inline in the hopes that this allows branch prediction to kick in so the virtual call - // doesn't hurt so much. - return wrapper->parse(parser, input); - } - -private: - struct Wrapper { - virtual Maybe parse(const void* parser, Input& input) const = 0; - }; - template - struct WrapperImpl: public Wrapper { - Maybe parse(const void* parser, Input& input) const override { - return (*reinterpret_cast(parser))(input); - } - }; - template - struct WrapperImplInstance { -#if _MSC_VER - // TODO(msvc): MSVC currently fails to initialize vtable pointers for constexpr values so - // we have to make this just const instead. - static const WrapperImpl instance; -#else - static constexpr WrapperImpl instance = WrapperImpl(); -#endif - }; - - const void* parser; - const Wrapper* wrapper; -}; - -template -template -#if _MSC_VER -const typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance = WrapperImpl(); -#else -constexpr typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance; -#endif - -template -constexpr ParserRef> ref(ParserImpl& impl) { - // Constructs a ParserRef. You must specify the input type explicitly, e.g. - // `ref(myParser)`. - - return ParserRef>(impl); -} - -// ------------------------------------------------------------------- -// any -// Output = one token - -class Any_ { -public: - template - Maybe().consume())>> operator()(Input& input) const { - if (input.atEnd()) { - return nullptr; - } else { - return input.consume(); - } - } -}; - -constexpr Any_ any = Any_(); -// A parser which matches any token and simply returns it. - -// ------------------------------------------------------------------- -// exactly() -// Output = Tuple<> - -template -class Exactly_ { -public: - explicit constexpr Exactly_(T&& expected): expected(expected) {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } - -private: - T expected; -}; - -template -constexpr Exactly_ exactly(T&& expected) { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. - - return Exactly_(kj::fwd(expected)); -} - -// ------------------------------------------------------------------- -// exactlyConst() -// Output = Tuple<> - -template -class ExactlyConst_ { -public: - explicit constexpr ExactlyConst_() {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } -}; - -template -constexpr ExactlyConst_ exactlyConst() { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. This parser is templated on the token value which may cause - // it to perform better -- or worse. Be sure to measure. - - return ExactlyConst_(); -} - -// ------------------------------------------------------------------- -// constResult() - -template -class ConstResult_ { -public: - explicit constexpr ConstResult_(SubParser&& subParser, Result&& result) - : subParser(kj::fwd(subParser)), result(kj::fwd(result)) {} - - template - Maybe operator()(Input& input) const { - if (subParser(input) == nullptr) { - return nullptr; - } else { - return result; - } - } - -private: - SubParser subParser; - Result result; -}; - -template -constexpr ConstResult_ constResult(SubParser&& subParser, Result&& result) { - // Constructs a parser which returns exactly `result` if `subParser` is successful. - return ConstResult_(kj::fwd(subParser), kj::fwd(result)); -} - -template -constexpr ConstResult_> discard(SubParser&& subParser) { - // Constructs a parser which wraps `subParser` but discards the result. - return constResult(kj::fwd(subParser), Tuple<>()); -} - -// ------------------------------------------------------------------- -// sequence() -// Output = Flattened Tuple of outputs of sub-parsers. - -template class Sequence_; - -template -class Sequence_ { -public: - template - explicit constexpr Sequence_(T&& firstSubParser, U&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - // TODO(msvc): The trailing return types on `operator()` and `parseNext()` expose at least two - // bugs in MSVC: - // - // 1. An ICE. - // 2. 'error C2672: 'operator __surrogate_func': no matching overloaded function found)', - // which crops up in numerous places when trying to build the capnp command line tools. - // - // The only workaround I found for both bugs is to omit the trailing return types and instead - // rely on C++14's return type deduction. - - template - auto operator()(Input& input) const -#ifndef _MSC_VER - -> Maybe>(), - instance>()...))> -#endif - { - return parseNext(input); - } - - template - auto parseNext(Input& input, InitialParams&&... initialParams) const -#ifndef _MSC_VER - -> Maybe(initialParams)..., - instance>(), - instance>()...))> -#endif - { - KJ_IF_MAYBE(firstResult, first(input)) { - return rest.parseNext(input, kj::fwd(initialParams)..., - kj::mv(*firstResult)); - } else { - // TODO(msvc): MSVC depends on return type deduction to compile this function, so we need to - // help it deduce the right type on this code path. - return Maybe(initialParams)..., - instance>(), - instance>()...))>{nullptr}; - } - } - -private: - FirstSubParser first; - Sequence_ rest; -}; - -template <> -class Sequence_<> { -public: - template - Maybe> operator()(Input& input) const { - return parseNext(input); - } - - template - auto parseNext(Input& input, Params&&... params) const -> - Maybe(params)...))> { - return tuple(kj::fwd(params)...); - } -}; - -template -constexpr Sequence_ sequence(SubParsers&&... subParsers) { - // Constructs a parser that executes each of the parameter parsers in sequence and returns a - // tuple of their results. - - return Sequence_(kj::fwd(subParsers)...); -} - -// ------------------------------------------------------------------- -// many() -// Output = Array of output of sub-parser, or just a uint count if the sub-parser returns Tuple<>. - -template -class Many_ { - template > - struct Impl; -public: - explicit constexpr Many_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)); - -private: - SubParser subParser; -}; - -template -template -struct Many_::Impl { - static Maybe> apply(const SubParser& subParser, Input& input) { - typedef Vector> Results; - Results results; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - results.add(kj::mv(*subResult)); - } else { - break; - } - } - - if (atLeastOne && results.empty()) { - return nullptr; - } - - return results.releaseAsArray(); - } -}; - -template -template -struct Many_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe apply(const SubParser& subParser, Input& input) { - uint count = 0; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - ++count; - } else { - break; - } - } - - if (atLeastOne && count == 0) { - return nullptr; - } - - return count; - } -}; - -template -template -auto Many_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)) { - return Impl>::apply(subParser, input); -} - -template -constexpr Many_ many(SubParser&& subParser) { - // Constructs a parser that repeatedly executes the given parser until it fails, returning an - // Array of the results (or a uint count if `subParser` returns an empty tuple). - return Many_(kj::fwd(subParser)); -} - -template -constexpr Many_ oneOrMore(SubParser&& subParser) { - // Like `many()` but the parser must parse at least one item to be successful. - return Many_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// times() -// Output = Array of output of sub-parser, or Tuple<> if sub-parser returns Tuple<>. - -template -class Times_ { - template > - struct Impl; -public: - explicit constexpr Times_(SubParser&& subParser, uint count) - : subParser(kj::fwd(subParser)), count(count) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)); - -private: - SubParser subParser; - uint count; -}; - -template -template -struct Times_::Impl { - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - auto results = heapArrayBuilder>(count); - - while (results.size() < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - results.add(kj::mv(*subResult)); - } else { - return nullptr; - } - } - - return results.finish(); - } -}; - -template -template -struct Times_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - uint actualCount = 0; - - while (actualCount < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - ++actualCount; - } else { - return nullptr; - } - } - - return tuple(); - } -}; - -template -template -auto Times_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)) { - return Impl>::apply(subParser, count, input); -} - -template -constexpr Times_ times(SubParser&& subParser, uint count) { - // Constructs a parser that repeats the subParser exactly `count` times. - return Times_(kj::fwd(subParser), count); -} - -// ------------------------------------------------------------------- -// optional() -// Output = Maybe - -template -class Optional_ { -public: - explicit constexpr Optional_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe>> operator()(Input& input) const { - typedef Maybe> Result; - - Input subInput(input); - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - return Result(kj::mv(*subResult)); - } else { - return Result(nullptr); - } - } - -private: - SubParser subParser; -}; - -template -constexpr Optional_ optional(SubParser&& subParser) { - // Constructs a parser that accepts zero or one of the given sub-parser, returning a Maybe - // of the sub-parser's result. - return Optional_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// oneOf() -// All SubParsers must have same output type, which becomes the output type of the -// OneOfParser. - -template -class OneOf_; - -template -class OneOf_ { -public: - explicit constexpr OneOf_(FirstSubParser&& firstSubParser, SubParsers&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - template - Maybe> operator()(Input& input) const { - { - Input subInput(input); - Maybe> firstResult = first(subInput); - - if (firstResult != nullptr) { - subInput.advanceParent(); - return kj::mv(firstResult); - } - } - - // Hoping for some tail recursion here... - return rest(input); - } - -private: - FirstSubParser first; - OneOf_ rest; -}; - -template <> -class OneOf_<> { -public: - template - decltype(nullptr) operator()(Input& input) const { - return nullptr; - } -}; - -template -constexpr OneOf_ oneOf(SubParsers&&... parsers) { - // Constructs a parser that accepts one of a set of options. The parser behaves as the first - // sub-parser in the list which returns successfully. All of the sub-parsers must return the - // same type. - return OneOf_(kj::fwd(parsers)...); -} - -// ------------------------------------------------------------------- -// transform() -// Output = Result of applying transform functor to input value. If input is a tuple, it is -// unpacked to form the transformation parameters. - -template -struct Span { -public: - inline const Position& begin() const { return begin_; } - inline const Position& end() const { return end_; } - - Span() = default; - inline constexpr Span(Position&& begin, Position&& end): begin_(mv(begin)), end_(mv(end)) {} - -private: - Position begin_; - Position end_; -}; - -template -constexpr Span> span(Position&& start, Position&& end) { - return Span>(kj::fwd(start), kj::fwd(end)); -} - -template -class Transform_ { -public: - explicit constexpr Transform_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance&&>()))> - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformOrReject_ { -public: - explicit constexpr TransformOrReject_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - decltype(kj::apply(instance(), instance&&>())) - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformWithLocation_ { -public: - explicit constexpr TransformWithLocation_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance().getPosition())>>>(), - instance&&>()))> - operator()(Input& input) const { - auto start = input.getPosition(); - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, Span(kj::mv(start), input.getPosition()), - kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -constexpr Transform_ transform( - SubParser&& subParser, TransformFunc&& functor) { - // Constructs a parser which executes some other parser and then transforms the result by invoking - // `functor` on it. Typically `functor` is a lambda. It is invoked using `kj::apply`, - // meaning tuples will be unpacked as arguments. - return Transform_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformOrReject_ transformOrReject( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform()` except that `functor` returns a `Maybe`. If it returns null, parsing fails, - // otherwise the parser's result is the content of the `Maybe`. - return TransformOrReject_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformWithLocation_ transformWithLocation( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform` except that `functor` also takes a `Span` as its first parameter specifying - // the location of the parsed content. The span's position type is whatever the parser input's - // getPosition() returns. - return TransformWithLocation_( - kj::fwd(subParser), kj::fwd(functor)); -} - -// ------------------------------------------------------------------- -// notLookingAt() -// Fails if the given parser succeeds at the current location. - -template -class NotLookingAt_ { -public: - explicit constexpr NotLookingAt_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe> operator()(Input& input) const { - Input subInput(input); - subInput.forgetParent(); - if (subParser(subInput) == nullptr) { - return Tuple<>(); - } else { - return nullptr; - } - } - -private: - SubParser subParser; -}; - -template -constexpr NotLookingAt_ notLookingAt(SubParser&& subParser) { - // Constructs a parser which fails at any position where the given parser succeeds. Otherwise, - // it succeeds without consuming any input and returns an empty tuple. - return NotLookingAt_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// endOfInput() -// Output = Tuple<>, only succeeds if at end-of-input - -class EndOfInput_ { -public: - template - Maybe> operator()(Input& input) const { - if (input.atEnd()) { - return Tuple<>(); - } else { - return nullptr; - } - } -}; - -constexpr EndOfInput_ endOfInput = EndOfInput_(); -// A parser that succeeds only if it is called with no input. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_COMMON_H_ diff --git a/external/capnp/include/kj/refcount.h b/external/capnp/include/kj/refcount.h deleted file mode 100644 index a24e4bf5b9..0000000000 --- a/external/capnp/include/kj/refcount.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include "memory.h" - -#ifndef KJ_REFCOUNT_H_ -#define KJ_REFCOUNT_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { - -class Refcounted: private Disposer { - // Subclass this to create a class that contains a reference count. Then, use - // `kj::refcounted()` to allocate a new refcounted pointer. - // - // Do NOT use this lightly. Refcounting is a crutch. Good designs should strive to make object - // ownership clear, so that refcounting is not necessary. All that said, reference counting can - // sometimes simplify code that would otherwise become convoluted with explicit ownership, even - // when ownership relationships are clear at an abstract level. - // - // NOT THREADSAFE: This refcounting implementation assumes that an object's references are - // manipulated only in one thread, because atomic (thread-safe) refcounting is surprisingly slow. - // - // In general, abstract classes should _not_ subclass this. The concrete class at the bottom - // of the hierarchy should be the one to decide how it implements refcounting. Interfaces should - // expose only an `addRef()` method that returns `Own`. There are two reasons for - // this rule: - // 1. Interfaces would need to virtually inherit Refcounted, otherwise two refcounted interfaces - // could not be inherited by the same subclass. Virtual inheritance is awkward and - // inefficient. - // 2. An implementation may decide that it would rather return a copy than a refcount, or use - // some other strategy. - // - // TODO(cleanup): Rethink above. Virtual inheritance is not necessarily that bad. OTOH, a - // virtual function call for every refcount is sad in its own way. A Ref type to replace - // Own could also be nice. - -public: - virtual ~Refcounted() noexcept(false); - - inline bool isShared() const { return refcount > 1; } - // Check if there are multiple references to this object. This is sometimes useful for deciding - // whether it's safe to modify the object vs. make a copy. - -private: - mutable uint refcount = 0; - // "mutable" because disposeImpl() is const. Bleh. - - void disposeImpl(void* pointer) const override; - template - static Own addRefInternal(T* object); - - template - friend Own addRef(T& object); - template - friend Own refcounted(Params&&... params); -}; - -template -inline Own refcounted(Params&&... params) { - // Allocate a new refcounted instance of T, passing `params` to its constructor. Returns an - // initial reference to the object. More references can be created with `kj::addRef()`. - - return Refcounted::addRefInternal(new T(kj::fwd(params)...)); -} - -template -Own addRef(T& object) { - // Return a new reference to `object`, which must subclass Refcounted and have been allocated - // using `kj::refcounted<>()`. It is suggested that subclasses implement a non-static addRef() - // method which wraps this and returns the appropriate type. - - KJ_IREQUIRE(object.Refcounted::refcount > 0, "Object not allocated with kj::refcounted()."); - return Refcounted::addRefInternal(&object); -} - -template -Own Refcounted::addRefInternal(T* object) { - Refcounted* refcounted = object; - ++refcounted->refcount; - return Own(object, *refcounted); -} - -} // namespace kj - -#endif // KJ_REFCOUNT_H_ diff --git a/external/capnp/include/kj/std/iostream.h b/external/capnp/include/kj/std/iostream.h deleted file mode 100644 index 627e0fcf86..0000000000 --- a/external/capnp/include/kj/std/iostream.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/* - * Compatibility layer for stdlib iostream - */ - -#ifndef KJ_STD_IOSTREAM_H_ -#define KJ_STD_IOSTREAM_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../io.h" -#include - -namespace kj { -namespace std { - -class StdOutputStream: public kj::OutputStream { - -public: - explicit StdOutputStream(::std::ostream& stream) : stream_(stream) {} - ~StdOutputStream() noexcept(false) {} - - virtual void write(const void* src, size_t size) override { - // Always writes the full size. - - stream_.write((char*)src, size); - } - - virtual void write(ArrayPtr> pieces) override { - // Equivalent to write()ing each byte array in sequence, which is what the - // default implementation does. Override if you can do something better, - // e.g. use writev() to do the write in a single syscall. - - for (auto piece : pieces) { - write(piece.begin(), piece.size()); - } - } - -private: - ::std::ostream& stream_; - -}; - -class StdInputStream: public kj::InputStream { - -public: - explicit StdInputStream(::std::istream& stream) : stream_(stream) {} - ~StdInputStream() noexcept(false) {} - - virtual size_t tryRead( - void* buffer, size_t minBytes, size_t maxBytes) override { - // Like read(), but may return fewer than minBytes on EOF. - - stream_.read((char*)buffer, maxBytes); - return stream_.gcount(); - } - -private: - ::std::istream& stream_; - -}; - -} // namespace std -} // namespace kj - -#endif // KJ_STD_IOSTREAM_H_ diff --git a/external/capnp/include/kj/string-tree.h b/external/capnp/include/kj/string-tree.h deleted file mode 100644 index 70a46319ef..0000000000 --- a/external/capnp/include/kj/string-tree.h +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_TREE_H_ -#define KJ_STRING_TREE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" - -namespace kj { - -class StringTree { - // A long string, represented internally as a tree of strings. This data structure is like a - // String, but optimized for concatenation and iteration at the expense of seek time. The - // structure is intended to be used for building large text blobs from many small pieces, where - // repeatedly concatenating smaller strings into larger ones would waste copies. This structure - // is NOT intended for use cases requiring random access or computing substrings. For those, - // you should use a Rope, which is a much more complicated data structure. - // - // The proper way to construct a StringTree is via kj::strTree(...), which works just like - // kj::str(...) but returns a StringTree rather than a String. - // - // KJ_STRINGIFY() functions that construct large strings from many smaller strings are encouraged - // to return StringTree rather than a flat char container. - -public: - inline StringTree(): size_(0) {} - inline StringTree(String&& text): size_(text.size()), text(kj::mv(text)) {} - - StringTree(Array&& pieces, StringPtr delim); - // Build a StringTree by concatenating the given pieces, delimited by the given delimiter - // (e.g. ", "). - - inline size_t size() const { return size_; } - - template - void visit(Func&& func) const; - - String flatten() const; - // Return the contents as a string. - - // TODO(someday): flatten() when *this is an rvalue and when branches.size() == 0 could simply - // return `kj::mv(text)`. Requires reference qualifiers (Clang 3.3 / GCC 4.8). - - void flattenTo(char* __restrict__ target) const; - // Copy the contents to the given character array. Does not add a NUL terminator. - -private: - size_t size_; - String text; - - struct Branch; - Array branches; // In order. - - inline void fill(char* pos, size_t branchIndex); - template - void fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, Array&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest); - - template - static StringTree concat(Params&&... params); - static StringTree&& concat(StringTree&& param) { return kj::mv(param); } - - template - static inline size_t flatSize(const T& t) { return t.size(); } - static inline size_t flatSize(String&& s) { return 0; } - static inline size_t flatSize(StringTree&& s) { return 0; } - - template - static inline size_t branchCount(const T& t) { return 0; } - static inline size_t branchCount(String&& s) { return 1; } - static inline size_t branchCount(StringTree&& s) { return 1; } - - template - friend StringTree strTree(Params&&... params); -}; - -inline StringTree&& KJ_STRINGIFY(StringTree&& tree) { return kj::mv(tree); } -inline const StringTree& KJ_STRINGIFY(const StringTree& tree) { return tree; } - -inline StringTree KJ_STRINGIFY(Array&& trees) { return StringTree(kj::mv(trees), ""); } - -template -StringTree strTree(Params&&... params); -// Build a StringTree by stringifying the given parameters and concatenating the results. -// If any of the parameters stringify to StringTree rvalues, they will be incorporated as -// branches to avoid a copy. - -// ======================================================================================= -// Inline implementation details - -namespace _ { // private - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest) { - // Make str() work with stringifiers that return StringTree by patching fill(). - - first.flattenTo(target); - return fill(target + first.size(), kj::fwd(rest)...); -} - -template constexpr bool isStringTree() { return false; } -template <> constexpr bool isStringTree() { return true; } - -inline StringTree&& toStringTreeOrCharSequence(StringTree&& tree) { return kj::mv(tree); } -inline StringTree toStringTreeOrCharSequence(String&& str) { return StringTree(kj::mv(str)); } - -template -inline auto toStringTreeOrCharSequence(T&& value) - -> decltype(toCharSequence(kj::fwd(value))) { - static_assert(!isStringTree>(), - "When passing a StringTree into kj::strTree(), either pass it by rvalue " - "(use kj::mv(value)) or explicitly call value.flatten() to make a copy."); - - return toCharSequence(kj::fwd(value)); -} - -} // namespace _ (private) - -struct StringTree::Branch { - size_t index; - // Index in `text` where this branch should be inserted. - - StringTree content; -}; - -template -void StringTree::visit(Func&& func) const { - size_t pos = 0; - for (auto& branch: branches) { - if (branch.index > pos) { - func(text.slice(pos, branch.index)); - pos = branch.index; - } - branch.content.visit(func); - } - if (text.size() > pos) { - func(text.slice(pos, text.size())); - } -} - -inline void StringTree::fill(char* pos, size_t branchIndex) { - KJ_IREQUIRE(pos == text.end() && branchIndex == branches.size(), - kj::str(text.end() - pos, ' ', branches.size() - branchIndex).cStr()); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest) { - pos = _::fill(pos, kj::fwd(first)); - fill(pos, branchIndex, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = kj::mv(first); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = StringTree(kj::mv(first)); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -StringTree StringTree::concat(Params&&... params) { - StringTree result; - result.size_ = _::sum({params.size()...}); - result.text = heapString( - _::sum({StringTree::flatSize(kj::fwd(params))...})); - result.branches = heapArray( - _::sum({StringTree::branchCount(kj::fwd(params))...})); - result.fill(result.text.begin(), 0, kj::fwd(params)...); - return result; -} - -template -StringTree strTree(Params&&... params) { - return StringTree::concat(_::toStringTreeOrCharSequence(kj::fwd(params))...); -} - -} // namespace kj - -#endif // KJ_STRING_TREE_H_ diff --git a/external/capnp/include/kj/string.h b/external/capnp/include/kj/string.h deleted file mode 100644 index 9048be2417..0000000000 --- a/external/capnp/include/kj/string.h +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_H_ -#define KJ_STRING_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "array.h" -#include - -namespace kj { - -class StringPtr; -class String; - -class StringTree; // string-tree.h - -// Our STL string SFINAE trick does not work with GCC 4.7, but it works with Clang and GCC 4.8, so -// we'll just preprocess it out if not supported. -#if __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || _MSC_VER -#define KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP 1 -#endif - -// ======================================================================================= -// StringPtr -- A NUL-terminated ArrayPtr containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. - -class StringPtr { -public: - inline StringPtr(): content("", 1) {} - inline StringPtr(decltype(nullptr)): content("", 1) {} - inline StringPtr(const char* value): content(value, strlen(value) + 1) {} - inline StringPtr(const char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - inline StringPtr(const char* begin, const char* end): StringPtr(begin, end - begin) {} - inline StringPtr(const String& value); - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline StringPtr(const T& t): StringPtr(t.c_str()) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. - - template ().c_str())> - inline operator T() const { return cStr(); } - // Allow implicit conversion to any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif - - inline operator ArrayPtr() const; - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const; - inline bool operator!=(const StringPtr& other) const { return !(*this == other); } - inline bool operator< (const StringPtr& other) const; - inline bool operator> (const StringPtr& other) const { return other < *this; } - inline bool operator<=(const StringPtr& other) const { return !(other < *this); } - inline bool operator>=(const StringPtr& other) const { return !(*this < other); } - - inline StringPtr slice(size_t start) const; - inline ArrayPtr slice(size_t start, size_t end) const; - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - - inline bool startsWith(const StringPtr& other) const; - inline bool endsWith(const StringPtr& other) const; - - inline Maybe findFirst(char c) const; - inline Maybe findLast(char c) const; - - template - T parseAs() const; - // Parse string as template number type. - // Integer numbers prefixed by "0x" and "0X" are parsed in base 16 (like strtoi with base 0). - // Integer numbers prefixed by "0" are parsed in base 10 (unlike strtoi with base 0). - // Overflowed integer numbers throw exception. - // Overflowed floating numbers return inf. - -private: - inline StringPtr(ArrayPtr content): content(content) {} - - ArrayPtr content; -}; - -inline bool operator==(const char* a, const StringPtr& b) { return b == a; } -inline bool operator!=(const char* a, const StringPtr& b) { return b != a; } - -template <> char StringPtr::parseAs() const; -template <> signed char StringPtr::parseAs() const; -template <> unsigned char StringPtr::parseAs() const; -template <> short StringPtr::parseAs() const; -template <> unsigned short StringPtr::parseAs() const; -template <> int StringPtr::parseAs() const; -template <> unsigned StringPtr::parseAs() const; -template <> long StringPtr::parseAs() const; -template <> unsigned long StringPtr::parseAs() const; -template <> long long StringPtr::parseAs() const; -template <> unsigned long long StringPtr::parseAs() const; -template <> float StringPtr::parseAs() const; -template <> double StringPtr::parseAs() const; - -// ======================================================================================= -// String -- A NUL-terminated Array containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. -// -// To allocate a String, you must call kj::heapString(). We do not implement implicit copying to -// the heap because this hides potential inefficiency from the developer. - -class String { -public: - String() = default; - inline String(decltype(nullptr)): content(nullptr) {} - inline String(char* value, size_t size, const ArrayDisposer& disposer); - // Does not copy. `size` does not include NUL terminator, but `value` must be NUL-terminated. - inline explicit String(Array buffer); - // Does not copy. Requires `buffer` ends with `\0`. - - inline operator ArrayPtr(); - inline operator ArrayPtr() const; - inline ArrayPtr asArray(); - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() { return asArray().asBytes(); } - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline Array releaseArray() { return kj::mv(content); } - // Disowns the backing array (which includes the NUL terminator) and returns it. The String value - // is clobbered (as if moved away). - - inline const char* cStr() const; - - inline size_t size() const; - // Result does not include NUL terminator. - - inline char operator[](size_t index) const; - inline char& operator[](size_t index); - - inline char* begin(); - inline char* end(); - inline const char* begin() const; - inline const char* end() const; - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const { return StringPtr(*this) == other; } - inline bool operator!=(const StringPtr& other) const { return StringPtr(*this) != other; } - inline bool operator< (const StringPtr& other) const { return StringPtr(*this) < other; } - inline bool operator> (const StringPtr& other) const { return StringPtr(*this) > other; } - inline bool operator<=(const StringPtr& other) const { return StringPtr(*this) <= other; } - inline bool operator>=(const StringPtr& other) const { return StringPtr(*this) >= other; } - - inline bool startsWith(const StringPtr& other) const { return StringPtr(*this).startsWith(other);} - inline bool endsWith(const StringPtr& other) const { return StringPtr(*this).endsWith(other); } - - inline StringPtr slice(size_t start) const { return StringPtr(*this).slice(start); } - inline ArrayPtr slice(size_t start, size_t end) const { - return StringPtr(*this).slice(start, end); - } - - inline Maybe findFirst(char c) const { return StringPtr(*this).findFirst(c); } - inline Maybe findLast(char c) const { return StringPtr(*this).findLast(c); } - - template - T parseAs() const { return StringPtr(*this).parseAs(); } - // Parse as number - -private: - Array content; -}; - -inline bool operator==(const char* a, const String& b) { return b == a; } -inline bool operator!=(const char* a, const String& b) { return b != a; } - -String heapString(size_t size); -// Allocate a String of the given size on the heap, not including NUL terminator. The NUL -// terminator will be initialized automatically but the rest of the content is not initialized. - -String heapString(const char* value); -String heapString(const char* value, size_t size); -String heapString(StringPtr value); -String heapString(const String& value); -String heapString(ArrayPtr value); -// Allocates a copy of the given value on the heap. - -// ======================================================================================= -// Magic str() function which transforms parameters to text and concatenates them into one big -// String. - -namespace _ { // private - -inline size_t sum(std::initializer_list nums) { - size_t result = 0; - for (auto num: nums) { - result += num; - } - return result; -} - -inline char* fill(char* ptr) { return ptr; } - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest); -// Make str() work with stringifiers that return StringTree by patching fill(). -// -// Defined in string-tree.h. - -template -char* fill(char* __restrict__ target, const First& first, Rest&&... rest) { - auto i = first.begin(); - auto end = first.end(); - while (i != end) { - *target++ = *i++; - } - return fill(target, kj::fwd(rest)...); -} - -template -String concat(Params&&... params) { - // Concatenate a bunch of containers into a single Array. The containers can be anything that - // is iterable and whose elements can be converted to `char`. - - String result = heapString(sum({params.size()...})); - fill(result.begin(), kj::fwd(params)...); - return result; -} - -inline String concat(String&& arr) { - return kj::mv(arr); -} - -struct Stringifier { - // This is a dummy type with only one instance: STR (below). To make an arbitrary type - // stringifiable, define `operator*(Stringifier, T)` to return an iterable container of `char`. - // The container type must have a `size()` method. Be sure to declare the operator in the same - // namespace as `T` **or** in the global scope. - // - // A more usual way to accomplish what we're doing here would be to require that you define - // a function like `toString(T)` and then rely on argument-dependent lookup. However, this has - // the problem that it pollutes other people's namespaces and even the global namespace. For - // example, some other project may already have functions called `toString` which do something - // different. Declaring `operator*` with `Stringifier` as the left operand cannot conflict with - // anything. - - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - template - inline ArrayPtr operator*(const CappedArray& s) const { return s; } - template - inline ArrayPtr operator*(const FixedArray& s) const { return s; } - inline ArrayPtr operator*(const char* s) const { return arrayPtr(s, strlen(s)); } - inline ArrayPtr operator*(const String& s) const { return s.asArray(); } - inline ArrayPtr operator*(const StringPtr& s) const { return s.asArray(); } - - inline Range operator*(const Range& r) const { return r; } - inline Repeat operator*(const Repeat& r) const { return r; } - - inline FixedArray operator*(char c) const { - FixedArray result; - result[0] = c; - return result; - } - - StringPtr operator*(decltype(nullptr)) const; - StringPtr operator*(bool b) const; - - CappedArray operator*(signed char i) const; - CappedArray operator*(unsigned char i) const; - CappedArray operator*(short i) const; - CappedArray operator*(unsigned short i) const; - CappedArray operator*(int i) const; - CappedArray operator*(unsigned int i) const; - CappedArray operator*(long i) const; - CappedArray operator*(unsigned long i) const; - CappedArray operator*(long long i) const; - CappedArray operator*(unsigned long long i) const; - CappedArray operator*(float f) const; - CappedArray operator*(double f) const; - CappedArray operator*(const void* s) const; - - template - String operator*(ArrayPtr arr) const; - template - String operator*(const Array& arr) const; - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP // supports expression SFINAE? - template ().toString())> - inline Result operator*(T&& value) const { return kj::fwd(value).toString(); } -#endif -}; -static KJ_CONSTEXPR(const) Stringifier STR = Stringifier(); - -} // namespace _ (private) - -template -auto toCharSequence(T&& value) -> decltype(_::STR * kj::fwd(value)) { - // Returns an iterable of chars that represent a textual representation of the value, suitable - // for debugging. - // - // Most users should use str() instead, but toCharSequence() may occasionally be useful to avoid - // heap allocation overhead that str() implies. - // - // To specialize this function for your type, see KJ_STRINGIFY. - - return _::STR * kj::fwd(value); -} - -CappedArray hex(unsigned char i); -CappedArray hex(unsigned short i); -CappedArray hex(unsigned int i); -CappedArray hex(unsigned long i); -CappedArray hex(unsigned long long i); - -template -String str(Params&&... params) { - // Magic function which builds a string from a bunch of arbitrary values. Example: - // str(1, " / ", 2, " = ", 0.5) - // returns: - // "1 / 2 = 0.5" - // To teach `str` how to stringify a type, see `Stringifier`. - - return _::concat(toCharSequence(kj::fwd(params))...); -} - -inline String str(String&& s) { return mv(s); } -// Overload to prevent redundant allocation. - -template -String strArray(T&& arr, const char* delim) { - size_t delimLen = strlen(delim); - KJ_STACK_ARRAY(decltype(_::STR * arr[0]), pieces, kj::size(arr), 8, 32); - size_t size = 0; - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) size += delimLen; - pieces[i] = _::STR * arr[i]; - size += pieces[i].size(); - } - - String result = heapString(size); - char* pos = result.begin(); - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) { - memcpy(pos, delim, delimLen); - pos += delimLen; - } - pos = _::fill(pos, pieces[i]); - } - return result; -} - -namespace _ { // private - -template -inline String Stringifier::operator*(ArrayPtr arr) const { - return strArray(arr, ", "); -} - -template -inline String Stringifier::operator*(const Array& arr) const { - return strArray(arr, ", "); -} - -} // namespace _ (private) - -#define KJ_STRINGIFY(...) operator*(::kj::_::Stringifier, __VA_ARGS__) -// Defines a stringifier for a custom type. Example: -// -// class Foo {...}; -// inline StringPtr KJ_STRINGIFY(const Foo& foo) { return foo.name(); } -// -// This allows Foo to be passed to str(). -// -// The function should be declared either in the same namespace as the target type or in the global -// namespace. It can return any type which is an iterable container of chars. - -// ======================================================================================= -// Inline implementation details. - -inline StringPtr::StringPtr(const String& value): content(value.begin(), value.size() + 1) {} - -inline StringPtr::operator ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline ArrayPtr StringPtr::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline bool StringPtr::operator==(const StringPtr& other) const { - return content.size() == other.content.size() && - memcmp(content.begin(), other.content.begin(), content.size() - 1) == 0; -} - -inline bool StringPtr::operator<(const StringPtr& other) const { - bool shorter = content.size() < other.content.size(); - int cmp = memcmp(content.begin(), other.content.begin(), - shorter ? content.size() : other.content.size()); - return cmp < 0 || (cmp == 0 && shorter); -} - -inline StringPtr StringPtr::slice(size_t start) const { - return StringPtr(content.slice(start, content.size())); -} -inline ArrayPtr StringPtr::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline bool StringPtr::startsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(content.begin(), other.content.begin(), other.size()) == 0; -} -inline bool StringPtr::endsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(end() - other.size(), other.content.begin(), other.size()) == 0; -} - -inline Maybe StringPtr::findFirst(char c) const { - const char* pos = reinterpret_cast(memchr(content.begin(), c, size())); - if (pos == nullptr) { - return nullptr; - } else { - return pos - content.begin(); - } -} - -inline Maybe StringPtr::findLast(char c) const { - for (size_t i = size(); i > 0; --i) { - if (content[i-1] == c) { - return i-1; - } - } - return nullptr; -} - -inline String::operator ArrayPtr() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline String::operator ArrayPtr() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline ArrayPtr String::asArray() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline ArrayPtr String::asArray() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline const char* String::cStr() const { return content == nullptr ? "" : content.begin(); } - -inline size_t String::size() const { return content == nullptr ? 0 : content.size() - 1; } - -inline char String::operator[](size_t index) const { return content[index]; } -inline char& String::operator[](size_t index) { return content[index]; } - -inline char* String::begin() { return content == nullptr ? nullptr : content.begin(); } -inline char* String::end() { return content == nullptr ? nullptr : content.end() - 1; } -inline const char* String::begin() const { return content == nullptr ? nullptr : content.begin(); } -inline const char* String::end() const { return content == nullptr ? nullptr : content.end() - 1; } - -inline String::String(char* value, size_t size, const ArrayDisposer& disposer) - : content(value, size + 1, disposer) { - KJ_IREQUIRE(value[size] == '\0', "String must be NUL-terminated."); -} - -inline String::String(Array buffer): content(kj::mv(buffer)) { - KJ_IREQUIRE(content.size() > 0 && content.back() == '\0', "String must be NUL-terminated."); -} - -inline String heapString(const char* value) { - return heapString(value, strlen(value)); -} -inline String heapString(StringPtr value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(const String& value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(ArrayPtr value) { - return heapString(value.begin(), value.size()); -} - -} // namespace kj - -#endif // KJ_STRING_H_ diff --git a/external/capnp/include/kj/test.h b/external/capnp/include/kj/test.h deleted file mode 100644 index 69e1c80840..0000000000 --- a/external/capnp/include/kj/test.h +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TEST_H_ -#define KJ_TEST_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "debug.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class TestRunner; - -class TestCase { -public: - TestCase(const char* file, uint line, const char* description); - ~TestCase(); - - virtual void run() = 0; - -private: - const char* file; - uint line; - const char* description; - TestCase* next; - TestCase** prev; - bool matchedFilter; - - friend class TestRunner; -}; - -#define KJ_TEST(description) \ - /* Make sure the linker fails if tests are not in anonymous namespaces. */ \ - extern int KJ_CONCAT(YouMustWrapTestsInAnonymousNamespace, __COUNTER__) KJ_UNUSED; \ - class KJ_UNIQUE_NAME(TestCase): public ::kj::TestCase { \ - public: \ - KJ_UNIQUE_NAME(TestCase)(): ::kj::TestCase(__FILE__, __LINE__, description) {} \ - void run() override; \ - } KJ_UNIQUE_NAME(testCase); \ - void KJ_UNIQUE_NAME(TestCase)::run() - -#if _MSC_VER -#define KJ_INDIRECT_EXPAND(m, vargs) m vargs -#define KJ_FAIL_EXPECT(...) \ - KJ_INDIRECT_EXPAND(KJ_LOG, (ERROR , __VA_ARGS__)); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_INDIRECT_EXPAND(KJ_FAIL_EXPECT, ("failed: expected " #cond , __VA_ARGS__)) -#else -#define KJ_FAIL_EXPECT(...) \ - KJ_LOG(ERROR, ##__VA_ARGS__); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_FAIL_EXPECT("failed: expected " #cond, ##__VA_ARGS__) -#endif - -#define KJ_EXPECT_THROW_RECOVERABLE(type, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(e->getType() == ::kj::Exception::Type::type, \ - "code threw wrong exception type: " #code, e->getType()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#define KJ_EXPECT_THROW_RECOVERABLE_MESSAGE(message, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(::kj::_::hasSubstring(e->getDescription(), message), \ - "exception description didn't contain expected substring", e->getDescription()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#if KJ_NO_EXCEPTIONS -#define KJ_EXPECT_THROW(type, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(type, nullptr, [&]() { code; })); \ - } while (false) -#define KJ_EXPECT_THROW_MESSAGE(message, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, kj::StringPtr(message), [&]() { code; })); \ - } while (false) -#else -#define KJ_EXPECT_THROW KJ_EXPECT_THROW_RECOVERABLE -#define KJ_EXPECT_THROW_MESSAGE KJ_EXPECT_THROW_RECOVERABLE_MESSAGE -#endif - -#define KJ_EXPECT_LOG(level, substring) \ - ::kj::_::LogExpectation KJ_UNIQUE_NAME(_kjLogExpectation)(::kj::LogSeverity::level, substring) -// Expects that a log message with the given level and substring text will be printed within -// the current scope. This message will not cause the test to fail, even if it is an error. - -// ======================================================================================= - -namespace _ { // private - -bool hasSubstring(kj::StringPtr haystack, kj::StringPtr needle); - -#if KJ_NO_EXCEPTIONS -bool expectFatalThrow(Maybe type, Maybe message, - Function code); -// Expects that the given code will throw a fatal exception matching the given type and/or message. -// Since exceptions are disabled, the test will fork() and run in a subprocess. On Windows, where -// fork() is not available, this always returns true. -#endif - -class LogExpectation: public ExceptionCallback { -public: - LogExpectation(LogSeverity severity, StringPtr substring); - ~LogExpectation(); - - void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - -private: - LogSeverity severity; - StringPtr substring; - bool seen; - UnwindDetector unwindDetector; -}; - -class GlobFilter { - // Implements glob filters for the --filter flag. - // - // Exposed in header only for testing. - -public: - explicit GlobFilter(const char* pattern); - explicit GlobFilter(ArrayPtr pattern); - - bool matches(StringPtr name); - -private: - String pattern; - Vector states; - - void applyState(char c, int state); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_TEST_H_ diff --git a/external/capnp/include/kj/thread.h b/external/capnp/include/kj/thread.h deleted file mode 100644 index b17b88c520..0000000000 --- a/external/capnp/include/kj/thread.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREAD_H_ -#define KJ_THREAD_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "function.h" -#include "exception.h" - -namespace kj { - -class Thread { - // A thread! Pass a lambda to the constructor, and it runs in the thread. The destructor joins - // the thread. If the function throws an exception, it is rethrown from the thread's destructor - // (if not unwinding from another exception). - -public: - explicit Thread(Function func); - KJ_DISALLOW_COPY(Thread); - - ~Thread() noexcept(false); - -#if !_WIN32 - void sendSignal(int signo); - // Send a Unix signal to the given thread, using pthread_kill or an equivalent. -#endif - - void detach(); - // Don't join the thread in ~Thread(). - -private: - struct ThreadState { - Function func; - kj::Maybe exception; - - unsigned int refcount; - // Owned by the parent thread and the child thread. - - void unref(); - }; - ThreadState* state; - -#if _WIN32 - void* threadHandle; -#else - unsigned long long threadId; // actually pthread_t -#endif - bool detached = false; - -#if _WIN32 - static unsigned long __stdcall runThread(void* ptr); -#else - static void* runThread(void* ptr); -#endif -}; - -} // namespace kj - -#endif // KJ_THREAD_H_ diff --git a/external/capnp/include/kj/threadlocal.h b/external/capnp/include/kj/threadlocal.h deleted file mode 100644 index 67d0db60ef..0000000000 --- a/external/capnp/include/kj/threadlocal.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014, Jason Choy -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREADLOCAL_H_ -#define KJ_THREADLOCAL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif -// This file declares a macro `KJ_THREADLOCAL_PTR` for declaring thread-local pointer-typed -// variables. Use like: -// KJ_THREADLOCAL_PTR(MyType) foo = nullptr; -// This is equivalent to: -// thread_local MyType* foo = nullptr; -// This can only be used at the global scope. -// -// AVOID USING THIS. Use of thread-locals is discouraged because they often have many of the same -// properties as singletons: http://www.object-oriented-security.org/lets-argue/singletons -// -// Also, thread-locals tend to be hostile to event-driven code, which can be particularly -// surprising when using fibers (all fibers in the same thread will share the same threadlocals, -// even though they do not share a stack). -// -// That said, thread-locals are sometimes needed for runtime logistics in the KJ framework. For -// example, the current exception callback and current EventLoop are stored as thread-local -// pointers. Since KJ only ever needs to store pointers, not values, we avoid the question of -// whether these values' destructors need to be run, and we avoid the need for heap allocation. - -#include "common.h" - -#if !defined(KJ_USE_PTHREAD_THREADLOCAL) && defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -// iOS apparently does not support __thread (nor C++11 thread_local). -#define KJ_USE_PTHREAD_TLS 1 -#endif -#endif - -#if KJ_USE_PTHREAD_TLS -#include -#endif - -namespace kj { - -#if KJ_USE_PTHREAD_TLS -// If __thread is unavailable, we'll fall back to pthreads. - -#define KJ_THREADLOCAL_PTR(type) \ - namespace { struct KJ_UNIQUE_NAME(_kj_TlpTag); } \ - static ::kj::_::ThreadLocalPtr< type, KJ_UNIQUE_NAME(_kj_TlpTag)> -// Hack: In order to ensure each thread-local results in a unique template instance, we declare -// a one-off dummy type to use as the second type parameter. - -namespace _ { // private - -template -class ThreadLocalPtr { - // Hacky type to emulate __thread T*. We need a separate instance of the ThreadLocalPtr template - // for every thread-local variable, because we don't want to require a global constructor, and in - // order to initialize the TLS on first use we need to use a local static variable (in getKey()). - // Each template instance will get a separate such local static variable, fulfilling our need. - -public: - ThreadLocalPtr() = default; - constexpr ThreadLocalPtr(decltype(nullptr)) {} - // Allow initialization to nullptr without a global constructor. - - inline ThreadLocalPtr& operator=(T* val) { - pthread_setspecific(getKey(), val); - return *this; - } - - inline operator T*() const { - return get(); - } - - inline T& operator*() const { - return *get(); - } - - inline T* operator->() const { - return get(); - } - -private: - inline T* get() const { - return reinterpret_cast(pthread_getspecific(getKey())); - } - - inline static pthread_key_t getKey() { - static pthread_key_t key = createKey(); - return key; - } - - static pthread_key_t createKey() { - pthread_key_t key; - pthread_key_create(&key, 0); - return key; - } -}; - -} // namespace _ (private) - -#elif __GNUC__ - -#define KJ_THREADLOCAL_PTR(type) static __thread type* -// GCC's __thread is lighter-weight than thread_local and is good enough for our purposes. - -#else - -#define KJ_THREADLOCAL_PTR(type) static thread_local type* - -#endif // KJ_USE_PTHREAD_TLS - -} // namespace kj - -#endif // KJ_THREADLOCAL_H_ diff --git a/external/capnp/include/kj/time.h b/external/capnp/include/kj/time.h deleted file mode 100644 index 37d7b8a90e..0000000000 --- a/external/capnp/include/kj/time.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2014 Google Inc. (contributed by Remy Blank ) -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TIME_H_ -#define KJ_TIME_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "units.h" -#include - -namespace kj { -namespace _ { // private - -class NanosecondLabel; -class TimeLabel; -class DateLabel; - -} // namespace _ (private) - -using Duration = Quantity; -// A time value, in nanoseconds. - -constexpr Duration NANOSECONDS = unit(); -constexpr Duration MICROSECONDS = 1000 * NANOSECONDS; -constexpr Duration MILLISECONDS = 1000 * MICROSECONDS; -constexpr Duration SECONDS = 1000 * MILLISECONDS; -constexpr Duration MINUTES = 60 * SECONDS; -constexpr Duration HOURS = 60 * MINUTES; -constexpr Duration DAYS = 24 * HOURS; - -using TimePoint = Absolute; -// An absolute time measured by some particular instance of `Timer`. `Time`s from two different -// `Timer`s may be measured from different origins and so are not necessarily compatible. - -using Date = Absolute; -// A point in real-world time, measured relative to the Unix epoch (Jan 1, 1970 00:00:00 UTC). - -constexpr Date UNIX_EPOCH = origin(); -// The `Date` representing Jan 1, 1970 00:00:00 UTC. - -class Clock { - // Interface to read the current date and time. -public: - virtual Date now() = 0; -}; - -Clock& nullClock(); -// A clock which always returns UNIX_EPOCH as the current time. Useful when you don't care about -// time. - -class Timer { - // Interface to time and timer functionality. - // - // Each `Timer` may have a different origin, and some `Timer`s may in fact tick at a different - // rate than real time (e.g. a `Timer` could represent CPU time consumed by a thread). However, - // all `Timer`s are monotonic: time will never appear to move backwards, even if the calendar - // date as tracked by the system is manually modified. - -public: - virtual TimePoint now() = 0; - // Returns the current value of a clock that moves steadily forward, independent of any - // changes in the wall clock. The value is updated every time the event loop waits, - // and is constant in-between waits. - - virtual Promise atTime(TimePoint time) = 0; - // Returns a promise that returns as soon as now() >= time. - - virtual Promise afterDelay(Duration delay) = 0; - // Equivalent to atTime(now() + delay). - - template - Promise timeoutAt(TimePoint time, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed by `time`. The thrown exception is of type - // "OVERLOADED". - - template - Promise timeoutAfter(Duration delay, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed after `delay` from now. The thrown exception is of - // type "OVERLOADED". - -private: - static kj::Exception makeTimeoutException(); -}; - -class TimerImpl final: public Timer { - // Implementation of Timer that expects an external caller -- usually, the EventPort - // implementation -- to tell it when time has advanced. - -public: - TimerImpl(TimePoint startTime); - ~TimerImpl() noexcept(false); - - Maybe nextEvent(); - // Returns the time at which the next scheduled timer event will occur, or null if no timer - // events are scheduled. - - Maybe timeoutToNextEvent(TimePoint start, Duration unit, uint64_t max); - // Convenience method which computes a timeout value to pass to an event-waiting system call to - // cause it to time out when the next timer event occurs. - // - // `start` is the time at which the timeout starts counting. This is typically not the same as - // now() since some time may have passed since the last time advanceTo() was called. - // - // `unit` is the time unit in which the timeout is measured. This is often MILLISECONDS. Note - // that this method will fractional values *up*, to guarantee that the returned timeout waits - // until just *after* the time the event is scheduled. - // - // The timeout will be clamped to `max`. Use this to avoid an overflow if e.g. the OS wants a - // 32-bit value or a signed value. - // - // Returns nullptr if there are no future events. - - void advanceTo(TimePoint newTime); - // Set the time to `time` and fire any at() events that have been passed. - - // implements Timer ---------------------------------------------------------- - TimePoint now() override; - Promise atTime(TimePoint time) override; - Promise afterDelay(Duration delay) override; - -private: - struct Impl; - class TimerPromiseAdapter; - TimePoint time; - Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -Promise Timer::timeoutAt(TimePoint time, Promise&& promise) { - return promise.exclusiveJoin(atTime(time).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -template -Promise Timer::timeoutAfter(Duration delay, Promise&& promise) { - return promise.exclusiveJoin(afterDelay(delay).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -inline TimePoint TimerImpl::now() { return time; } - -} // namespace kj - -#endif // KJ_TIME_H_ diff --git a/external/capnp/include/kj/tuple.h b/external/capnp/include/kj/tuple.h deleted file mode 100644 index 2ea7276ec5..0000000000 --- a/external/capnp/include/kj/tuple.h +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines a notion of tuples that is simpler that `std::tuple`. It works as follows: -// - `kj::Tuple is the type of a tuple of an A, a B, and a C. -// - `kj::tuple(a, b, c)` returns a tuple containing a, b, and c. If any of these are themselves -// tuples, they are flattened, so `tuple(a, tuple(b, c), d)` is equivalent to `tuple(a, b, c, d)`. -// - `kj::get(myTuple)` returns the element of `myTuple` at index n. -// - `kj::apply(func, ...)` calls func on the following arguments after first expanding any tuples -// in the argument list. So `kj::apply(foo, a, tuple(b, c), d)` would call `foo(a, b, c, d)`. -// -// Note that: -// - The type `Tuple` is a synonym for T. This is why `get` and `apply` are not members of the -// type. -// - It is illegal for an element of `Tuple` to itself be a tuple, as tuples are meant to be -// flattened. -// - It is illegal for an element of `Tuple` to be a reference, due to problems this would cause -// with type inference and `tuple()`. - -#ifndef KJ_TUPLE_H_ -#define KJ_TUPLE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { -namespace _ { // private - -template -struct TypeByIndex_; -template -struct TypeByIndex_<0, First, Rest...> { - typedef First Type; -}; -template -struct TypeByIndex_ - : public TypeByIndex_ {}; -template -struct TypeByIndex_ { - static_assert(index != index, "Index out-of-range."); -}; -template -using TypeByIndex = typename TypeByIndex_::Type; -// Chose a particular type out of a list of types, by index. - -template -struct Indexes {}; -// Dummy helper type that just encapsulates a sequential list of indexes, so that we can match -// templates against them and unpack them with '...'. - -template -struct MakeIndexes_: public MakeIndexes_ {}; -template -struct MakeIndexes_<0, prefix...> { - typedef Indexes Type; -}; -template -using MakeIndexes = typename MakeIndexes_::Type; -// Equivalent to Indexes<0, 1, 2, ..., end>. - -template -class Tuple; -template -inline TypeByIndex& getImpl(Tuple& tuple); -template -inline TypeByIndex&& getImpl(Tuple&& tuple); -template -inline const TypeByIndex& getImpl(const Tuple& tuple); - -template -struct TupleElement { - // Encapsulates one element of a tuple. The actual tuple implementation multiply-inherits - // from a TupleElement for each element, which is more efficient than a recursive definition. - - T value; - TupleElement() = default; - constexpr inline TupleElement(const T& value): value(value) {} - constexpr inline TupleElement(T&& value): value(kj::mv(value)) {} -}; - -template -struct TupleElement { - // If tuples contained references, one of the following would have to be true: - // - `auto x = tuple(y, z)` would cause x to be a tuple of references to y and z, which is - // probably not what you expected. - // - `Tuple x = tuple(a, b)` would not work, because `tuple()` returned - // Tuple. - static_assert(sizeof(T*) == 0, "Sorry, tuples cannot contain references."); -}; - -template -struct TupleElement> { - static_assert(sizeof(Tuple*) == 0, - "Tuples cannot contain other tuples -- they should be flattened."); -}; - -template -struct TupleImpl; - -template -struct TupleImpl, Types...> - : public TupleElement... { - // Implementation of Tuple. The only reason we need this rather than rolling this into class - // Tuple (below) is so that we can get "indexes" as an unpackable list. - - static_assert(sizeof...(indexes) == sizeof...(Types), "Incorrect use of TupleImpl."); - - template - inline TupleImpl(Params&&... params) - : TupleElement(kj::fwd(params))... { - // Work around Clang 3.2 bug 16303 where this is not detected. (Unfortunately, Clang sometimes - // segfaults instead.) - static_assert(sizeof...(params) == sizeof...(indexes), - "Wrong number of parameters to Tuple constructor."); - } - - template - constexpr inline TupleImpl(Tuple&& other) - : TupleElement(kj::mv(getImpl(other)))... {} - template - constexpr inline TupleImpl(Tuple& other) - : TupleElement(getImpl(other))... {} - template - constexpr inline TupleImpl(const Tuple& other) - : TupleElement(getImpl(other))... {} -}; - -struct MakeTupleFunc; - -template -class Tuple { - // The actual Tuple class (used for tuples of size other than 1). - -public: - template - constexpr inline Tuple(Tuple&& other): impl(kj::mv(other)) {} - template - constexpr inline Tuple(Tuple& other): impl(other) {} - template - constexpr inline Tuple(const Tuple& other): impl(other) {} - -private: - template - constexpr Tuple(Params&&... params): impl(kj::fwd(params)...) {} - - TupleImpl, T...> impl; - - template - friend inline TypeByIndex& getImpl(Tuple& tuple); - template - friend inline TypeByIndex&& getImpl(Tuple&& tuple); - template - friend inline const TypeByIndex& getImpl(const Tuple& tuple); - friend struct MakeTupleFunc; -}; - -template <> -class Tuple<> { - // Simplified zero-member version of Tuple. In particular this is important to make sure that - // Tuple<>() is constexpr. -}; - -template -class Tuple; -// Single-element tuple should never be used. The public API should ensure this. - -template -inline TypeByIndex& getImpl(Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline TypeByIndex&& getImpl(Tuple&& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return kj::mv(implicitCast>&>(tuple.impl).value); -} -template -inline const TypeByIndex& getImpl(const Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline T&& getImpl(T&& value) { - // Get member of a Tuple by index, e.g. `getImpl<2>(myTuple)`. - - // Non-tuples are equivalent to one-element tuples. - static_assert(index == 0, "Tuple element index out-of-bounds."); - return kj::fwd(value); -} - - -template -struct ExpandAndApplyResult_; -// Template which computes the return type of applying Func to T... after flattening tuples. -// SoFar starts as Tuple<> and accumulates the flattened parameter types -- so after this template -// is recursively expanded, T... is empty and SoFar is a Tuple containing all the parameters. - -template -struct ExpandAndApplyResult_, First, Rest...> - : public ExpandAndApplyResult_, Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple, Rest...> - : public ExpandAndApplyResult_, FirstTypes&&..., Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple&, Rest...> - : public ExpandAndApplyResult_, FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_, const Tuple&, Rest...> - : public ExpandAndApplyResult_, const FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_> { - typedef decltype(instance()(instance()...)) Type; -}; -template -using ExpandAndApplyResult = typename ExpandAndApplyResult_, T...>::Type; -// Computes the expected return type of `expandAndApply()`. - -template -inline auto expandAndApply(Func&& func) -> ExpandAndApplyResult { - return func(); -} - -template -struct ExpandAndApplyFunc { - Func&& func; - First&& first; - ExpandAndApplyFunc(Func&& func, First&& first) - : func(kj::fwd(func)), first(kj::fwd(first)) {} - template - auto operator()(T&&... params) - -> decltype(this->func(kj::fwd(first), kj::fwd(params)...)) { - return this->func(kj::fwd(first), kj::fwd(params)...); - } -}; - -template -inline auto expandAndApply(Func&& func, First&& first, Rest&&... rest) - -> ExpandAndApplyResult { - - return expandAndApply( - ExpandAndApplyFunc(kj::fwd(func), kj::fwd(first)), - kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), kj::mv(first), kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), kj::mv(getImpl(first))..., - kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), getImpl(first)..., - kj::fwd(rest)...); -} - -struct MakeTupleFunc { - template - Tuple...> operator()(Params&&... params) { - return Tuple...>(kj::fwd(params)...); - } - template - Decay operator()(Param&& param) { - return kj::fwd(param); - } -}; - -} // namespace _ (private) - -template struct Tuple_ { typedef _::Tuple Type; }; -template struct Tuple_ { typedef T Type; }; - -template using Tuple = typename Tuple_::Type; -// Tuple type. `Tuple` (i.e. a single-element tuple) is a synonym for `T`. Tuples of size -// other than 1 expand to an internal type. Either way, you can construct a Tuple using -// `kj::tuple(...)`, get an element by index `i` using `kj::get(myTuple)`, and expand the tuple -// as arguments to a function using `kj::apply(func, myTuple)`. -// -// Tuples are always flat -- that is, no element of a Tuple is ever itself a Tuple. If you -// construct a tuple from other tuples, the elements are flattened and concatenated. - -template -inline auto tuple(Params&&... params) - -> decltype(_::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...)) { - // Construct a new tuple from the given values. Any tuples in the argument list will be - // flattened into the result. - return _::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...); -} - -template -inline auto get(Tuple&& tuple) -> decltype(_::getImpl(kj::fwd(tuple))) { - // Unpack and return the tuple element at the given index. The index is specified as a template - // parameter, e.g. `kj::get<3>(myTuple)`. - return _::getImpl(kj::fwd(tuple)); -} - -template -inline auto apply(Func&& func, Params&&... params) - -> decltype(_::expandAndApply(kj::fwd(func), kj::fwd(params)...)) { - // Apply a function to some arguments, expanding tuples into separate arguments. - return _::expandAndApply(kj::fwd(func), kj::fwd(params)...); -} - -template struct TupleSize_ { static constexpr size_t size = 1; }; -template struct TupleSize_<_::Tuple> { - static constexpr size_t size = sizeof...(T); -}; - -template -constexpr size_t tupleSize() { return TupleSize_::size; } -// Returns size of the tuple T. - -} // namespace kj - -#endif // KJ_TUPLE_H_ diff --git a/external/capnp/include/kj/units.h b/external/capnp/include/kj/units.h deleted file mode 100644 index 8bba40338b..0000000000 --- a/external/capnp/include/kj/units.h +++ /dev/null @@ -1,1172 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef KJ_UNITS_H_ -#define KJ_UNITS_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include - -namespace kj { - -// ======================================================================================= -// IDs - -template -struct Id { - // A type-safe numeric ID. `UnderlyingType` is the underlying integer representation. `Label` - // distinguishes this Id from other Id types. Sample usage: - // - // class Foo; - // typedef Id FooId; - // - // class Bar; - // typedef Id BarId; - // - // You can now use the FooId and BarId types without any possibility of accidentally using a - // FooId when you really wanted a BarId or vice-versa. - - UnderlyingType value; - - inline constexpr Id(): value(0) {} - inline constexpr explicit Id(int value): value(value) {} - - inline constexpr bool operator==(const Id& other) const { return value == other.value; } - inline constexpr bool operator!=(const Id& other) const { return value != other.value; } - inline constexpr bool operator<=(const Id& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Id& other) const { return value >= other.value; } - inline constexpr bool operator< (const Id& other) const { return value < other.value; } - inline constexpr bool operator> (const Id& other) const { return value > other.value; } -}; - -// ======================================================================================= -// Quantity and UnitRatio -- implement unit analysis via the type system - -struct Unsafe_ {}; -constexpr Unsafe_ unsafe = Unsafe_(); -// Use as a parameter to constructors that are unsafe to indicate that you really do mean it. - -template -class Bounded; -template -class BoundedConst; - -template constexpr bool isIntegral() { return false; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } - -template -struct IsIntegralOrBounded_ { static constexpr bool value = isIntegral(); }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; - -template -inline constexpr bool isIntegralOrBounded() { return IsIntegralOrBounded_::value; } - -template -class UnitRatio { - // A multiplier used to convert Quantities of one unit to Quantities of another unit. See - // Quantity, below. - // - // Construct this type by dividing one Quantity by another of a different unit. Use this type - // by multiplying it by a Quantity, or dividing a Quantity by it. - - static_assert(isIntegralOrBounded(), - "Underlying type for UnitRatio must be integer."); - -public: - inline UnitRatio() {} - - constexpr UnitRatio(Number unit1PerUnit2, decltype(unsafe)): unit1PerUnit2(unit1PerUnit2) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr UnitRatio(const UnitRatio& other) - : unit1PerUnit2(other.unit1PerUnit2) {} - - template - inline constexpr UnitRatio - operator+(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 + other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator-(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 - other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U3 / U1 = U3 / U2 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U2 / U3 = U1 / U3 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U1 / U3) = U3 / U2 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U3 / U2) = U1 / U3 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - - template - inline decltype(Number() / OtherNumber()) - operator/(UnitRatio other) const { - return unit1PerUnit2 / other.unit1PerUnit2; - } - - inline bool operator==(UnitRatio other) const { return unit1PerUnit2 == other.unit1PerUnit2; } - inline bool operator!=(UnitRatio other) const { return unit1PerUnit2 != other.unit1PerUnit2; } - -private: - Number unit1PerUnit2; - - template - friend class Quantity; - template - friend class UnitRatio; - - template - friend inline constexpr UnitRatio - operator*(N1, UnitRatio); -}; - -template () && isIntegralOrBounded()>> -inline constexpr UnitRatio - operator*(N1 n, UnitRatio r) { - return UnitRatio(n * r.unit1PerUnit2, unsafe); -} - -template -class Quantity { - // A type-safe numeric quantity, specified in terms of some unit. Two Quantities cannot be used - // in arithmetic unless they use the same unit. The `Unit` type parameter is only used to prevent - // accidental mixing of units; this type is never instantiated and can very well be incomplete. - // `Number` is the underlying primitive numeric type. - // - // Quantities support most basic arithmetic operators, intelligently handling units, and - // automatically casting the underlying type in the same way that the compiler would. - // - // To convert a primitive number to a Quantity, multiply it by unit>(). - // To convert a Quantity to a primitive number, divide it by unit>(). - // To convert a Quantity of one unit to another unit, multiply or divide by a UnitRatio. - // - // The Quantity class is not well-suited to hardcore physics as it does not allow multiplying - // one quantity by another. For example, multiplying meters by meters won't get you square - // meters; it will get you a compiler error. It would be interesting to see if template - // metaprogramming could properly deal with such things but this isn't needed for the present - // use case. - // - // Sample usage: - // - // class SecondsLabel; - // typedef Quantity Seconds; - // constexpr Seconds SECONDS = unit(); - // - // class MinutesLabel; - // typedef Quantity Minutes; - // constexpr Minutes MINUTES = unit(); - // - // constexpr UnitRatio SECONDS_PER_MINUTE = - // 60 * SECONDS / MINUTES; - // - // void waitFor(Seconds seconds) { - // sleep(seconds / SECONDS); - // } - // void waitFor(Minutes minutes) { - // waitFor(minutes * SECONDS_PER_MINUTE); - // } - // - // void waitThreeMinutes() { - // waitFor(3 * MINUTES); - // } - - static_assert(isIntegralOrBounded(), - "Underlying type for Quantity must be integer."); - -public: - inline constexpr Quantity() = default; - - inline constexpr Quantity(MaxValue_): value(maxValue) {} - inline constexpr Quantity(MinValue_): value(minValue) {} - // Allow initialization from maxValue and minValue. - // TODO(msvc): decltype(maxValue) and decltype(minValue) deduce unknown-type for these function - // parameters, causing the compiler to complain of a duplicate constructor definition, so we - // specify MaxValue_ and MinValue_ types explicitly. - - inline constexpr Quantity(Number value, decltype(unsafe)): value(value) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr Quantity(const Quantity& other) - : value(other.value) {} - - template - inline Quantity& operator=(const Quantity& other) { - value = other.value; - return *this; - } - - template - inline constexpr Quantity - operator+(const Quantity& other) const { - return Quantity(value + other.value, unsafe); - } - template - inline constexpr Quantity - operator-(const Quantity& other) const { - return Quantity(value - other.value, unsafe); - } - template ()>> - inline constexpr Quantity - operator*(OtherNumber other) const { - return Quantity(value * other, unsafe); - } - template ()>> - inline constexpr Quantity - operator/(OtherNumber other) const { - return Quantity(value / other, unsafe); - } - template - inline constexpr decltype(Number() / OtherNumber()) - operator/(const Quantity& other) const { - return value / other.value; - } - template - inline constexpr Quantity - operator%(const Quantity& other) const { - return Quantity(value % other.value, unsafe); - } - - template - inline constexpr Quantity - operator*(UnitRatio ratio) const { - return Quantity( - value * ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator/(UnitRatio ratio) const { - return Quantity( - value / ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator%(UnitRatio ratio) const { - return Quantity( - value % ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(Quantity other) const { - return UnitRatio( - value / other.value, unsafe); - } - - template - inline constexpr bool operator==(const Quantity& other) const { - return value == other.value; - } - template - inline constexpr bool operator!=(const Quantity& other) const { - return value != other.value; - } - template - inline constexpr bool operator<=(const Quantity& other) const { - return value <= other.value; - } - template - inline constexpr bool operator>=(const Quantity& other) const { - return value >= other.value; - } - template - inline constexpr bool operator<(const Quantity& other) const { - return value < other.value; - } - template - inline constexpr bool operator>(const Quantity& other) const { - return value > other.value; - } - - template - inline Quantity& operator+=(const Quantity& other) { - value += other.value; - return *this; - } - template - inline Quantity& operator-=(const Quantity& other) { - value -= other.value; - return *this; - } - template - inline Quantity& operator*=(OtherNumber other) { - value *= other; - return *this; - } - template - inline Quantity& operator/=(OtherNumber other) { - value /= other.value; - return *this; - } - -private: - Number value; - - template - friend class Quantity; - - template - friend inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity; -}; - -template struct Unit_ { - static inline constexpr T get() { return T(1); } -}; -template -struct Unit_> { - static inline constexpr Quantity::get()), U> get() { - return Quantity::get()), U>(Unit_::get(), unsafe); - } -}; - -template -inline constexpr auto unit() -> decltype(Unit_::get()) { return Unit_::get(); } -// unit>() returns a Quantity of value 1. It also, intentionally, works on basic -// numeric types. - -template -inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity { - return Quantity(a * b.value, unsafe); -} - -template -inline constexpr auto operator*(UnitRatio ratio, - Quantity measure) - -> decltype(measure * ratio) { - return measure * ratio; -} - -// ======================================================================================= -// Absolute measures - -template -class Absolute { - // Wraps some other value -- typically a Quantity -- but represents a value measured based on - // some absolute origin. For example, if `Duration` is a type representing a time duration, - // Absolute might be a calendar date. - // - // Since Absolute represents measurements relative to some arbitrary origin, the only sensible - // arithmetic to perform on them is addition and subtraction. - - // TODO(someday): Do the same automatic expansion of integer width that Quantity does? Doesn't - // matter for our time use case, where we always use 64-bit anyway. Note that fixing this - // would implicitly allow things like multiplying an Absolute by a UnitRatio to change its - // units, which is actually totally logical and kind of neat. - -public: - inline constexpr Absolute operator+(const T& other) const { return Absolute(value + other); } - inline constexpr Absolute operator-(const T& other) const { return Absolute(value - other); } - inline constexpr T operator-(const Absolute& other) const { return value - other.value; } - - inline Absolute& operator+=(const T& other) { value += other; return *this; } - inline Absolute& operator-=(const T& other) { value -= other; return *this; } - - inline constexpr bool operator==(const Absolute& other) const { return value == other.value; } - inline constexpr bool operator!=(const Absolute& other) const { return value != other.value; } - inline constexpr bool operator<=(const Absolute& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Absolute& other) const { return value >= other.value; } - inline constexpr bool operator< (const Absolute& other) const { return value < other.value; } - inline constexpr bool operator> (const Absolute& other) const { return value > other.value; } - -private: - T value; - - explicit constexpr Absolute(T value): value(value) {} - - template - friend inline constexpr U origin(); -}; - -template -inline constexpr Absolute operator+(const T& a, const Absolute& b) { - return b + a; -} - -template struct UnitOf_ { typedef T Type; }; -template struct UnitOf_> { typedef T Type; }; -template -using UnitOf = typename UnitOf_::Type; -// UnitOf> is T. UnitOf is AnythingElse. - -template -inline constexpr T origin() { return T(0 * unit>()); } -// origin>() returns an Absolute of value 0. It also, intentionally, works on basic -// numeric types. - -// ======================================================================================= -// Overflow avoidance - -template -struct BitCount_ { - static constexpr uint value = BitCount_<(n >> 1), accum + 1>::value; -}; -template -struct BitCount_<0, accum> { - static constexpr uint value = accum; -}; - -template -inline constexpr uint bitCount() { return BitCount_::value; } -// Number of bits required to represent the number `n`. - -template struct AtLeastUInt_ { - static_assert(bitCountBitCount < 7, "don't know how to represent integers over 64 bits"); -}; -template <> struct AtLeastUInt_<0> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<1> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<2> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<3> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<4> { typedef uint16_t Type; }; -template <> struct AtLeastUInt_<5> { typedef uint32_t Type; }; -template <> struct AtLeastUInt_<6> { typedef uint64_t Type; }; - -template -using AtLeastUInt = typename AtLeastUInt_()>::Type; -// AtLeastUInt is an unsigned integer of at least n bits. E.g. AtLeastUInt<12> is uint16_t. - -// ------------------------------------------------------------------- - -template -class BoundedConst { - // A constant integer value on which we can do bit size analysis. - -public: - BoundedConst() = default; - - inline constexpr uint unwrap() const { return value; } - -#define OP(op, check) \ - template \ - inline constexpr BoundedConst<(value op other)> \ - operator op(BoundedConst) const { \ - static_assert(check, "overflow in BoundedConst arithmetic"); \ - return BoundedConst<(value op other)>(); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(BoundedConst) const { \ - return value op other; \ - } - - OP(+, value + other >= value) - OP(-, value - other <= value) - OP(*, value * other / other == value) - OP(/, true) // div by zero already errors out; no other division ever overflows - OP(%, true) // mod by zero already errors out; no other modulus ever overflows - OP(<<, value << other >= value) - OP(>>, true) // right shift can't overflow - OP(&, true) // bitwise ops can't overflow - OP(|, true) // bitwise ops can't overflow - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) -#undef OP -#undef COMPARE_OP -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -inline constexpr BoundedConst bounded() { - return BoundedConst(); -} - -template -static constexpr uint64_t boundedAdd() { - static_assert(a + b >= a, "possible overflow detected"); - return a + b; -} -template -static constexpr uint64_t boundedSub() { - static_assert(a - b <= a, "possible underflow detected"); - return a - b; -} -template -static constexpr uint64_t boundedMul() { - static_assert(a * b / b == a, "possible overflow detected"); - return a * b; -} -template -static constexpr uint64_t boundedLShift() { - static_assert(a << b >= a, "possible overflow detected"); - return a << b; -} - -template -inline constexpr BoundedConst min(BoundedConst, BoundedConst) { - return bounded(); -} -template -inline constexpr BoundedConst max(BoundedConst, BoundedConst) { - return bounded(); -} -// We need to override min() and max() between constants because the ternary operator in the -// default implementation would complain. - -// ------------------------------------------------------------------- - -template -class Bounded { -public: - static_assert(maxN <= T(kj::maxValue), "possible overflow detected"); - - Bounded() = default; - - Bounded(const Bounded& other) = default; - template ()>> - inline constexpr Bounded(OtherInt value): value(value) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(const Bounded& other) - : value(other.value) { - static_assert(otherMax <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(BoundedConst) - : value(otherValue) { - static_assert(otherValue <= maxN, "overflow detected"); - } - - Bounded& operator=(const Bounded& other) = default; - template ()>> - Bounded& operator=(OtherInt other) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - value = other; - return *this; - } - template - inline Bounded& operator=(const Bounded& other) { - static_assert(otherMax <= maxN, "possible overflow detected"); - value = other.value; - return *this; - } - template - inline Bounded& operator=(BoundedConst) { - static_assert(otherValue <= maxN, "overflow detected"); - value = otherValue; - return *this; - } - - inline constexpr T unwrap() const { return value; } - -#define OP(op, newMax) \ - template \ - inline constexpr Bounded \ - operator op(const Bounded& other) const { \ - return Bounded(value op other.value, unsafe); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(const Bounded& other) const { \ - return value op other.value; \ - } - - OP(+, (boundedAdd())) - OP(*, (boundedMul())) - OP(/, maxN) - OP(%, otherMax - 1) - - // operator- is intentionally omitted because we mostly use this with unsigned types, and - // subtraction requires proof that subtrahend is not greater than the minuend. - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) - -#undef OP -#undef COMPARE_OP - - template - inline Bounded assertMax(ErrorFunc&& func) const { - // Assert that the number is no more than `newMax`. Otherwise, call `func`. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - if (KJ_UNLIKELY(value > newMax)) func(); - return Bounded(value, unsafe); - } - - template - inline Bounded subtractChecked( - const Bounded& other, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - if (KJ_UNLIKELY(value < other.value)) func(); - return Bounded(value - other.value, unsafe); - } - - template - inline Bounded subtractChecked( - BoundedConst, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - static_assert(otherValue <= maxN, "underflow detected"); - if (KJ_UNLIKELY(value < otherValue)) func(); - return Bounded(value - otherValue, unsafe); - } - - template - inline Maybe> trySubtract( - const Bounded& other) const { - // Subtract a number, calling func() if the result would underflow. - if (value < other.value) { - return nullptr; - } else { - return Bounded(value - other.value, unsafe); - } - } - - template - inline Maybe> trySubtract(BoundedConst) const { - // Subtract a number, calling func() if the result would underflow. - if (value < otherValue) { - return nullptr; - } else { - return Bounded(value - otherValue, unsafe); - } - } - - inline constexpr Bounded(T value, decltype(unsafe)): value(value) {} - template - inline constexpr Bounded(Bounded value, decltype(unsafe)) - : value(value.value) {} - // Mainly for internal use. - // - // Only use these as a last resort, with ample commentary on why you think it's safe. - -private: - T value; - - template - friend class Bounded; -}; - -template -inline constexpr Bounded bounded(Number value) { - return Bounded(value, unsafe); -} - -inline constexpr Bounded<1, uint8_t> bounded(bool value) { - return Bounded<1, uint8_t>(value, unsafe); -} - -template -inline constexpr Bounded(), Number> assumeBits(Number value) { - return Bounded(), Number>(value, unsafe); -} - -template -inline constexpr Bounded(), T> assumeBits(Bounded value) { - return Bounded(), T>(value, unsafe); -} - -template -inline constexpr auto assumeBits(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeBits(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(Number value) { - return Bounded(value, unsafe); -} - -template -inline constexpr Bounded assumeMax(Bounded value) { - return Bounded(value, unsafe); -} - -template -inline constexpr auto assumeMax(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeMax(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Number value) { - return assumeMax(value); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Bounded value) { - return assumeMax(value); -} - -template -inline constexpr auto assumeMax(Quantity, Unit>, Quantity value) - -> decltype(assumeMax(value)) { - return assumeMax(value); -} - -template -inline Bounded assertMax(Bounded value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return value.template assertMax(kj::fwd(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit> value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return (value / unit()).template assertMax( - kj::fwd(errorFunc)) * unit(); -} - -template -inline Bounded assertMax( - BoundedConst, Bounded value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit>, - Quantity, Unit> value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Bounded(), T> assertMaxBits( - Bounded value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline Quantity(), T>, Unit> assertMaxBits( - Quantity, Unit> value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline constexpr Bounded upgradeBound(Bounded value) { - return value; -} - -template -inline constexpr Quantity, Unit> upgradeBound( - Quantity, Unit> value) { - return value; -} - -template -inline auto subtractChecked(Bounded value, Other other, ErrorFunc&& errorFunc) - -> decltype(value.subtractChecked(other, kj::fwd(errorFunc))) { - return value.subtractChecked(other, kj::fwd(errorFunc)); -} - -template -inline auto subtractChecked(Quantity value, Quantity other, ErrorFunc&& errorFunc) - -> Quantity(errorFunc))), Unit> { - return subtractChecked(value / unit>(), - other / unit>(), - kj::fwd(errorFunc)) - * unit>(); -} - -template -inline auto trySubtract(Bounded value, Other other) - -> decltype(value.trySubtract(other)) { - return value.trySubtract(other); -} - -template -inline auto trySubtract(Quantity value, Quantity other) - -> Maybe> { - return trySubtract(value / unit>(), - other / unit>()) - .map([](decltype(subtractChecked(T(), U(), int())) x) { - return x * unit>(); - }); -} - -template -inline constexpr Bounded> -min(Bounded a, Bounded b) { - return Bounded>(kj::min(a.unwrap(), b.unwrap()), unsafe); -} -template -inline constexpr Bounded> -max(Bounded a, Bounded b) { - return Bounded>(kj::max(a.unwrap(), b.unwrap()), unsafe); -} -// We need to override min() and max() because: -// 1) WiderType<> might not choose the correct bounds. -// 2) One of the two sides of the ternary operator in the default implementation would fail to -// typecheck even though it is OK in practice. - -// ------------------------------------------------------------------- -// Operators between Bounded and BoundedConst - -#define OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(T() op uint())> operator op( \ - Bounded value, BoundedConst) { \ - return Bounded<(newMax), decltype(T() op uint())>(value.unwrap() op cvalue, unsafe); \ -} - -#define REVERSE_OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(uint() op T())> operator op( \ - BoundedConst, Bounded value) { \ - return Bounded<(newMax), decltype(uint() op T())>(cvalue op value.unwrap(), unsafe); \ -} - -#define COMPARE_OP(op) \ -template \ -inline constexpr bool operator op(Bounded value, BoundedConst) { \ - return value.unwrap() op cvalue; \ -} \ -template \ -inline constexpr bool operator op(BoundedConst, Bounded value) { \ - return cvalue op value.unwrap(); \ -} - -OP(+, (boundedAdd())) -REVERSE_OP(+, (boundedAdd())) - -OP(*, (boundedMul())) -REVERSE_OP(*, (boundedAdd())) - -OP(/, maxN / cvalue) -REVERSE_OP(/, cvalue) // denominator could be 1 - -OP(%, cvalue - 1) -REVERSE_OP(%, maxN - 1) - -OP(<<, (boundedLShift())) -REVERSE_OP(<<, (boundedLShift())) - -OP(>>, maxN >> cvalue) -REVERSE_OP(>>, cvalue >> maxN) - -OP(&, maxValueForBits()>() & cvalue) -REVERSE_OP(&, maxValueForBits()>() & cvalue) - -OP(|, maxN | cvalue) -REVERSE_OP(|, maxN | cvalue) - -COMPARE_OP(==) -COMPARE_OP(!=) -COMPARE_OP(< ) -COMPARE_OP(> ) -COMPARE_OP(<=) -COMPARE_OP(>=) - -#undef OP -#undef REVERSE_OP -#undef COMPARE_OP - -template -inline constexpr Bounded - operator-(BoundedConst, Bounded value) { - // We allow subtraction of a variable from a constant only if the constant is greater than or - // equal to the maximum possible value of the variable. Since the variable could be zero, the - // result can be as large as the constant. - // - // We do not allow subtraction of a constant from a variable because there's never a guarantee it - // won't underflow (unless the constant is zero, which is silly). - static_assert(cvalue >= maxN, "possible underflow detected"); - return Bounded(cvalue - value.unwrap(), unsafe); -} - -template -inline constexpr Bounded min(Bounded a, BoundedConst) { - return Bounded(kj::min(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded min(BoundedConst, Bounded a) { - return Bounded(kj::min(a.unwrap(), b), unsafe); -} -template -inline constexpr Bounded max(Bounded a, BoundedConst) { - return Bounded(kj::max(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded max(BoundedConst, Bounded a) { - return Bounded(kj::max(a.unwrap(), b), unsafe); -} -// We need to override min() between a Bounded and a constant since: -// 1) WiderType<> might choose BoundedConst over a 1-byte Bounded, which is wrong. -// 2) To clamp the bounds of the output type. -// 3) Same ternary operator typechecking issues. - -// ------------------------------------------------------------------- - -template -class SafeUnwrapper { -public: - inline explicit constexpr SafeUnwrapper(Bounded value): value(value.unwrap()) {} - - template ()>> - inline constexpr operator U() const { - static_assert(maxN <= U(maxValue), "possible truncation detected"); - return value; - } - - inline constexpr operator bool() const { - static_assert(maxN <= 1, "possible truncation detected"); - return value; - } - -private: - T value; -}; - -template -inline constexpr SafeUnwrapper unbound(Bounded bounded) { - // Unwraps the bounded value, returning a value that can be implicitly cast to any integer type. - // If this implicit cast could truncate, a compile-time error will be raised. - return SafeUnwrapper(bounded); -} - -template -class SafeConstUnwrapper { -public: - template ()>> - inline constexpr operator T() const { - static_assert(value <= T(maxValue), "this operation will truncate"); - return value; - } - - inline constexpr operator bool() const { - static_assert(value <= 1, "this operation will truncate"); - return value; - } -}; - -template -inline constexpr SafeConstUnwrapper unbound(BoundedConst) { - return SafeConstUnwrapper(); -} - -template -inline constexpr T unboundAs(U value) { - return unbound(value); -} - -template -inline constexpr T unboundMax(Bounded value) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(maxN <= requestedMax, "possible overflow detected"); - return value.unwrap(); -} - -template -inline constexpr uint unboundMax(BoundedConst) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(value <= requestedMax, "overflow detected"); - return value; -} - -template -inline constexpr auto unboundMaxBits(T value) -> - decltype(unboundMax()>(value)) { - // Explicitly ungaurd expecting a value that fits into `bits` bits. - return unboundMax()>(value); -} - -#define OP(op) \ -template \ -inline constexpr auto operator op(T a, SafeUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} \ -template \ -inline constexpr auto operator op(T a, SafeConstUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeConstUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} - -OP(+) -OP(-) -OP(*) -OP(/) -OP(%) -OP(<<) -OP(>>) -OP(&) -OP(|) -OP(==) -OP(!=) -OP(<=) -OP(>=) -OP(<) -OP(>) - -#undef OP - -// ------------------------------------------------------------------- - -template -class Range> { -public: - inline constexpr Range(Bounded begin, Bounded end) - : inner(unbound(begin), unbound(end)) {} - inline explicit constexpr Range(Bounded end) - : inner(unbound(end)) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Bounded operator* () const { return Bounded(*inner, unsafe); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -class Range> { -public: - inline constexpr Range(Quantity begin, Quantity end) - : inner(begin / unit>(), end / unit>()) {} - inline explicit constexpr Range(Quantity end) - : inner(end / unit>()) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Quantity operator* () const { return *inner * unit>(); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -inline constexpr Range> zeroTo(BoundedConst end) { - return Range>(end); -} - -template -inline constexpr Range, Unit>> - zeroTo(Quantity, Unit> end) { - return Range, Unit>>(end); -} - -} // namespace kj - -#endif // KJ_UNITS_H_ diff --git a/external/capnp/include/kj/vector.h b/external/capnp/include/kj/vector.h deleted file mode 100644 index 44613f3331..0000000000 --- a/external/capnp/include/kj/vector.h +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_VECTOR_H_ -#define KJ_VECTOR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" - -namespace kj { - -template -class Vector { - // Similar to std::vector, but based on KJ framework. - // - // This implementation always uses move constructors when growing the backing array. If the - // move constructor throws, the Vector is left in an inconsistent state. This is acceptable - // under KJ exception theory which assumes that exceptions leave things in inconsistent states. - - // TODO(someday): Allow specifying a custom allocator. - -public: - inline Vector() = default; - inline explicit Vector(size_t capacity): builder(heapArrayBuilder(capacity)) {} - - inline operator ArrayPtr() { return builder; } - inline operator ArrayPtr() const { return builder; } - inline ArrayPtr asPtr() { return builder.asPtr(); } - inline ArrayPtr asPtr() const { return builder.asPtr(); } - - inline size_t size() const { return builder.size(); } - inline bool empty() const { return size() == 0; } - inline size_t capacity() const { return builder.capacity(); } - inline T& operator[](size_t index) const { return builder[index]; } - - inline const T* begin() const { return builder.begin(); } - inline const T* end() const { return builder.end(); } - inline const T& front() const { return builder.front(); } - inline const T& back() const { return builder.back(); } - inline T* begin() { return builder.begin(); } - inline T* end() { return builder.end(); } - inline T& front() { return builder.front(); } - inline T& back() { return builder.back(); } - - inline Array releaseAsArray() { - // TODO(perf): Avoid a copy/move by allowing Array to point to incomplete space? - if (!builder.isFull()) { - setCapacity(size()); - } - return builder.finish(); - } - - template - inline T& add(Params&&... params) { - if (builder.isFull()) grow(); - return builder.add(kj::fwd(params)...); - } - - template - inline void addAll(Iterator begin, Iterator end) { - size_t needed = builder.size() + (end - begin); - if (needed > builder.capacity()) grow(needed); - builder.addAll(begin, end); - } - - template - inline void addAll(Container&& container) { - addAll(container.begin(), container.end()); - } - - inline void removeLast() { - builder.removeLast(); - } - - inline void resize(size_t size) { - if (size > builder.capacity()) grow(size); - builder.resize(size); - } - - inline void operator=(decltype(nullptr)) { - builder = nullptr; - } - - inline void clear() { - while (builder.size() > 0) { - builder.removeLast(); - } - } - - inline void truncate(size_t size) { - builder.truncate(size); - } - - inline void reserve(size_t size) { - if (size > builder.capacity()) { - setCapacity(size); - } - } - -private: - ArrayBuilder builder; - - void grow(size_t minCapacity = 0) { - setCapacity(kj::max(minCapacity, capacity() == 0 ? 4 : capacity() * 2)); - } - void setCapacity(size_t newSize) { - if (builder.size() > newSize) { - builder.truncate(newSize); - } - ArrayBuilder newBuilder = heapArrayBuilder(newSize); - newBuilder.addAll(kj::mv(builder)); - builder = kj::mv(newBuilder); - } -}; - -template -inline auto KJ_STRINGIFY(const Vector& v) -> decltype(toCharSequence(v.asPtr())) { - return toCharSequence(v.asPtr()); -} - -} // namespace kj - -#endif // KJ_VECTOR_H_ diff --git a/external/capnp/include/kj/windows-sanity.h b/external/capnp/include/kj/windows-sanity.h deleted file mode 100644 index 766ba2cbd6..0000000000 --- a/external/capnp/include/kj/windows-sanity.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_WINDOWS_SANITY_H_ -#define KJ_WINDOWS_SANITY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef _INC_WINDOWS -#error "windows.h needs to be included before kj/windows-sanity.h (or perhaps you don't need either?)" -#endif - -namespace win32 { - const auto ERROR_ = ERROR; -#undef ERROR - const auto ERROR = ERROR_; -} - -using win32::ERROR; - -#endif // KJ_WINDOWS_SANITY_H_ diff --git a/external/capnp/lib/libcapnp-json.la b/external/capnp/lib/libcapnp-json.la deleted file mode 100755 index a2f39be5da..0000000000 --- a/external/capnp/lib/libcapnp-json.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-json.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-json-0.6.1.so' - -# Names of this library. -library_names='libcapnp-json-0.6.1.so libcapnp-json-0.6.1.so libcapnp-json.so' - -# The name of the static archive. -old_library='libcapnp-json.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libcapnp.la /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-json. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libcapnp-rpc.la b/external/capnp/lib/libcapnp-rpc.la deleted file mode 100755 index e8663acf6b..0000000000 --- a/external/capnp/lib/libcapnp-rpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-rpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-rpc-0.6.1.so' - -# Names of this library. -library_names='libcapnp-rpc-0.6.1.so libcapnp-rpc-0.6.1.so libcapnp-rpc.so' - -# The name of the static archive. -old_library='libcapnp-rpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libcapnp.la /home/batman/openpilot/external/capnp/lib/libkj-async.la /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-rpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libcapnp.la b/external/capnp/lib/libcapnp.la deleted file mode 100755 index 4c9994cdc3..0000000000 --- a/external/capnp/lib/libcapnp.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-0.6.1.so' - -# Names of this library. -library_names='libcapnp-0.6.1.so libcapnp-0.6.1.so libcapnp.so' - -# The name of the static archive. -old_library='libcapnp.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libcapnp_c.la b/external/capnp/lib/libcapnp_c.la deleted file mode 100755 index 63b4e8ae50..0000000000 --- a/external/capnp/lib/libcapnp_c.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp_c.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp_c.so.0' - -# Names of this library. -library_names='libcapnp_c.so.0.0.0 libcapnp_c.so.0 libcapnp_c.so' - -# The name of the static archive. -old_library='libcapnp_c.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs='' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp_c. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libcapnp_c.so.0 b/external/capnp/lib/libcapnp_c.so.0 deleted file mode 120000 index 5ff443389f..0000000000 --- a/external/capnp/lib/libcapnp_c.so.0 +++ /dev/null @@ -1 +0,0 @@ -libcapnp_c.so.0.0.0 \ No newline at end of file diff --git a/external/capnp/lib/libcapnp_c.so.0.0.0 b/external/capnp/lib/libcapnp_c.so.0.0.0 deleted file mode 100755 index 84e988cce9..0000000000 Binary files a/external/capnp/lib/libcapnp_c.so.0.0.0 and /dev/null differ diff --git a/external/capnp/lib/libcapnpc.la b/external/capnp/lib/libcapnpc.la deleted file mode 100755 index 20d76c0ef1..0000000000 --- a/external/capnp/lib/libcapnpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnpc-0.6.1.so' - -# Names of this library. -library_names='libcapnpc-0.6.1.so libcapnpc-0.6.1.so libcapnpc.so' - -# The name of the static archive. -old_library='libcapnpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libcapnp.la /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libkj-async.la b/external/capnp/lib/libkj-async.la deleted file mode 100755 index 1cf17b207d..0000000000 --- a/external/capnp/lib/libkj-async.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-async.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-async-0.6.1.so' - -# Names of this library. -library_names='libkj-async-0.6.1.so libkj-async-0.6.1.so libkj-async.so' - -# The name of the static archive. -old_library='libkj-async.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-async. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libkj-http.la b/external/capnp/lib/libkj-http.la deleted file mode 100755 index 1782d99832..0000000000 --- a/external/capnp/lib/libkj-http.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-http.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-http-0.6.1.so' - -# Names of this library. -library_names='libkj-http-0.6.1.so libkj-http-0.6.1.so libkj-http.so' - -# The name of the static archive. -old_library='libkj-http.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libkj-async.la /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-http. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libkj-test.la b/external/capnp/lib/libkj-test.la deleted file mode 100755 index 7dbb7d05e2..0000000000 --- a/external/capnp/lib/libkj-test.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-test.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-test-0.6.1.so' - -# Names of this library. -library_names='libkj-test-0.6.1.so libkj-test-0.6.1.so libkj-test.so' - -# The name of the static archive. -old_library='libkj-test.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/openpilot/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-test. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/libkj.la b/external/capnp/lib/libkj.la deleted file mode 100755 index 65365b6074..0000000000 --- a/external/capnp/lib/libkj.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-0.6.1.so' - -# Names of this library. -library_names='libkj-0.6.1.so libkj-0.6.1.so libkj.so' - -# The name of the static archive. -old_library='libkj.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/openpilot/external/capnp/lib' diff --git a/external/capnp/lib/pkgconfig/c-capnproto.pc b/external/capnp/lib/pkgconfig/c-capnproto.pc deleted file mode 100644 index c88d61acd4..0000000000 --- a/external/capnp/lib/pkgconfig/c-capnproto.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/batman/openpilot/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -bindir=${exec_prefix}/bin -includedir=${prefix}/include -codegen=${bindir}/capnpc-c - -Name: c-capnproto -Description: Cap'n Proto C bindings -Version: 0.2 -Libs: -L${libdir} -lcapnp_c -Cflags: -I${includedir} diff --git a/external/capnp/lib/pkgconfig/capnp-rpc.pc b/external/capnp/lib/pkgconfig/capnp-rpc.pc deleted file mode 100644 index 395289679a..0000000000 --- a/external/capnp/lib/pkgconfig/capnp-rpc.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/batman/openpilot/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto RPC -Description: Fast object-oriented RPC system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp-rpc -Requires: capnp = 0.6.1 kj-async = 0.6.1 -Cflags: -I${includedir} diff --git a/external/capnp/lib/pkgconfig/capnp.pc b/external/capnp/lib/pkgconfig/capnp.pc deleted file mode 100644 index 72d5b5c575..0000000000 --- a/external/capnp/lib/pkgconfig/capnp.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/batman/openpilot/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto -Description: Insanely fast serialization system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp -pthread -lpthread -Libs.private: -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/external/capnp/lib/pkgconfig/kj-async.pc b/external/capnp/lib/pkgconfig/kj-async.pc deleted file mode 100644 index 9b42a10a30..0000000000 --- a/external/capnp/lib/pkgconfig/kj-async.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/batman/openpilot/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Async Framework Library -Description: Basic utility library called KJ (async part) -Version: 0.6.1 -Libs: -L${libdir} -lkj-async -pthread -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/external/capnp/lib/pkgconfig/kj.pc b/external/capnp/lib/pkgconfig/kj.pc deleted file mode 100644 index 106c1f2054..0000000000 --- a/external/capnp/lib/pkgconfig/kj.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/batman/openpilot/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Framework Library -Description: Basic utility library called KJ -Version: 0.6.1 -Libs: -L${libdir} -lkj -pthread -lpthread -Cflags: -I${includedir} -pthread diff --git a/external/capnparm/.gitignore b/external/capnparm/.gitignore deleted file mode 100644 index 30acc8dd7a..0000000000 --- a/external/capnparm/.gitignore +++ /dev/null @@ -1 +0,0 @@ -capnproto-c++-0.6.1* diff --git a/external/capnparm/bin/capnp b/external/capnparm/bin/capnp deleted file mode 100755 index 1d63a895f7..0000000000 Binary files a/external/capnparm/bin/capnp and /dev/null differ diff --git a/external/capnparm/bin/capnpc b/external/capnparm/bin/capnpc deleted file mode 120000 index 5668473f09..0000000000 --- a/external/capnparm/bin/capnpc +++ /dev/null @@ -1 +0,0 @@ -capnp \ No newline at end of file diff --git a/external/capnparm/bin/capnpc-c b/external/capnparm/bin/capnpc-c deleted file mode 100755 index cc88361259..0000000000 Binary files a/external/capnparm/bin/capnpc-c and /dev/null differ diff --git a/external/capnparm/bin/capnpc-c++ b/external/capnparm/bin/capnpc-c++ deleted file mode 100755 index f630a58ed8..0000000000 Binary files a/external/capnparm/bin/capnpc-c++ and /dev/null differ diff --git a/external/capnparm/bin/capnpc-capnp b/external/capnparm/bin/capnpc-capnp deleted file mode 100755 index 4cb7443263..0000000000 Binary files a/external/capnparm/bin/capnpc-capnp and /dev/null differ diff --git a/external/capnparm/bin/capnpc-java b/external/capnparm/bin/capnpc-java deleted file mode 100755 index a81a7ea59e..0000000000 Binary files a/external/capnparm/bin/capnpc-java and /dev/null differ diff --git a/external/capnparm/build.sh b/external/capnparm/build.sh deleted file mode 100755 index 3fbdebbcc7..0000000000 --- a/external/capnparm/build.sh +++ /dev/null @@ -1,32 +0,0 @@ -set -e -echo "Installing capnp" - -ONE=${HOME}/openpilot -VERSION=0.6.1 -wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz -tar xvf capnproto-c++-${VERSION}.tar.gz -cd capnproto-c++-${VERSION} -CXXFLAGS="-fPIC" ./configure --prefix=${ONE}/external/capnparm -make -j9 - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - - -make -j4 install - -# -------- -echo "Installing java-capnp" - -git clone https://github.com/dwrensha/capnproto-java.git -cd capnproto-java -git reset --hard 2c43bd712fb218da0eabdf241a750b9c05903e8e -g++ compiler/src/main/cpp/capnpc-java.c++ -std=c++11 -pthread -I${ONE}/external/capnp/include -L${ONE}/external/capnp/lib -l:libcapnp.a -l:libkj.a -pthread -lpthread -o capnpc-java -cp capnpc-java ${ONE}/external/capnp/bin/ - -rm -rf capnproto-c++-${VERSION}.tar.gz -rm -rf capnproto-c++-${VERSION} diff --git a/external/capnparm/include b/external/capnparm/include deleted file mode 120000 index dd0350f7d9..0000000000 --- a/external/capnparm/include +++ /dev/null @@ -1 +0,0 @@ -../capnp/include \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp-0.6.1.so b/external/capnparm/lib/libcapnp-0.6.1.so deleted file mode 100755 index b91dbfa096..0000000000 Binary files a/external/capnparm/lib/libcapnp-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libcapnp-json-0.6.1.so b/external/capnparm/lib/libcapnp-json-0.6.1.so deleted file mode 100755 index 2fcf1cce3c..0000000000 Binary files a/external/capnparm/lib/libcapnp-json-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libcapnp-json.a b/external/capnparm/lib/libcapnp-json.a deleted file mode 100644 index 0f2ea332ce..0000000000 Binary files a/external/capnparm/lib/libcapnp-json.a and /dev/null differ diff --git a/external/capnparm/lib/libcapnp-json.la b/external/capnparm/lib/libcapnp-json.la deleted file mode 100755 index 9ffd74a410..0000000000 --- a/external/capnparm/lib/libcapnp-json.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-json.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-json-0.6.1.so' - -# Names of this library. -library_names='libcapnp-json-0.6.1.so libcapnp-json-0.6.1.so libcapnp-json.so' - -# The name of the static archive. -old_library='libcapnp-json.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libcapnp.la /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-json. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libcapnp-json.so b/external/capnparm/lib/libcapnp-json.so deleted file mode 120000 index 439f29db8e..0000000000 --- a/external/capnparm/lib/libcapnp-json.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-json-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp-rpc-0.6.1.so b/external/capnparm/lib/libcapnp-rpc-0.6.1.so deleted file mode 100755 index 46b04fae73..0000000000 Binary files a/external/capnparm/lib/libcapnp-rpc-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libcapnp-rpc.a b/external/capnparm/lib/libcapnp-rpc.a deleted file mode 100644 index 2330258105..0000000000 Binary files a/external/capnparm/lib/libcapnp-rpc.a and /dev/null differ diff --git a/external/capnparm/lib/libcapnp-rpc.la b/external/capnparm/lib/libcapnp-rpc.la deleted file mode 100755 index ac7b61b67c..0000000000 --- a/external/capnparm/lib/libcapnp-rpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-rpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-rpc-0.6.1.so' - -# Names of this library. -library_names='libcapnp-rpc-0.6.1.so libcapnp-rpc-0.6.1.so libcapnp-rpc.so' - -# The name of the static archive. -old_library='libcapnp-rpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libcapnp.la /home/comma/openpilot/external/capnparm/lib/libkj-async.la /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-rpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libcapnp-rpc.so b/external/capnparm/lib/libcapnp-rpc.so deleted file mode 120000 index a4f0e19500..0000000000 --- a/external/capnparm/lib/libcapnp-rpc.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-rpc-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp.a b/external/capnparm/lib/libcapnp.a deleted file mode 100644 index 95122fd793..0000000000 Binary files a/external/capnparm/lib/libcapnp.a and /dev/null differ diff --git a/external/capnparm/lib/libcapnp.la b/external/capnparm/lib/libcapnp.la deleted file mode 100755 index 36e866c323..0000000000 --- a/external/capnparm/lib/libcapnp.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-0.6.1.so' - -# Names of this library. -library_names='libcapnp-0.6.1.so libcapnp-0.6.1.so libcapnp.so' - -# The name of the static archive. -old_library='libcapnp.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libcapnp.so b/external/capnparm/lib/libcapnp.so deleted file mode 120000 index a14cdcee7b..0000000000 --- a/external/capnparm/lib/libcapnp.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp_c.a b/external/capnparm/lib/libcapnp_c.a deleted file mode 100644 index 9f7ee7c0df..0000000000 Binary files a/external/capnparm/lib/libcapnp_c.a and /dev/null differ diff --git a/external/capnparm/lib/libcapnp_c.la b/external/capnparm/lib/libcapnp_c.la deleted file mode 100755 index 392aa7a2de..0000000000 --- a/external/capnparm/lib/libcapnp_c.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp_c.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp_c.so.0' - -# Names of this library. -library_names='libcapnp_c.so.0.0.0 libcapnp_c.so.0 libcapnp_c.so' - -# The name of the static archive. -old_library='libcapnp_c.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs='' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp_c. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libcapnp_c.so b/external/capnparm/lib/libcapnp_c.so deleted file mode 120000 index 5ff443389f..0000000000 --- a/external/capnparm/lib/libcapnp_c.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp_c.so.0.0.0 \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp_c.so.0 b/external/capnparm/lib/libcapnp_c.so.0 deleted file mode 120000 index 5ff443389f..0000000000 --- a/external/capnparm/lib/libcapnp_c.so.0 +++ /dev/null @@ -1 +0,0 @@ -libcapnp_c.so.0.0.0 \ No newline at end of file diff --git a/external/capnparm/lib/libcapnp_c.so.0.0.0 b/external/capnparm/lib/libcapnp_c.so.0.0.0 deleted file mode 100755 index b2b875ceca..0000000000 Binary files a/external/capnparm/lib/libcapnp_c.so.0.0.0 and /dev/null differ diff --git a/external/capnparm/lib/libcapnpc-0.6.1.so b/external/capnparm/lib/libcapnpc-0.6.1.so deleted file mode 100755 index 8438e824bb..0000000000 Binary files a/external/capnparm/lib/libcapnpc-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libcapnpc.a b/external/capnparm/lib/libcapnpc.a deleted file mode 100644 index 8257774180..0000000000 Binary files a/external/capnparm/lib/libcapnpc.a and /dev/null differ diff --git a/external/capnparm/lib/libcapnpc.la b/external/capnparm/lib/libcapnpc.la deleted file mode 100755 index 1c6299c78b..0000000000 --- a/external/capnparm/lib/libcapnpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnpc-0.6.1.so' - -# Names of this library. -library_names='libcapnpc-0.6.1.so libcapnpc-0.6.1.so libcapnpc.so' - -# The name of the static archive. -old_library='libcapnpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libcapnp.la /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libcapnpc.so b/external/capnparm/lib/libcapnpc.so deleted file mode 120000 index e1be5626dd..0000000000 --- a/external/capnparm/lib/libcapnpc.so +++ /dev/null @@ -1 +0,0 @@ -libcapnpc-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libkj-0.6.1.so b/external/capnparm/lib/libkj-0.6.1.so deleted file mode 100755 index bf944a8d03..0000000000 Binary files a/external/capnparm/lib/libkj-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libkj-async-0.6.1.so b/external/capnparm/lib/libkj-async-0.6.1.so deleted file mode 100755 index eeb451a6cd..0000000000 Binary files a/external/capnparm/lib/libkj-async-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libkj-async.a b/external/capnparm/lib/libkj-async.a deleted file mode 100644 index d65ac035b6..0000000000 Binary files a/external/capnparm/lib/libkj-async.a and /dev/null differ diff --git a/external/capnparm/lib/libkj-async.la b/external/capnparm/lib/libkj-async.la deleted file mode 100755 index cca7fab9c5..0000000000 --- a/external/capnparm/lib/libkj-async.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-async.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-async-0.6.1.so' - -# Names of this library. -library_names='libkj-async-0.6.1.so libkj-async-0.6.1.so libkj-async.so' - -# The name of the static archive. -old_library='libkj-async.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-async. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libkj-async.so b/external/capnparm/lib/libkj-async.so deleted file mode 120000 index 415bd24bee..0000000000 --- a/external/capnparm/lib/libkj-async.so +++ /dev/null @@ -1 +0,0 @@ -libkj-async-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libkj-http-0.6.1.so b/external/capnparm/lib/libkj-http-0.6.1.so deleted file mode 100755 index 98dae6f427..0000000000 Binary files a/external/capnparm/lib/libkj-http-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libkj-http.a b/external/capnparm/lib/libkj-http.a deleted file mode 100644 index f20efd0494..0000000000 Binary files a/external/capnparm/lib/libkj-http.a and /dev/null differ diff --git a/external/capnparm/lib/libkj-http.la b/external/capnparm/lib/libkj-http.la deleted file mode 100755 index 6df422a386..0000000000 --- a/external/capnparm/lib/libkj-http.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-http.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-http-0.6.1.so' - -# Names of this library. -library_names='libkj-http-0.6.1.so libkj-http-0.6.1.so libkj-http.so' - -# The name of the static archive. -old_library='libkj-http.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libkj-async.la /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-http. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libkj-http.so b/external/capnparm/lib/libkj-http.so deleted file mode 120000 index f66c52a3f5..0000000000 --- a/external/capnparm/lib/libkj-http.so +++ /dev/null @@ -1 +0,0 @@ -libkj-http-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libkj-test-0.6.1.so b/external/capnparm/lib/libkj-test-0.6.1.so deleted file mode 100755 index 6dc0a89a5f..0000000000 Binary files a/external/capnparm/lib/libkj-test-0.6.1.so and /dev/null differ diff --git a/external/capnparm/lib/libkj-test.a b/external/capnparm/lib/libkj-test.a deleted file mode 100644 index 50924135c3..0000000000 Binary files a/external/capnparm/lib/libkj-test.a and /dev/null differ diff --git a/external/capnparm/lib/libkj-test.la b/external/capnparm/lib/libkj-test.la deleted file mode 100755 index 1b939e1ec1..0000000000 --- a/external/capnparm/lib/libkj-test.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-test.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-test-0.6.1.so' - -# Names of this library. -library_names='libkj-test-0.6.1.so libkj-test-0.6.1.so libkj-test.so' - -# The name of the static archive. -old_library='libkj-test.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/comma/openpilot/external/capnparm/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-test. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libkj-test.so b/external/capnparm/lib/libkj-test.so deleted file mode 120000 index 8474e67019..0000000000 --- a/external/capnparm/lib/libkj-test.so +++ /dev/null @@ -1 +0,0 @@ -libkj-test-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/libkj.a b/external/capnparm/lib/libkj.a deleted file mode 100644 index a1b496ae95..0000000000 Binary files a/external/capnparm/lib/libkj.a and /dev/null differ diff --git a/external/capnparm/lib/libkj.la b/external/capnparm/lib/libkj.la deleted file mode 100755 index bc6e99882d..0000000000 --- a/external/capnparm/lib/libkj.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-0.6.1.so' - -# Names of this library. -library_names='libkj-0.6.1.so libkj-0.6.1.so libkj.so' - -# The name of the static archive. -old_library='libkj.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/comma/openpilot/external/capnparm/lib' diff --git a/external/capnparm/lib/libkj.so b/external/capnparm/lib/libkj.so deleted file mode 120000 index 07c6d3bb08..0000000000 --- a/external/capnparm/lib/libkj.so +++ /dev/null @@ -1 +0,0 @@ -libkj-0.6.1.so \ No newline at end of file diff --git a/external/capnparm/lib/pkgconfig/c-capnproto.pc b/external/capnparm/lib/pkgconfig/c-capnproto.pc deleted file mode 100644 index 95f2d975bf..0000000000 --- a/external/capnparm/lib/pkgconfig/c-capnproto.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/comma/openpilot/external/capnparm -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -bindir=${exec_prefix}/bin -includedir=${prefix}/include -codegen=${bindir}/capnpc-c - -Name: c-capnproto -Description: Cap'n Proto C bindings -Version: 0.2 -Libs: -L${libdir} -lcapnp_c -Cflags: -I${includedir} diff --git a/external/capnparm/lib/pkgconfig/capnp-rpc.pc b/external/capnparm/lib/pkgconfig/capnp-rpc.pc deleted file mode 100644 index 56f45029ca..0000000000 --- a/external/capnparm/lib/pkgconfig/capnp-rpc.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/comma/openpilot/external/capnparm -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto RPC -Description: Fast object-oriented RPC system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp-rpc -Requires: capnp = 0.6.1 kj-async = 0.6.1 -Cflags: -I${includedir} diff --git a/external/capnparm/lib/pkgconfig/capnp.pc b/external/capnparm/lib/pkgconfig/capnp.pc deleted file mode 100644 index 3813d23a39..0000000000 --- a/external/capnparm/lib/pkgconfig/capnp.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/comma/openpilot/external/capnparm -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto -Description: Insanely fast serialization system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp -pthread -lpthread -Libs.private: -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/external/capnparm/lib/pkgconfig/kj-async.pc b/external/capnparm/lib/pkgconfig/kj-async.pc deleted file mode 100644 index ffcd024b9a..0000000000 --- a/external/capnparm/lib/pkgconfig/kj-async.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/comma/openpilot/external/capnparm -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Async Framework Library -Description: Basic utility library called KJ (async part) -Version: 0.6.1 -Libs: -L${libdir} -lkj-async -pthread -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/external/capnparm/lib/pkgconfig/kj.pc b/external/capnparm/lib/pkgconfig/kj.pc deleted file mode 100644 index a1610d0779..0000000000 --- a/external/capnparm/lib/pkgconfig/kj.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/comma/openpilot/external/capnparm -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Framework Library -Description: Basic utility library called KJ -Version: 0.6.1 -Libs: -L${libdir} -lkj -pthread -lpthread -Cflags: -I${includedir} -pthread diff --git a/external/zmq/bin/curve_keygen b/external/zmq/bin/curve_keygen deleted file mode 100755 index 70b4267845..0000000000 --- a/external/zmq/bin/curve_keygen +++ /dev/null @@ -1,228 +0,0 @@ -#! /bin/bash - -# tools/curve_keygen - temporary wrapper script for .libs/curve_keygen -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# The tools/curve_keygen program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s|\([`"$\\]\)|\\\1|g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/batman/dev/libzmq; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/usr/local/cuda/lib64:; export LD_LIBRARY_PATH; PATH=/home/batman/one/external/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/batman/scripts:/usr/local/cuda/bin; export PATH; g++ -std=gnu++11 -g -O2 -o \$progdir/\$file tools/curve_keygen.o src/.libs/libzmq.so -lrt -lpthread -ldl -Wl,-rpath -Wl,/home/batman/dev/libzmq/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4.6' - notinst_deplibs=' src/libzmq.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ that is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options that match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ./libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "curve_keygen:tools/curve_keygen:$LINENO: libtool wrapper (GNU libtool) 2.4.6 Debian-2.4.6-0.1" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "curve_keygen:tools/curve_keygen:$LINENO: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "curve_keygen:tools/curve_keygen:$LINENO: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case " $* " in - *\ --lt-*) - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done ;; - esac - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'curve_keygen' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - $ECHO "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: '$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/external/zmq/bin/makecert b/external/zmq/bin/makecert deleted file mode 100755 index fc8a622d56..0000000000 Binary files a/external/zmq/bin/makecert and /dev/null differ diff --git a/external/zmq/build_czmq.sh b/external/zmq/build_czmq.sh deleted file mode 100755 index fb338fcb46..0000000000 --- a/external/zmq/build_czmq.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e -VERSION=4.0.2 -LIBFILE=czmq-${VERSION} -wget https://github.com/zeromq/czmq/releases/download/v4.0.2/${LIBFILE}.tar.gz -tar -xzf ${LIBFILE}.tar.gz -INSTALL_PATH=$PWD -cd ${LIBFILE} -export CFLAGS=-I${INSTALL_PATH}/include -export LDFLAGS=-L${INSTALL_PATH}/lib -export PKG_CONFIG_PATH=-L${INSTALL_PATH}/lib/pkgconfig -./configure --prefix=${INSTALL_PATH} -make -j4 install -cd ../ -rm -f bin/zmakecert -rm -rf ${LIBFILE} -rm -rf ${LIBFILE}.tar.gz diff --git a/external/zmq/include/czmq.h b/external/zmq/include/czmq.h deleted file mode 100644 index dbf1fe5e40..0000000000 --- a/external/zmq/include/czmq.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= - - "Tell them I was a writer. - A maker of software. - A humanist. A father. - And many things. - But above all, a writer. - Thank You. :) - - Pieter Hintjens -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/external/zmq/include/czmq_library.h b/external/zmq/include/czmq_library.h deleted file mode 100644 index 89dc4eb917..0000000000 --- a/external/zmq/include/czmq_library.h +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 4 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 2 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -# define CZMQ_PRIVATE -#else -# define CZMQ_EXPORT -# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden"))) -# else -# define CZMQ_PRIVATE -# endif -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/external/zmq/include/czmq_prelude.h b/external/zmq/include/czmq_prelude.h deleted file mode 100644 index 534f47023c..0000000000 --- a/external/zmq/include/czmq_prelude.h +++ /dev/null @@ -1,647 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0600) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -// Note that (at least in Solaris) while rand() returns an int limited by -// RAND_MAX, random() returns a 32-bit value all filled with random bits. -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# if defined(RAND_MAX) -# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0)) -# else -# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0)) -# endif -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC) -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/external/zmq/include/zactor.h b/external/zmq/include/zactor.h deleted file mode 100644 index c865c65daf..0000000000 --- a/external/zmq/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zarmour.h b/external/zmq/include/zarmour.h deleted file mode 100644 index c7f299f7af..0000000000 --- a/external/zmq/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zauth.h b/external/zmq/include/zauth.h deleted file mode 100644 index 3e0e59ecab..0000000000 --- a/external/zmq/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or more addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zbeacon.h b/external/zmq/include/zbeacon.h deleted file mode 100644 index 78917e9577..0000000000 --- a/external/zmq/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zcert.h b/external/zmq/include/zcert.h deleted file mode 100644 index 3161bc0596..0000000000 --- a/external/zmq/include/zcert.h +++ /dev/null @@ -1,128 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/external/zmq/include/zcertstore.h b/external/zmq/include/zcertstore.h deleted file mode 100644 index 689b228ac1..0000000000 --- a/external/zmq/include/zcertstore.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/external/zmq/include/zchunk.h b/external/zmq/include/zchunk.h deleted file mode 100644 index 56f29b161a..0000000000 --- a/external/zmq/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/external/zmq/include/zclock.h b/external/zmq/include/zclock.h deleted file mode 100644 index eb064162c4..0000000000 --- a/external/zmq/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zconfig.h b/external/zmq/include/zconfig.h deleted file mode 100644 index df0c708493..0000000000 --- a/external/zmq/include/zconfig.h +++ /dev/null @@ -1,185 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/external/zmq/include/zdigest.h b/external/zmq/include/zdigest.h deleted file mode 100644 index def9e86053..0000000000 --- a/external/zmq/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zdir.h b/external/zmq/include/zdir.h deleted file mode 100644 index 6c5551b57e..0000000000 --- a/external/zmq/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/external/zmq/include/zdir_patch.h b/external/zmq/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb4..0000000000 --- a/external/zmq/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zfile.h b/external/zmq/include/zfile.h deleted file mode 100644 index 75c35774b9..0000000000 --- a/external/zmq/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/external/zmq/include/zframe.h b/external/zmq/include/zframe.h deleted file mode 100644 index 728093c36c..0000000000 --- a/external/zmq/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zgossip.h b/external/zmq/include/zgossip.h deleted file mode 100644 index 647cb28c08..0000000000 --- a/external/zmq/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zhash.h b/external/zmq/include/zhash.h deleted file mode 100644 index 138adf63ac..0000000000 --- a/external/zmq/include/zhash.h +++ /dev/null @@ -1,182 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zhashx.h b/external/zmq/include/zhashx.h deleted file mode 100644 index 360a773ee8..0000000000 --- a/external/zmq/include/zhashx.h +++ /dev/null @@ -1,277 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/ziflist.h b/external/zmq/include/ziflist.h deleted file mode 100644 index cb2b144802..0000000000 --- a/external/zmq/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zlist.h b/external/zmq/include/zlist.h deleted file mode 100644 index 1dcd39b995..0000000000 --- a/external/zmq/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zlistx.h b/external/zmq/include/zlistx.h deleted file mode 100644 index 512637cef3..0000000000 --- a/external/zmq/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zloop.h b/external/zmq/include/zloop.h deleted file mode 100644 index 83f46f282a..0000000000 --- a/external/zmq/include/zloop.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zmonitor.h b/external/zmq/include/zmonitor.h deleted file mode 100644 index b490bcb1a0..0000000000 --- a/external/zmq/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zmq.h b/external/zmq/include/zmq.h deleted file mode 100644 index 21a78eb657..0000000000 --- a/external/zmq/include/zmq.h +++ /dev/null @@ -1,643 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 2 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - -// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it -// defines compatibility macros for them. Need to include that header first to -// stop build failures since zmq_pollset_t defines them as events and revents. -#ifdef ZMQ_HAVE_AIX - #include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer - * alignment and raise sigbus on violations. Make sure applications allocate - * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. - */ -typedef struct zmq_msg_t { -#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ - (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); -#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) - __declspec (align (8)) unsigned char _ [64]; -#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) - __declspec (align (4)) unsigned char _ [64]; -#else - unsigned char _ [64]; -#endif -} zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT 0MQ socket events and monitoring */ -#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 -#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 - -/* DRAFT Context options */ -#define ZMQ_MSG_T_SIZE 6 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); -ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zmq_utils.h b/external/zmq/include/zmq_utils.h deleted file mode 100644 index f29638d553..0000000000 --- a/external/zmq/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/external/zmq/include/zmsg.h b/external/zmq/include/zmsg.h deleted file mode 100644 index d8a84d1f41..0000000000 --- a/external/zmq/include/zmsg.h +++ /dev/null @@ -1,280 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/external/zmq/include/zpoller.h b/external/zmq/include/zpoller.h deleted file mode 100644 index 3b394c3516..0000000000 --- a/external/zmq/include/zpoller.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/external/zmq/include/zproc.h b/external/zmq/include/zproc.h deleted file mode 100644 index 4fd3fcf445..0000000000 --- a/external/zmq/include/zproc.h +++ /dev/null @@ -1,168 +0,0 @@ -/* ========================================================================= - zproc - process configuration and status - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZPROC_H_INCLUDED -#define ZPROC_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zproc.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal. -// It is good practice to use this method to exit any infinite loop -// processing messages. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints. -// If the host name is not resolvable, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background. The precise effect -// depends on the operating system. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there -// was an error. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user. Any of the -// arguments may be null, indicating a no-op. Returns 0 on success, -// -1 on failure. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition - highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition - high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log informational message - low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zproxy.h b/external/zmq/include/zproxy.h deleted file mode 100644 index f672c5e724..0000000000 --- a/external/zmq/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zrex.h b/external/zmq/include/zrex.h deleted file mode 100644 index 8b50618a34..0000000000 --- a/external/zmq/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zsock.h b/external/zmq/include/zsock.h deleted file mode 100644 index 9ab060d6a3..0000000000 --- a/external/zmq/include/zsock.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32-octet binary -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef CZMQ_BUILD_DRAFT_API -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); -#endif // CZMQ_BUILD_DRAFT_API - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zstr.h b/external/zmq/include/zstr.h deleted file mode 100644 index 67f2f852b6..0000000000 --- a/external/zmq/include/zstr.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zsys.h b/external/zmq/include/zsys.h deleted file mode 100644 index 200271d924..0000000000 --- a/external/zmq/include/zsys.h +++ /dev/null @@ -1,395 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent. -// The default is INT_MAX. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/ztimerset.h b/external/zmq/include/ztimerset.h deleted file mode 100644 index 29633fafdb..0000000000 --- a/external/zmq/include/ztimerset.h +++ /dev/null @@ -1,90 +0,0 @@ -/* ========================================================================= - ztimerset - timer set - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTIMERSET_H_INCLUDED -#define ZTIMERSET_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztimerset.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set. Returns timer id if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer. Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval. -// Should be used as timeout parameter for the zpoller wait method. -// The timeout is in msec. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed. -// Should be call after zpoller wait method. -// Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/ztrie.h b/external/zmq/include/ztrie.h deleted file mode 100644 index 6fd53234b1..0000000000 --- a/external/zmq/include/ztrie.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ========================================================================= - ztrie - simple trie for tokenizable strings - - Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com - Copyright other contributors as noted in the AUTHORS file. - - This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTRIE_H_INCLUDED -#define ZTRIE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztrie.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data. Returns -1 -// if the route already exists, otherwise 0. This method takes ownership of -// the provided data if a destroy_data_fn is provided. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data. Returns -1 if the -// route does not exists, otherwise 0. -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches. If the path -// did not match, returns NULL. Do not delete the data as it's owned by -// ztrie. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches. If the path did not match or the route did not contain any -// named regexes, returns NULL. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/include/zuuid.h b/external/zmq/include/zuuid.h deleted file mode 100644 index afc1104fea..0000000000 --- a/external/zmq/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/zmq/lib/libczmq.a b/external/zmq/lib/libczmq.a deleted file mode 100644 index 71dcaa686d..0000000000 --- a/external/zmq/lib/libczmq.a +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c55f283766b3a7746306f6599c2094630a6d55c51ca7d3e84d0d3fb099bd57a0 -size 986208 diff --git a/external/zmq/lib/libczmq.la b/external/zmq/lib/libczmq.la deleted file mode 100755 index 8e4a9ee364..0000000000 --- a/external/zmq/lib/libczmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libczmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libczmq.so.4' - -# Names of this library. -library_names='libczmq.so.4.0.2 libczmq.so.4 libczmq.so' - -# The name of the static archive. -old_library='libczmq.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -L/home/batman/one/external/zmq/lib -L/usr/local/lib /home/batman/one/external/zmq/lib/libzmq.la -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libczmq. -current=4 -age=0 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/external/zmq/lib/libczmq.so b/external/zmq/lib/libczmq.so deleted file mode 120000 index db9aa60f9b..0000000000 --- a/external/zmq/lib/libczmq.so +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/external/zmq/lib/libczmq.so.4 b/external/zmq/lib/libczmq.so.4 deleted file mode 120000 index db9aa60f9b..0000000000 --- a/external/zmq/lib/libczmq.so.4 +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/external/zmq/lib/libczmq.so.4.0.2 b/external/zmq/lib/libczmq.so.4.0.2 deleted file mode 100755 index eaf4cce8b9..0000000000 Binary files a/external/zmq/lib/libczmq.so.4.0.2 and /dev/null differ diff --git a/external/zmq/lib/libzmq.a b/external/zmq/lib/libzmq.a deleted file mode 100644 index eccdfae49c..0000000000 --- a/external/zmq/lib/libzmq.a +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a9ef32858d9dd32d623f448d68901525ac6971a5a790b70d61555b1a8def4eca -size 5319544 diff --git a/external/zmq/lib/libzmq.la b/external/zmq/lib/libzmq.la deleted file mode 100644 index 69652b3463..0000000000 --- a/external/zmq/lib/libzmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/external/zmq/lib/libzmq.lai b/external/zmq/lib/libzmq.lai deleted file mode 100644 index 93c1a83dc3..0000000000 --- a/external/zmq/lib/libzmq.lai +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib' diff --git a/external/zmq/lib/libzmq.so b/external/zmq/lib/libzmq.so deleted file mode 120000 index ef44cafc6a..0000000000 --- a/external/zmq/lib/libzmq.so +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/external/zmq/lib/libzmq.so.5 b/external/zmq/lib/libzmq.so.5 deleted file mode 120000 index ef44cafc6a..0000000000 --- a/external/zmq/lib/libzmq.so.5 +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/external/zmq/lib/libzmq.so.5.1.2 b/external/zmq/lib/libzmq.so.5.1.2 deleted file mode 100755 index e08e8c2dfb..0000000000 Binary files a/external/zmq/lib/libzmq.so.5.1.2 and /dev/null differ diff --git a/external/zmq/lib/pkgconfig/libczmq.pc b/external/zmq/lib/pkgconfig/libczmq.pc deleted file mode 100644 index b6fb3dc133..0000000000 --- a/external/zmq/lib/pkgconfig/libczmq.pc +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libczmq -Description: The high-level C binding for 0MQ -Version: 4.0.2 - -Requires:libzmq - -Libs: -L${libdir} -lczmq -Cflags: -I${includedir} -Libs.private: -L/usr/local/lib -lzmq - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ diff --git a/external/zmq/lib/pkgconfig/libzmq.pc b/external/zmq/lib/pkgconfig/libzmq.pc deleted file mode 100644 index aba3d3a75e..0000000000 --- a/external/zmq/lib/pkgconfig/libzmq.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libzmq -Description: 0MQ c++ library -Version: 4.2.2 -Libs: -L${libdir} -lzmq -Cflags: -I${includedir} diff --git a/external/zmq/share/man/man1/makecert.1 b/external/zmq/share/man/man1/makecert.1 deleted file mode 100644 index 9e1a19238a..0000000000 --- a/external/zmq/share/man/man1/makecert.1 +++ /dev/null @@ -1,72 +0,0 @@ -'\" t -.\" Title: makecert -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "MAKECERT" "1" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -makecert \- no title found -.SH "SYNOPSIS" -.sp -.nf -Please add @interface section in \&.\&./src/makecert\&.c\&. -.fi -.SH "DESCRIPTION" -.sp -Please add @header section in \&.\&./src/makecert\&.c\&. -.sp -Please add @discuss section in \&.\&./src/makecert\&.c\&. -.SH "EXAMPLE" -.PP -\fBFrom makecert_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -Please add @selftest section in \&.\&./src/makecert\&.c\&. -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man1/zmakecert.1 b/external/zmq/share/man/man1/zmakecert.1 deleted file mode 100644 index 7a702496b8..0000000000 --- a/external/zmq/share/man/man1/zmakecert.1 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmakecert -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMAKECERT" "1" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmakecert \- no title found -.SH "SYNOPSIS" -.sp -.nf -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Please add \fI@header\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zmakecert_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zactor.3 b/external/zmq/share/man/man3/zactor.3 deleted file mode 100644 index 481edc396e..0000000000 --- a/external/zmq/share/man/man3/zactor.3 +++ /dev/null @@ -1,127 +0,0 @@ -'\" t -.\" Title: zactor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZACTOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zactor \- simple actor framework -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference\&. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor\&. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent\&. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor\&. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t\&. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference\&. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value\&. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor\*(Aqs zsock handle\&. Use this when you absolutely need -// to work with the zsock instance rather than the actor\&. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zactor_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zactor\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zactor class provides a simple actor framework\&. It replaces the CZMQ zthread class, which had a complex API that did not fit the CLASS standard\&. A CZMQ actor is implemented as a thread plus a PAIR\-PAIR pipe\&. The constructor and destructor are always synchronized, so the caller can be sure all resources are created, and destroyed, when these calls complete\&. (This solves a major problem with zthread, that a caller could not be sure when a child thread had finished\&.) -.sp -A zactor_t instance acts like a zsock_t and you can pass it to any CZMQ method that would take a zsock_t argument, including methods in zframe, zmsg, zstr, and zpoller\&. (zloop somehow escaped and needs catching\&.) -.sp -An actor function MUST call zsock_signal (pipe) when initialized and MUST listen to pipe and exit on $TERM command\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zactor\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zactor_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zactor_t *actor = zactor_new (echo_actor, "Hello, World"); -assert (actor); -zstr_sendx (actor, "ECHO", "This is a string", NULL); -char *string = zstr_recv (actor); -assert (streq (string, "This is a string")); -free (string); -zactor_destroy (&actor); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zarmour.3 b/external/zmq/share/man/man3/zarmour.3 deleted file mode 100644 index ea80677725..0000000000 --- a/external/zmq/share/man/man3/zarmour.3 +++ /dev/null @@ -1,372 +0,0 @@ -'\" t -.\" Title: zarmour -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZARMOUR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zarmour \- armoured text encoding and decoding -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string\&. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk\&. The decoded output is -// null\-terminated, so it may be treated as a string, if that\*(Aqs what -// it was prior to encoding\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property\&. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode\&. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property\&. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on\&. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off\&. Default is on\&. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character\&. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character\&. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on\&. Default is off\&. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off\&. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines\&. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines\&. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zarmour\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zarmour \- armoured text encoding and decoding -.sp -The zarmour class implements encoding and decoding of armoured text data\&. The following codecs are implemented: * RFC 4648 (\m[blue]\fBhttp://www\&.ietf\&.org/rfc/rfc4648\&.txt\fR\m[]) \- base64 \- base64url \- base32 \- base32hex \- base16 * Z85 (\m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]) All RFC4648 base64 and base32 variants support padding the output\&. The pad character is configurable\&. Default is padding on, with character \fI=\fR\&. Additionally, in some cases (e\&.g\&. MIME), splitting the output into lines of a specific length is required\&. This feature is also supported, though turned off by default\&. The z85 mode does neither padding nor line breaks; it is merely a wrapping of the corresponding libzmq methods\&. Encoding will assert if input length is not divisible by 4 and decoding will assert if input length is not divisible by 5\&. -.SH "EXAMPLE" -.PP -\fBFrom zarmour_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zarmour_t *self = zarmour_new (); -assert (self); - -int mode = zarmour_mode (self); -assert (mode == ZARMOUR_MODE_BASE64_STD); - -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -mode = zarmour_mode (self); -assert (mode == ZARMOUR_MODE_BASE64_URL); - -assert (zarmour_pad (self)); -zarmour_set_pad (self, false); -assert (!zarmour_pad (self)); - -assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); -zarmour_set_pad_char (self, \*(Aq!\*(Aq); -assert (zarmour_pad_char (self) == \*(Aq!\*(Aq); -zarmour_set_pad_char (self, \*(Aq=\*(Aq); -assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); - -assert (!zarmour_line_breaks (self)); -zarmour_set_line_breaks (self, true); -assert (zarmour_line_breaks (self)); - -assert (zarmour_line_length (self) == 72); -zarmour_set_line_length (self, 64); -assert (zarmour_line_length (self) == 64); - -// Test against test vectors from RFC4648\&. -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg", verbose); -s_armour_test (self, "fo", "Zm8", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg", verbose); -s_armour_test (self, "fooba", "Zm9vYmE", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg==", verbose); -s_armour_test (self, "fo", "Zm8=", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg==", verbose); -s_armour_test (self, "fooba", "Zm9vYmE=", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg", verbose); -s_armour_test (self, "fo", "Zm8", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg", verbose); -s_armour_test (self, "fooba", "Zm9vYmE", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg==", verbose); -s_armour_test (self, "fo", "Zm8=", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg==", verbose); -s_armour_test (self, "fooba", "Zm9vYmE=", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "MY", verbose); -s_armour_test (self, "fo", "MZXQ", verbose); -s_armour_test (self, "foo", "MZXW6", verbose); -s_armour_test (self, "foob", "MZXW6YQ", verbose); -s_armour_test (self, "fooba", "MZXW6YTB", verbose); -s_armour_test (self, "foobar", "MZXW6YTBOI", verbose); -s_armour_decode (self, "my", "f", verbose); -s_armour_decode (self, "mzxq", "fo", verbose); -s_armour_decode (self, "mzxw6", "foo", verbose); -s_armour_decode (self, "mzxw6yq", "foob", verbose); -s_armour_decode (self, "mzxw6ytb", "fooba", verbose); -s_armour_decode (self, "mzxw6ytboi", "foobar", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "MY======", verbose); -s_armour_test (self, "fo", "MZXQ====", verbose); -s_armour_test (self, "foo", "MZXW6===", verbose); -s_armour_test (self, "foob", "MZXW6YQ=", verbose); -s_armour_test (self, "fooba", "MZXW6YTB", verbose); -s_armour_test (self, "foobar", "MZXW6YTBOI======", verbose); -s_armour_decode (self, "my======", "f", verbose); -s_armour_decode (self, "mzxq====", "fo", verbose); -s_armour_decode (self, "mzxw6===", "foo", verbose); -s_armour_decode (self, "mzxw6yq=", "foob", verbose); -s_armour_decode (self, "mzxw6ytb", "fooba", verbose); -s_armour_decode (self, "mzxw6ytboi======", "foobar", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "CO", verbose); -s_armour_test (self, "fo", "CPNG", verbose); -s_armour_test (self, "foo", "CPNMU", verbose); -s_armour_test (self, "foob", "CPNMUOG", verbose); -s_armour_test (self, "fooba", "CPNMUOJ1", verbose); -s_armour_test (self, "foobar", "CPNMUOJ1E8", verbose); -s_armour_decode (self, "co", "f", verbose); -s_armour_decode (self, "cpng", "fo", verbose); -s_armour_decode (self, "cpnmu", "foo", verbose); -s_armour_decode (self, "cpnmuog", "foob", verbose); -s_armour_decode (self, "cpnmuoj1", "fooba", verbose); -s_armour_decode (self, "cpnmuoj1e8", "foobar", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "CO======", verbose); -s_armour_test (self, "fo", "CPNG====", verbose); -s_armour_test (self, "foo", "CPNMU===", verbose); -s_armour_test (self, "foob", "CPNMUOG=", verbose); -s_armour_test (self, "fooba", "CPNMUOJ1", verbose); -s_armour_test (self, "foobar", "CPNMUOJ1E8======", verbose); -s_armour_decode (self, "co======", "f", verbose); -s_armour_decode (self, "cpng====", "fo", verbose); -s_armour_decode (self, "cpnmu===", "foo", verbose); -s_armour_decode (self, "cpnmuog=", "foob", verbose); -s_armour_decode (self, "cpnmuoj1", "fooba", verbose); -s_armour_decode (self, "cpnmuoj1e8======", "foobar", verbose); -zarmour_set_pad (self, true); - -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "66", verbose); -s_armour_test (self, "fo", "666F", verbose); -s_armour_test (self, "foo", "666F6F", verbose); -s_armour_test (self, "foob", "666F6F62", verbose); -s_armour_test (self, "fooba", "666F6F6261", verbose); -s_armour_test (self, "foobar", "666F6F626172", verbose); -s_armour_decode (self, "666f", "fo", verbose); -s_armour_decode (self, "666f6f", "foo", verbose); -s_armour_decode (self, "666f6f62", "foob", verbose); -s_armour_decode (self, "666f6f6261", "fooba", verbose); -s_armour_decode (self, "666f6f626172", "foobar", verbose); - -#ifdef _INCLUDE_Z85 -// Z85 test is homemade; using 0, 4 and 8 bytes, with precalculated -// test vectors created with a libzmq test\&. -// \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- - -// Make a fake curve key from hex (base16) string, making sure -// there are no null bytes inside, so we can use our test utility -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -zarmour_set_line_breaks (self, false); - -zchunk_t *chunk = zarmour_decode (self, - "4E6F87E2FB6EB22A1EF5E257B75D79124949565F0B8B36A878A4F03111C96E0B"); -assert (chunk); - -zarmour_set_mode (self, ZARMOUR_MODE_Z85); // Z85 mode does not support padding or line breaks -zarmour_set_pad (self, false); // so these two are superfluous; -zarmour_set_line_breaks (self, false); // just for consistency -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "foob", "w]zP%", verbose); -s_armour_test (self, "foobar!!", "w]zP%vr9Im", verbose); -s_armour_test (self, (char *) zchunk_data (chunk), - "ph+{E}!&X?9}!I]W{sm(nL8@&3Yu{wC+<*\-5Y[[#", verbose); -zchunk_destroy (&chunk); -#endif - -// Armouring longer byte array to test line breaks -zarmour_set_pad (self, true); -zarmour_set_line_breaks (self, true); -byte test_data [256]; -int index; -for (index = 0; index < 256; index++) - test_data [index] = index; - -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -s_armour_test_long (self, test_data, 256, verbose); -#ifdef _INCLUDE_Z85 -zarmour_set_mode (self, ZARMOUR_MODE_Z85); -s_armour_test_long (self, test_data, 256, verbose); -#endif - -zarmour_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zauth.3 b/external/zmq/share/man/man3/zauth.3 deleted file mode 100644 index b119d13e9a..0000000000 --- a/external/zmq/share/man/man3/zauth.3 +++ /dev/null @@ -1,309 +0,0 @@ -'\" t -.\" Title: zauth -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZAUTH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zauth \- authentication for ZeroMQ security mechanisms -.SH "SYNOPSIS" -.sp -.nf -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated)\&. -// -// Create new zauth actor instance\&. This installs authentication on all -// zsock sockets\&. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance\&. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command\&. -// -// Enable verbose logging of commands and activity\&. Verbose logging can help -// debug non\-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses\&. For NULL, all clients from -// these addresses will be accepted\&. For PLAIN and CURVE, they will be -// allowed to continue with authentication\&. You can call this method -// multiple times to whitelist more IP addresses\&. If you whitelist one -// or more addresses, any non\-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", "127\&.0\&.0\&.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses\&. For all security mechanisms, -// this rejects the connection without any further authentication\&. Use -// either a whitelist, or a blacklist, not not both\&. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192\&.168\&.0\&.1", "192\&.168\&.0\&.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain\-text password file\&. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i\&.e\&. their public keys\&. The certificates must be in -// zcert_save format\&. You can add and remove certificates in that directory -// at any time\&. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zauth\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -A zauth actor takes over authentication for all incoming connections in its context\&. You can whitelist or blacklist peers based on IP address, and define policies for securing PLAIN, CURVE, and GSSAPI connections\&. -.sp -This class replaces zauth_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zauth_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zauth" -zsys_dir_create (TESTDIR); - -// Check there\*(Aqs no authentication -zsock_t *server = zsock_new (ZMQ_PULL); -assert (server); -zsock_t *client = zsock_new (ZMQ_PUSH); -assert (client); -bool success = s_can_connect (&server, &client, true); -assert (success); - -// Install the authenticator -zactor_t *auth = zactor_new (zauth, NULL); -assert (auth); -if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); -} -// Check there\*(Aqs no authentication on a default NULL server -success = s_can_connect (&server, &client, true); -assert (success); - -// When we set a domain on the server, we switch on authentication -// for NULL sockets, but with no policies, the client connection -// will be allowed\&. -zsock_set_zap_domain (server, "global"); -success = s_can_connect (&server, &client, true); -assert (success); - -// Blacklist 127\&.0\&.0\&.1, connection should fail -zsock_set_zap_domain (server, "global"); -zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (!success); - -// Whitelist our address, which overrides the blacklist -zsock_set_zap_domain (server, "global"); -zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (success); - -// Try PLAIN authentication -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Password"); -success = s_can_connect (&server, &client, true); -assert (!success); - -FILE *password = fopen (TESTDIR "/password\-file", "w"); -assert (password); -fprintf (password, "admin=Password\en"); -fclose (password); -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Password"); -zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (success); - -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Bogus"); -success = s_can_connect (&server, &client, true); -assert (!success); - -if (zsys_has_curve ()) { - // Try CURVE authentication - // We\*(Aqll create two new certificates and save the client public - // certificate on disk; in a real case we\*(Aqd transfer this securely - // from the client machine to the server machine\&. - zcert_t *server_cert = zcert_new (); - assert (server_cert); - zcert_t *client_cert = zcert_new (); - assert (client_cert); - const char *server_key = zcert_public_txt (server_cert); - - // Test without setting\-up any authentication - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - success = s_can_connect (&server, &client, true); - assert (!success); - - // Test CURVE_ALLOW_ANY - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); - zsock_wait (auth); - success = s_can_connect (&server, &client, true); - assert (success); - - // Test full client authentication using certificates - zcert_set_meta (client_cert, "Hello", "%s", "World!"); - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); - zstr_sendx (auth, "CURVE", TESTDIR, NULL); - zsock_wait (auth); - success = s_can_connect (&server, &client, false); - assert (success); - -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) - // Test send/recv certificate metadata - zframe_t *frame = zframe_recv (server); - assert (frame != NULL); - const char *meta = zframe_meta (frame, "Hello"); - assert (meta != NULL); - assert (streq (meta, "World!")); - zframe_destroy (&frame); - s_renew_sockets(&server, &client); -#endif - - zcert_destroy (&server_cert); - zcert_destroy (&client_cert); - - // Test custom zcertstore - zcertstore_t *certstore = zcertstore_new (NULL); - zcertstore_set_loader (certstore, s_test_loader, NULL, NULL); - zactor_destroy(&auth); - auth = zactor_new (zauth, certstore); - assert (auth); - if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); - } - - byte public_key [32] = { 105, 76, 150, 58, 214, 191, 218, 65, 50, 172, - 131, 188, 247, 211, 136, 170, 227, 26, 57, 170, - 185, 63, 246, 225, 177, 230, 12, 8, 134, 136, - 105, 106 }; - byte secret_key [32] = { 245, 217, 172, 73, 106, 28, 195, 17, 218, 132, - 135, 209, 99, 240, 98, 232, 7, 137, 244, 100, - 242, 23, 29, 114, 70, 223, 83, 1, 113, 207, - 132, 149 }; - zcert_t *shared_cert = zcert_new_from (public_key, secret_key); - assert (shared_cert); - zcert_apply (shared_cert, server); - zcert_apply (shared_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, "x?T*N/1Y{8goubv{Ts}#&#f}TXJ//DVe#D2HkoLU"); - success = s_can_connect (&server, &client, true); - assert (success); - zcert_destroy (&shared_cert); -} -// Remove the authenticator and check a normal connection works -zactor_destroy (&auth); -success = s_can_connect (&server, &client, true); -assert (success); - -zsock_destroy (&client); -zsock_destroy (&server); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zauth_v2.3 b/external/zmq/share/man/man3/zauth_v2.3 deleted file mode 100644 index 01117e0121..0000000000 --- a/external/zmq/share/man/man3/zauth_v2.3 +++ /dev/null @@ -1,246 +0,0 @@ -'\" t -.\" Title: zauth_v2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZAUTH_V2" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zauth_v2 \- authentication for ZeroMQ servers (deprecated) -.SH "SYNOPSIS" -.sp -.nf -#ifndef CURVE_ALLOW_ANY -# define CURVE_ALLOW_ANY "*" -#endif - -// Constructor -// Install authentication for the specified context\&. Returns a new zauth -// object that you can use to configure authentication\&. Note that until you -// add policies, all incoming NULL connections are allowed (classic ZeroMQ -// behaviour), and all PLAIN and CURVE connections are denied\&. If there was -// an error during initialization, returns NULL\&. -CZMQ_EXPORT zauth_t * - zauth_new (zctx_t *ctx); - -// Destructor -CZMQ_EXPORT void - zauth_destroy (zauth_t **self_p); - -// Allow (whitelist) a single IP address\&. For NULL, all clients from this -// address will be accepted\&. For PLAIN and CURVE, they will be allowed to -// continue with authentication\&. You can call this method multiple times -// to whitelist multiple IP addresses\&. If you whitelist a single address, -// any non\-whitelisted addresses are treated as blacklisted\&. -CZMQ_EXPORT void - zauth_allow (zauth_t *self, const char *address); - -// Deny (blacklist) a single IP address\&. For all security mechanisms, this -// rejects the connection without any further authentication\&. Use either a -// whitelist, or a blacklist, not not both\&. If you define both a whitelist -// and a blacklist, only the whitelist takes effect\&. -CZMQ_EXPORT void - zauth_deny (zauth_t *self, const char *address); - -// Configure PLAIN authentication for a given domain\&. PLAIN authentication -// uses a plain\-text password file\&. To cover all domains, use "*"\&. You can -// modify the password file at any time; it is reloaded automatically\&. -CZMQ_EXPORT void - zauth_configure_plain (zauth_t *self, const char *domain, const char *filename); - -// Configure CURVE authentication for a given domain\&. CURVE authentication -// uses a directory that holds all public client certificates, i\&.e\&. their -// public keys\&. The certificates must be in zcert_save () format\&. To cover -// all domains, use "*"\&. You can add and remove certificates in that -// directory at any time\&. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the location\&. -CZMQ_EXPORT void - zauth_configure_curve (zauth_t *self, const char *domain, const char *location); - -// Configure GSSAPI authentication for a given domain\&. GSSAPI authentication -// uses an underlying mechanism (usually Kerberos) to establish a secure -// context and perform mutual authentication\&. To cover all domains, use "*"\&. -CZMQ_EXPORT void - zauth_configure_gssapi (zauth_t *self, char *domain); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zauth_set_verbose (zauth_t *self, bool verbose); - -// Selftest -CZMQ_EXPORT void - zauth_v2_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -A zauth object takes over authentication for all incoming connections in its context\&. -.sp -This class is deprecated in CZMQ v3; it works together with zctx, zsocket, and other deprecated V2 classes\&. New applications should use the V3 zauth interface, based on zactor, together with the zsock class for sockets\&. -.SH "EXAMPLE" -.PP -\fBFrom zauth_v2_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zauth" -zsys_dir_create (TESTDIR); - -// Install the authenticator -zctx_t *ctx = zctx_new (); -assert (ctx); -zauth_t *auth = zauth_new (ctx); -assert (auth); -zauth_set_verbose (auth, verbose); - -// A default NULL connection should always success, and not -// go through our authentication infrastructure at all\&. -void *server = zsocket_new (ctx, ZMQ_PUSH); -assert (server); -void *client = zsocket_new (ctx, ZMQ_PULL); -assert (client); -bool success = s_can_connect (ctx, &server, &client); -assert (success); - -// When we set a domain on the server, we switch on authentication -// for NULL sockets, but with no policies, the client connection -// will be allowed\&. -zsocket_set_zap_domain (server, "global"); -success = s_can_connect (ctx, &server, &client); -assert (success); - -// Blacklist 127\&.0\&.0\&.1, connection should fail -zsocket_set_zap_domain (server, "global"); -zauth_deny (auth, "127\&.0\&.0\&.1"); -success = s_can_connect (ctx, &server, &client); -assert (!success); - -// Whitelist our address, which overrides the blacklist -zsocket_set_zap_domain (server, "global"); -zauth_allow (auth, "127\&.0\&.0\&.1"); -success = s_can_connect (ctx, &server, &client); -assert (success); - -// Try PLAIN authentication -zsocket_set_plain_server (server, 1); -zsocket_set_plain_username (client, "admin"); -zsocket_set_plain_password (client, "Password"); -success = s_can_connect (ctx, &server, &client); -assert (!success); - -FILE *password = fopen (TESTDIR "/password\-file", "w"); -assert (password); -fprintf (password, "admin=Password\en"); -fclose (password); -zsocket_set_plain_server (server, 1); -zsocket_set_plain_username (client, "admin"); -zsocket_set_plain_password (client, "Password"); -zauth_configure_plain (auth, "*", TESTDIR "/password\-file"); -success = s_can_connect (ctx, &server, &client); -assert (success); - -zsocket_set_plain_server (server, 1); -zsocket_set_plain_username (client, "admin"); -zsocket_set_plain_password (client, "Bogus"); -success = s_can_connect (ctx, &server, &client); -assert (!success); - -if (zsys_has_curve ()) { - // Try CURVE authentication - // We\*(Aqll create two new certificates and save the client public - // certificate on disk; in a real case we\*(Aqd transfer this securely - // from the client machine to the server machine\&. - zcert_t *server_cert = zcert_new (); - assert (server_cert); - zcert_t *client_cert = zcert_new (); - assert (client_cert); - char *server_key = zcert_public_txt (server_cert); - - // Test without setting\-up any authentication - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsocket_set_curve_server (server, 1); - zsocket_set_curve_serverkey (client, server_key); - success = s_can_connect (ctx, &server, &client); - assert (!success); - - // Test CURVE_ALLOW_ANY - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsocket_set_curve_server (server, 1); - zsocket_set_curve_serverkey (client, server_key); - zauth_configure_curve (auth, "*", CURVE_ALLOW_ANY); - success = s_can_connect (ctx, &server, &client); - assert (success); - - // Test full client authentication using certificates - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsocket_set_curve_server (server, 1); - zsocket_set_curve_serverkey (client, server_key); - zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); - zauth_configure_curve (auth, "*", TESTDIR); - success = s_can_connect (ctx, &server, &client); - assert (success); - - zcert_destroy (&server_cert); - zcert_destroy (&client_cert); -} -// Remove the authenticator and check a normal connection works -zauth_destroy (&auth); -success = s_can_connect (ctx, &server, &client); -assert (success); - -zctx_destroy (&ctx); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zbeacon.3 b/external/zmq/share/man/man3/zbeacon.3 deleted file mode 100644 index 40e3abbac4..0000000000 --- a/external/zmq/share/man/man3/zbeacon.3 +++ /dev/null @@ -1,236 +0,0 @@ -'\" t -.\" Title: zbeacon -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZBEACON" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zbeacon \- LAN discovery and presence -.SH "SYNOPSIS" -.sp -.nf -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections\&. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon\&. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: \*(Aqs\*(Aq = C string, \*(Aqi\*(Aq = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec\&. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys\&.h to be 255: -// -// // Pictures: \*(Aqb\*(Aq = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers\&. The filter is used to do a prefix -// match on received beacons, to remove junk\&. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case\&. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer\&. Received beacons are always a 2\-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zbeacon\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zbeacon class implements a peer\-to\-peer discovery service for local networks\&. A beacon can broadcast and/or capture service announcements using UDP messages on the local area network\&. This implementation uses IPv4 UDP broadcasts\&. You can define the format of your outgoing beacons, and set a filter that validates incoming beacons\&. Beacons are sent and received asynchronously in the background\&. -.sp -This class replaces zbeacon_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zbeacon_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Test 1 \- two beacons, one speaking, one listening -// Create speaker beacon to broadcast our service -zactor_t *speaker = zactor_new (zbeacon, NULL); -assert (speaker); -if (verbose) - zstr_sendx (speaker, "VERBOSE", NULL); - -zsock_send (speaker, "si", "CONFIGURE", 9999); -char *hostname = zstr_recv (speaker); -if (!*hostname) { - printf ("OK (skipping test, no UDP broadcasting)\en"); - zactor_destroy (&speaker); - free (hostname); - return; -} -free (hostname); - -// Create listener beacon on port 9999 to lookup service -zactor_t *listener = zactor_new (zbeacon, NULL); -assert (listener); -if (verbose) - zstr_sendx (listener, "VERBOSE", NULL); -zsock_send (listener, "si", "CONFIGURE", 9999); -hostname = zstr_recv (listener); -assert (*hostname); -free (hostname); - -// We will broadcast the magic value 0xCAFE -byte announcement [2] = { 0xCA, 0xFE }; -zsock_send (speaker, "sbi", "PUBLISH", announcement, 2, 100); -// We will listen to anything (empty subscription) -zsock_send (listener, "sb", "SUBSCRIBE", "", 0); - -// Wait for at most 1/2 second if there\*(Aqs no broadcasting -zsock_set_rcvtimeo (listener, 500); -char *ipaddress = zstr_recv (listener); -if (ipaddress) { - zframe_t *content = zframe_recv (listener); - assert (zframe_size (content) == 2); - assert (zframe_data (content) [0] == 0xCA); - assert (zframe_data (content) [1] == 0xFE); - zframe_destroy (&content); - zstr_free (&ipaddress); - zstr_sendx (speaker, "SILENCE", NULL); -} -zactor_destroy (&listener); -zactor_destroy (&speaker); - -// Test subscription filter using a 3\-node setup -zactor_t *node1 = zactor_new (zbeacon, NULL); -assert (node1); -zsock_send (node1, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node1); -assert (*hostname); -free (hostname); - -zactor_t *node2 = zactor_new (zbeacon, NULL); -assert (node2); -zsock_send (node2, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node2); -assert (*hostname); -free (hostname); - -zactor_t *node3 = zactor_new (zbeacon, NULL); -assert (node3); -zsock_send (node3, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node3); -assert (*hostname); -free (hostname); - -zsock_send (node1, "sbi", "PUBLISH", "NODE/1", 6, 250); -zsock_send (node2, "sbi", "PUBLISH", "NODE/2", 6, 250); -zsock_send (node3, "sbi", "PUBLISH", "RANDOM", 6, 250); -zsock_send (node1, "sb", "SUBSCRIBE", "NODE", 4); - -// Poll on three API sockets at once -zpoller_t *poller = zpoller_new (node1, node2, node3, NULL); -assert (poller); -int64_t stop_at = zclock_mono () + 1000; -while (zclock_mono () < stop_at) { - long timeout = (long) (stop_at \- zclock_mono ()); - if (timeout < 0) - timeout = 0; - void *which = zpoller_wait (poller, timeout * ZMQ_POLL_MSEC); - if (which) { - assert (which == node1); - char *ipaddress, *received; - zstr_recvx (node1, &ipaddress, &received, NULL); - assert (streq (received, "NODE/2")); - zstr_free (&ipaddress); - zstr_free (&received); - } -} -zpoller_destroy (&poller); - -// Stop listening -zstr_sendx (node1, "UNSUBSCRIBE", NULL); - -// Stop all node broadcasts -zstr_sendx (node1, "SILENCE", NULL); -zstr_sendx (node2, "SILENCE", NULL); -zstr_sendx (node3, "SILENCE", NULL); - -// Destroy the test nodes -zactor_destroy (&node1); -zactor_destroy (&node2); -zactor_destroy (&node3); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zbeacon_v2.3 b/external/zmq/share/man/man3/zbeacon_v2.3 deleted file mode 100644 index 518f676db9..0000000000 --- a/external/zmq/share/man/man3/zbeacon_v2.3 +++ /dev/null @@ -1,213 +0,0 @@ -'\" t -.\" Title: zbeacon_v2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZBEACON_V2" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zbeacon_v2 \- LAN discovery and presence (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// Create a new beacon on a certain UDP port\&. If the system does not -// support UDP broadcasts (lacking a useful interface), returns NULL\&. -// To force the beacon to operate on a given port, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand\&. -// If you are using the new zsock API then pass NULL as the ctx here\&. -CZMQ_EXPORT zbeacon_t * - zbeacon_new (zctx_t *ctx, int port_nbr); - -// Destroy a beacon -CZMQ_EXPORT void - zbeacon_destroy (zbeacon_t **self_p); - -// Return our own IP address as printable string -CZMQ_EXPORT char * - zbeacon_hostname (zbeacon_t *self); - -// Set broadcast interval in milliseconds (default is 1000 msec) -CZMQ_EXPORT void - zbeacon_set_interval (zbeacon_t *self, int interval); - -// Filter out any beacon that looks exactly like ours -CZMQ_EXPORT void - zbeacon_noecho (zbeacon_t *self); - -// Start broadcasting beacon to peers at the specified interval -CZMQ_EXPORT void - zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size); - -// Stop broadcasting beacons -CZMQ_EXPORT void - zbeacon_silence (zbeacon_t *self); - -// Start listening to other peers; zero\-sized filter means get everything -CZMQ_EXPORT void - zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size); - -// Stop listening to other peers -CZMQ_EXPORT void - zbeacon_unsubscribe (zbeacon_t *self); - -// Get beacon ZeroMQ socket, for polling or receiving messages -CZMQ_EXPORT void * - zbeacon_socket (zbeacon_t *self); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_v2_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zbeacon class implements a peer\-to\-peer discovery service for local networks\&. A beacon can broadcast and/or capture service announcements using UDP messages on the local area network\&. This implementation uses IPv4 UDP broadcasts\&. You can define the format of your outgoing beacons, and set a filter that validates incoming beacons\&. Beacons are sent and received asynchronously in the background\&. The zbeacon API provides a incoming beacons on a ZeroMQ socket (the pipe) that you can configure, poll on, and receive messages on\&. Incoming beacons are always delivered as two frames: the ipaddress of the sender (a string), and the beacon data itself (binary, as published)\&. -.sp -This class is deprecated in CZMQ v3; it works together with zctx, zsocket, and other deprecated V2 classes\&. New applications should use the V3 zauth interface, based on zactor, together with the zsock class for sockets\&. -.SH "EXAMPLE" -.PP -\fBFrom zbeacon_v2_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create beacon to broadcast our service -zctx_t *ctx = zctx_new (); -assert (ctx); -zbeacon_t *service_beacon = zbeacon_new (ctx, 9999); -if (service_beacon == NULL) { - printf ("OK (skipping test, no UDP discovery)\en"); - return; -} -// Create a service socket and bind to an ephemeral port -zsock_t *service = zsock_new (ZMQ_PUB); -assert (service); -int port_nbr = zsock_bind (service, "tcp://127\&.0\&.0\&.1:*"); -byte announcement [2] = { (port_nbr >> 8) & 0xFF, port_nbr & 0xFF }; -zbeacon_set_interval (service_beacon, 100); -zbeacon_publish (service_beacon, announcement, 2); - -// Create beacon to lookup service -zbeacon_t *client_beacon = zbeacon_new (ctx, 9999); -assert (client_beacon); -zbeacon_subscribe (client_beacon, NULL, 0); - -// Wait for at most 1/2 second if there\*(Aqs no broadcast networking -zsocket_set_rcvtimeo (zbeacon_socket (client_beacon), 500); - -char *ipaddress = zstr_recv (zbeacon_socket (client_beacon)); -if (ipaddress) { - zframe_t *content = zframe_recv (zbeacon_socket (client_beacon)); - int received_port = (zframe_data (content) [0] << 8) - + zframe_data (content) [1]; - assert (received_port == port_nbr); - zframe_destroy (&content); - zbeacon_silence (service_beacon); - zstr_free (&ipaddress); -} -zbeacon_destroy (&client_beacon); -zbeacon_destroy (&service_beacon); - -zbeacon_t *node1 = zbeacon_new (ctx, 5670); -assert (node1); -zbeacon_t *node2 = zbeacon_new (ctx, 5670); -assert (node2); -zbeacon_t *node3 = zbeacon_new (ctx, 5670); -assert (node3); - -assert (*zbeacon_hostname (node1)); -assert (*zbeacon_hostname (node2)); -assert (*zbeacon_hostname (node3)); - -zbeacon_set_interval (node1, 250); -zbeacon_set_interval (node2, 250); -zbeacon_set_interval (node3, 250); -zbeacon_noecho (node1); -zbeacon_publish (node1, (byte *) "NODE/1", 6); -zbeacon_publish (node2, (byte *) "NODE/2", 6); -zbeacon_publish (node3, (byte *) "GARBAGE", 7); -zbeacon_subscribe (node1, (byte *) "NODE", 4); - -// Poll on three API sockets at once -zpoller_t *poller = zpoller_new ( - zbeacon_socket (node1), - zbeacon_socket (node2), - zbeacon_socket (node3), NULL); -assert (poller); - -int64_t stop_at = zclock_mono () + 1000; -while (zclock_mono () < stop_at) { - long timeout = (long) (stop_at \- zclock_mono ()); - if (timeout < 0) - timeout = 0; - void *which = zpoller_wait (poller, timeout * ZMQ_POLL_MSEC); - if (which) { - assert (which == zbeacon_socket (node1)); - char *ipaddress, *beacon; - zstr_recvx (zbeacon_socket (node1), &ipaddress, &beacon, NULL); - assert (streq (beacon, "NODE/2")); - zstr_free (&ipaddress); - zstr_free (&beacon); - } -} -zpoller_destroy (&poller); - -// Stop listening -zbeacon_unsubscribe (node1); - -// Stop all node broadcasts -zbeacon_silence (node1); -zbeacon_silence (node2); -zbeacon_silence (node3); - -// Destroy the test nodes -zbeacon_destroy (&node1); -zbeacon_destroy (&node2); -zbeacon_destroy (&node3); - -zsock_destroy (&service); -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zcert.3 b/external/zmq/share/man/man3/zcert.3 deleted file mode 100644 index e2c81dbf10..0000000000 --- a/external/zmq/share/man/man3/zcert.3 +++ /dev/null @@ -1,215 +0,0 @@ -'\" t -.\" Title: zcert -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCERT" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zcert \- work with CURVE security certificates -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32\-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32\-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string\&. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, \&.\&.\&.) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn\*(Aqt -// exist, returns NULL\&. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate\&. Caller is responsible for -// destroying list\&. Caller should not modify the values of list items\&. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret")\&. -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i\&.e\&. use for CURVE security on socket\&. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully\&. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata\&. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcert\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zcert class provides a way to create and work with security certificates for the ZMQ CURVE mechanism\&. A certificate contains a public + secret key pair, plus metadata\&. It can be used as a temporary object in memory, or persisted to disk\&. On disk, a certificate is stored as two files\&. One is public and contains only the public key\&. The second is secret and contains both keys\&. The two have the same filename, with the secret file adding "_secret"\&. To exchange certificates, send the public file via some secure route\&. Certificates are not signed but are text files that can be verified by eye\&. -.sp -Certificates are stored in the ZPL (ZMQ RFC 4) format\&. They have two sections, "metadata" and "curve"\&. The first contains a list of \fIname = value\fR pairs, one per line\&. Values may be enclosed in quotes\&. The curve section has a \fIpublic\-key = keyvalue\fR and, for secret certificates, a \fIsecret\-key = keyvalue\fR line\&. The keyvalue is a Z85\-encoded CURVE key\&. -.SH "EXAMPLE" -.PP -\fBFrom zcert_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zcert" -zsys_dir_create (TESTDIR); - -// Create a simple certificate with metadata -zcert_t *cert = zcert_new (); -assert (cert); -zcert_set_meta (cert, "email", "ph@imatix\&.com"); -zcert_set_meta (cert, "name", "Pieter Hintjens"); -zcert_set_meta (cert, "organization", "iMatix Corporation"); -zcert_set_meta (cert, "version", "%d", 1); -zcert_set_meta (cert, "delete_me", "now"); -zcert_unset_meta (cert, "delete_me"); -assert (streq (zcert_meta (cert, "email"), "ph@imatix\&.com")); -zlist_t *keys = zcert_meta_keys (cert); -assert (zlist_size (keys) == 4); -zlist_destroy (&keys); - -// Check the dup and eq methods -zcert_t *shadow = zcert_dup (cert); -assert (zcert_eq (cert, shadow)); -zcert_destroy (&shadow); - -// Check we can save and load certificate -zcert_save (cert, TESTDIR "/mycert\&.txt"); -assert (zsys_file_exists (TESTDIR "/mycert\&.txt")); -assert (zsys_file_exists (TESTDIR "/mycert\&.txt_secret")); - -// Load certificate, will in fact load secret one -shadow = zcert_load (TESTDIR "/mycert\&.txt"); -assert (shadow); -assert (zcert_eq (cert, shadow)); -zcert_destroy (&shadow); - -// Delete secret certificate, load public one -int rc = zsys_file_delete (TESTDIR "/mycert\&.txt_secret"); -assert (rc == 0); -shadow = zcert_load (TESTDIR "/mycert\&.txt"); - -// 32\-byte null key encodes as 40 \*(Aq0\*(Aq characters -assert (streq (zcert_secret_txt (shadow), FORTY_ZEROES)); - -zcert_destroy (&shadow); -zcert_destroy (&cert); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zcertstore.3 b/external/zmq/share/man/man3/zcertstore.3 deleted file mode 100644 index 5b76f253db..0000000000 --- a/external/zmq/share/man/man3/zcertstore.3 +++ /dev/null @@ -1,173 +0,0 @@ -'\" t -.\" Title: zcertstore -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCERTSTORE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zcertstore \- work with CURVE security certificate stores -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location\&. The directory itself may be -// absent, and created later, or modified at any time\&. The certificate store -// is automatically refreshed on any zcertstore_lookup() call\&. If the -// location is specified as NULL, creates a pure\-memory store, which you -// can work with by inserting certificates at runtime\&. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory\&. Does not affect anything -// stored on disk\&. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL\&. The public key is provided in Z85 text format\&. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory\&. Note that this -// does not save the certificate to disk\&. To do that, use zcert_save() -// directly on the certificate\&. Takes ownership of zcert_t object\&. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source\&. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state\&. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn\&. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable\&. This wrapper exists to be friendly to bindings, -// which don\*(Aqt usually have access to struct internals\&. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcertstore\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -To authenticate new clients using the ZeroMQ CURVE security mechanism, we have to check that the client\(cqs public key matches a key we know and accept\&. There are numerous ways to store accepted client public keys\&. The mechanism CZMQ implements is "certificates" (plain text files) held in a "certificate store" (a disk directory)\&. This class works with such certificate stores, and lets you easily load them from disk, and check if a given client public key is known or not\&. The zcert class does the work of managing a single certificate\&. -.sp -The certificate store can be memory\-only, in which case you can load it yourself by inserting certificate objects one by one, or it can be loaded from disk, in which case you can add, modify, or remove certificates on disk at any time, and the store will detect such changes and refresh itself automatically\&. In most applications you won\(cqt use this class directly but through the zauth class, which provides a high\-level API for authentication (and manages certificate stores for you)\&. To actually create certificates on disk, use the zcert class in code, or the tools/zmakecert\&.c command line tool, or any text editor\&. The format of a certificate file is defined in the zcert man page\&. -.SH "EXAMPLE" -.PP -\fBFrom zcertstore_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zcertstore" -zsys_dir_create (TESTDIR); - -// Load certificate store from disk; it will be empty -zcertstore_t *certstore = zcertstore_new (TESTDIR); -assert (certstore); - -// Create a single new certificate and save to disk -zcert_t *cert = zcert_new (); -assert (cert); -char *client_key = strdup (zcert_public_txt (cert)); -assert (client_key); -zcert_set_meta (cert, "name", "John Doe"); -zcert_save (cert, TESTDIR "/mycert\&.txt"); -zcert_destroy (&cert); - -// Check that certificate store refreshes as expected -cert = zcertstore_lookup (certstore, client_key); -assert (cert); -assert (streq (zcert_meta (cert, "name"), "John Doe")); - -// Test custom loader -test_loader_state *state = (test_loader_state *) zmalloc (sizeof (test_loader_state)); -state\->index = 0; -zcertstore_set_loader (certstore, s_test_loader, s_test_destructor, (void *)state); -#if (ZMQ_VERSION_MAJOR >= 4) -cert = zcertstore_lookup (certstore, client_key); -assert (cert == NULL); -cert = zcertstore_lookup (certstore, "abcdefghijklmnopqrstuvwxyzabcdefghijklmn"); -assert (cert); -#endif - -free (client_key); - -if (verbose) - zcertstore_print (certstore); -zcertstore_destroy (&certstore); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zchunk.3 b/external/zmq/share/man/man3/zchunk.3 deleted file mode 100644 index 5b5d437860..0000000000 --- a/external/zmq/share/man/man3/zchunk.3 +++ /dev/null @@ -1,266 +0,0 @@ -'\" t -.\" Title: zchunk -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCHUNK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zchunk \- work with memory chunks -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new chunk of the specified size\&. If you specify the data, it -// is copied into the chunk\&. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append\&. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user\-supplied data; truncate if too large\&. Data may -// be null\&. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user\-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user\-supplied data to chunk, return resulting chunk size\&. If the -// data would exceeded the available space, it is truncated\&. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method\&. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user\-supplied data to chunk, return resulting chunk size\&. If the -// data would exceeded the available space, the chunk grows in size\&. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from \*(Aqsource\*(Aq into the chunk as possible; returns the -// new size of chunk\&. If all data from \*(Aqsource\*(Aq is used, returns exhausted -// on the source chunk\&. Source can be consumed as many times as needed until -// it is exhausted\&. If source was already exhausted, does not change chunk\&. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero\&. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk\&. Will read up to maxsize of -// the file\&. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory\&. Returns a new -// chunk containing the file data, or NULL if the file could not be read\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object\&. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory\&. If chunk is null, -// returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string\&. Caller must free -// string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class\&. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing\&. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing\&. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t\&. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zchunk\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zchunk class works with variable sized blobs\&. Not as efficient as ZeroMQ\(cqs messages but they do less weirdness and so are easier to understand\&. The chunk class has methods to read and write chunks from disk\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zchunk\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zchunk_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zchunk_t *chunk = zchunk_new ("1234567890", 10); -assert (chunk); -assert (zchunk_size (chunk) == 10); -assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); -zchunk_destroy (&chunk); - -chunk = zchunk_new (NULL, 10); -assert (chunk); -zchunk_append (chunk, "12345678", 8); -zchunk_append (chunk, "90ABCDEF", 8); -zchunk_append (chunk, "GHIJKLMN", 8); -assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); -assert (zchunk_size (chunk) == 10); -assert (zchunk_streq (chunk, "1234567890")); -assert (streq (zchunk_digest (chunk), "01B307ACBA4F54F55AAFC33BB06BBBF6CA803E9A")); -char *string = zchunk_strdup (chunk); -assert (streq (string, "1234567890")); -free (string); -string = zchunk_strhex (chunk); -assert (streq (string, "31323334353637383930")); -free (string); - -zframe_t *frame = zchunk_pack (chunk); -assert (frame); - -zchunk_t *chunk2 = zchunk_unpack (frame); -assert (chunk2); -assert (memcmp (zchunk_data (chunk2), "1234567890", 10) == 0); -zframe_destroy (&frame); -zchunk_destroy (&chunk2); - -zchunk_t *copy = zchunk_dup (chunk); -assert (copy); -assert (memcmp (zchunk_data (copy), "1234567890", 10) == 0); -assert (zchunk_size (copy) == 10); -zchunk_destroy (©); -zchunk_destroy (&chunk); - -chunk = zchunk_new (NULL, 0); -zchunk_extend (chunk, "12345678", 8); -zchunk_extend (chunk, "90ABCDEF", 8); -zchunk_extend (chunk, "GHIJKLMN", 8); -assert (zchunk_size (chunk) == 24); -assert (zchunk_streq (chunk, "1234567890ABCDEFGHIJKLMN")); -zchunk_destroy (&chunk); - -copy = zchunk_new ("1234567890abcdefghij", 20); -assert (copy); -chunk = zchunk_new (NULL, 8); -assert (chunk); -zchunk_consume (chunk, copy); -assert (!zchunk_exhausted (copy)); -assert (memcmp (zchunk_data (chunk), "12345678", 8) == 0); -zchunk_set (chunk, NULL, 0); -zchunk_consume (chunk, copy); -assert (!zchunk_exhausted (copy)); -assert (memcmp (zchunk_data (chunk), "90abcdef", 8) == 0); -zchunk_set (chunk, NULL, 0); -zchunk_consume (chunk, copy); -assert (zchunk_exhausted (copy)); -assert (zchunk_size (chunk) == 4); -assert (memcmp (zchunk_data (chunk), "ghij", 4) == 0); -zchunk_destroy (©); -zchunk_destroy (&chunk); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zclock.3 b/external/zmq/share/man/man3/zclock.3 deleted file mode 100644 index 10691d17aa..0000000000 --- a/external/zmq/share/man/man3/zclock.3 +++ /dev/null @@ -1,116 +0,0 @@ -'\" t -.\" Title: zclock -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCLOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zclock \- millisecond clocks and delays -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds\&. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets\&. Use zclock_mono for that instead\&. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds\&. Use this when you compute -// time offsets\&. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock\&. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds\&. Use this when you compute -// time offsets\&. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock\&. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string\&. Free using zstr_free()\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class\&. -CZMQ_EXPORT void - zclock_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zclock\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zclock class provides essential sleep and system time functions, used to slow down threads for testing, and calculate timers for polling\&. Wraps the non\-portable system calls in a simple portable API\&. -.sp -The Win32 Sleep() call defaults to 16ms resolution unless the system timer resolution is increased with a call to timeBeginPeriod() permitting 1ms granularity\&. -.SH "EXAMPLE" -.PP -\fBFrom zclock_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int64_t start = zclock_time (); -zclock_sleep (10); -assert ((zclock_time () \- start) >= 10); -start = zclock_mono (); -int64_t usecs = zclock_usecs (); -zclock_sleep (10); -assert ((zclock_mono () \- start) >= 10); -assert ((zclock_usecs () \- usecs) >= 10000); -char *timestr = zclock_timestr (); -if (verbose) - puts (timestr); -free (timestr); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zconfig.3 b/external/zmq/share/man/man3/zconfig.3 deleted file mode 100644 index 5cd00c9707..0000000000 --- a/external/zmq/share/man/man3/zconfig.3 +++ /dev/null @@ -1,342 +0,0 @@ -'\" t -.\" Title: zconfig -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCONFIG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zconfig \- work with config files written in rfc\&.zeromq\&.org/spec:4/ZPL\&. -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable\&. Returns NULL -// if the file does not exist\&. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename\&. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value\&. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, \&.\&.\&.) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored\&. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item\&. The new value may be a string, a printf -// format, or NULL\&. Note that if string may possibly contain \*(Aq%\*(Aq, or if it -// comes from an insecure source, you must use \*(Aq%s\*(Aq as the format, followed -// by the string\&. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored\&. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else \-1\&. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk\&. You can add as many -// comment lines as you like\&. If you use a null format, all comments are -// deleted\&. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Return comments of config item, as zlist\&. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "\-" means dump to standard output\&. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename\&. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from\&. -// Returns 0 if OK, \-1 if there was an error (and then does not change -// existing data)\&. -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null\-terminated string -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded\&. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zconfig\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Lets applications load, work with, and save configuration files\&. This implements rfc\&.zeromq\&.org/spec:4/ZPL, which is a simple structured text format for configuration files\&. -.sp -Here is an example ZPL stream and corresponding config structure: -.sp -.if n \{\ -.RS 4 -.\} -.nf -context - iothreads = 1 - verbose = 1 # Ask for a trace -main - type = zqueue # ZMQ_DEVICE type - frontend - option - hwm = 1000 - swap = 25000000 # 25MB - bind = \*(Aqinproc://addr1\*(Aq - bind = \*(Aqipc://addr2\*(Aq - backend - bind = inproc://addr3 -.fi -.if n \{\ -.RE -.\} -.sp -.if n \{\ -.RS 4 -.\} -.nf -root Down = child -| Across = next -v -context\-\->main -| | -| v -| type=queue\-\->frontend\-\->backend -| | | -| | v -| | bind=inproc://addr3 -| v -| option\-\->bind=inproc://addr1\-\->bind=ipc://addr2 -| | -| v -| hwm=1000\-\->swap=25000000 -v -iothreads=1\-\->verbose=false -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBFrom zconfig_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zconfig" -zsys_dir_create (TESTDIR); - -zconfig_t *root = zconfig_new ("root", NULL); -assert (root); -zconfig_t *section, *item; - -section = zconfig_new ("headers", root); -assert (section); -item = zconfig_new ("email", section); -assert (item); -zconfig_set_value (item, "some@random\&.com"); -item = zconfig_new ("name", section); -assert (item); -zconfig_set_value (item, "Justin Kayce"); -zconfig_putf (root, "/curve/secret\-key", "%s", "Top Secret"); -zconfig_set_comment (root, " CURVE certificate"); -zconfig_set_comment (root, " \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-"); -assert (zconfig_comments (root)); -zconfig_save (root, TESTDIR "/test\&.cfg"); -zconfig_destroy (&root); -root = zconfig_load (TESTDIR "/test\&.cfg"); -if (verbose) - zconfig_save (root, "\-"); -assert (streq (zconfig_filename (root), TESTDIR "/test\&.cfg")); - -char *email = zconfig_get (root, "/headers/email", NULL); -assert (email); -assert (streq (email, "some@random\&.com")); -char *passwd = zconfig_get (root, "/curve/secret\-key", NULL); -assert (passwd); -assert (streq (passwd, "Top Secret")); - -zconfig_savef (root, "%s/%s", TESTDIR, "test\&.cfg"); -assert (!zconfig_has_changed (root)); -int rc = zconfig_reload (&root); -assert (rc == 0); -assert (!zconfig_has_changed (root)); -zconfig_destroy (&root); - -// Test chunk load/save -root = zconfig_new ("root", NULL); -assert (root); -section = zconfig_new ("section", root); -assert (section); -item = zconfig_new ("value", section); -assert (item); -zconfig_set_value (item, "somevalue"); -zconfig_t *search = zconfig_locate (root, "section/value"); -assert (search == item); -zchunk_t *chunk = zconfig_chunk_save (root); -assert (strlen ((char *) zchunk_data (chunk)) == 32); -char *string = zconfig_str_save (root); -assert (string); -assert (streq (string, (char *) zchunk_data (chunk))); -free (string); -assert (chunk); -zconfig_destroy (&root); - -root = zconfig_chunk_load (chunk); -assert (root); -char *value = zconfig_get (root, "/section/value", NULL); -assert (value); -assert (streq (value, "somevalue")); - -// Test config can\*(Aqt be saved to a file in a path that doesn\*(Aqt -// exist or isn\*(Aqt writable -rc = zconfig_savef (root, "%s/path/that/doesnt/exist/%s", TESTDIR, "test\&.cfg"); -assert (rc == \-1); - -zconfig_destroy (&root); -zchunk_destroy (&chunk); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zctx.3 b/external/zmq/share/man/man3/zctx.3 deleted file mode 100644 index 476e1cebff..0000000000 --- a/external/zmq/share/man/man3/zctx.3 +++ /dev/null @@ -1,221 +0,0 @@ -'\" t -.\" Title: zctx -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZCTX" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zctx \- working with 0MQ contexts (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// Create new context, returns context object, replaces zmq_init -CZMQ_EXPORT zctx_t * - zctx_new (void); - -// Destroy context and all sockets in it, replaces zmq_term -CZMQ_EXPORT void - zctx_destroy (zctx_t **self_p); - -// Create new shadow context, returns context object -CZMQ_EXPORT zctx_t * - zctx_shadow (zctx_t *self); -// Raise default I/O threads from 1, for crazy heavy applications -// The rule of thumb is one I/O thread per gigabyte of traffic in -// or out\&. Call this method before creating any sockets on the context, -// or calling zctx_shadow, or the setting will have no effect\&. -CZMQ_EXPORT void - zctx_set_iothreads (zctx_t *self, int iothreads); - -// Set msecs to flush sockets when closing them, see the ZMQ_LINGER -// man page section for more details\&. By default, set to zero, so -// any in\-transit messages are discarded when you destroy a socket or -// a context\&. -CZMQ_EXPORT void - zctx_set_linger (zctx_t *self, int linger); - -// Set initial high\-water mark for inter\-thread pipe sockets\&. Note that -// this setting is separate from the default for normal sockets\&. You -// should change the default for pipe sockets *with care*\&. Too low values -// will cause blocked threads, and an infinite setting can cause memory -// exhaustion\&. The default, no matter the underlying ZeroMQ version, is -// 1,000\&. -CZMQ_EXPORT void - zctx_set_pipehwm (zctx_t *self, int pipehwm); - -// Set initial send HWM for all new normal sockets created in context\&. -// You can set this per\-socket after the socket is created\&. -// The default, no matter the underlying ZeroMQ version, is 1,000\&. -CZMQ_EXPORT void - zctx_set_sndhwm (zctx_t *self, int sndhwm); - -// Set initial receive HWM for all new normal sockets created in context\&. -// You can set this per\-socket after the socket is created\&. -// The default, no matter the underlying ZeroMQ version, is 1,000\&. -CZMQ_EXPORT void - zctx_set_rcvhwm (zctx_t *self, int rcvhwm); - -// Return low\-level 0MQ context object, will be NULL before first socket -// is created\&. Use with care\&. -CZMQ_EXPORT void * - zctx_underlying (zctx_t *self); - -// Self test of this class -CZMQ_EXPORT void - zctx_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zctx class wraps 0MQ contexts\&. It manages open sockets in the context and automatically closes these before terminating the context\&. It provides a simple way to set the linger timeout on sockets, and configure contexts for number of I/O threads\&. Sets\-up signal (interrupt) handling for the process\&. -.sp -The zctx class has these main features: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Tracks all open sockets and automatically closes them before calling zmq_term()\&. This avoids an infinite wait on open sockets\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Automatically configures sockets with a ZMQ_LINGER timeout you can define, and which defaults to zero\&. The default behavior of zctx is therefore like 0MQ/2\&.0, immediate termination with loss of any pending messages\&. You can set any linger timeout you like by calling the zctx_set_linger() method\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Moves the iothreads configuration to a separate method, so that default usage is 1 I/O thread\&. Lets you configure this value\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Sets up signal (SIGINT and SIGTERM) handling so that blocking calls such as zmq_recv() and zmq_poll() will return when the user presses Ctrl\-C\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -this class is deprecated in favor of zsock, which does not expose contexts in the API at all\&. All zsock instances use the same global context\&. -.sp .5v -.RE -.SH "EXAMPLE" -.PP -\fBFrom zctx_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create and destroy a context without using it -zctx_t *ctx = zctx_new (); -assert (ctx); -zctx_destroy (&ctx); -assert (ctx == NULL); - -// Create a context with many busy sockets, destroy it -ctx = zctx_new (); -assert (ctx); -zctx_set_iothreads (ctx, 1); -zctx_set_linger (ctx, 5); // 5 msecs -void *s1 = zctx__socket_new (ctx, ZMQ_PAIR); -assert (s1); -void *s2 = zctx__socket_new (ctx, ZMQ_XREQ); -assert (s2); -void *s3 = zctx__socket_new (ctx, ZMQ_REQ); -assert (s3); -void *s4 = zctx__socket_new (ctx, ZMQ_REP); -assert (s4); -void *s5 = zctx__socket_new (ctx, ZMQ_PUB); -assert (s5); -void *s6 = zctx__socket_new (ctx, ZMQ_SUB); -assert (s6); -int rc = zsocket_connect (s1, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -rc = zsocket_connect (s2, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -rc = zsocket_connect (s3, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -rc = zsocket_connect (s4, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -rc = zsocket_connect (s5, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -rc = zsocket_connect (s6, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -assert (zctx_underlying (ctx)); -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zdigest.3 b/external/zmq/share/man/man3/zdigest.3 deleted file mode 100644 index cabae72d05..0000000000 --- a/external/zmq/share/man/man3/zdigest.3 +++ /dev/null @@ -1,120 +0,0 @@ -'\" t -.\" Title: zdigest -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIGEST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdigest \- provides hashing functions (SHA\-1 at present) -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Constructor \- creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data\&. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data\&. If built without crypto support, -// returns NULL\&. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string\&. After calling this, you may not use zdigest_update() -// on the same digest\&. If built without crypto support, returns NULL\&. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdigest\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdigest class generates a hash from zchunks of data\&. The current algorithm is SHA\-1, chosen for speed\&. We are aiming to generate a unique digest for a file, and there are no security issues in this use case\&. -.sp -The current code depends on OpenSSL, which might be replaced by hard coded SHA\-1 implementation to reduce build dependencies\&. -.SH "EXAMPLE" -.PP -\fBFrom zdigest_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -byte *buffer = (byte *) zmalloc (1024); -memset (buffer, 0xAA, 1024); - -zdigest_t *digest = zdigest_new (); -assert (digest); -zdigest_update (digest, buffer, 1024); -const byte *data = zdigest_data (digest); -assert (data [0] == 0xDE); -assert (data [1] == 0xB2); -assert (data [2] == 0x38); -assert (data [3] == 0x07); -assert (streq (zdigest_string (digest), - "DEB23807D4FE025E900FE9A9C7D8410C3DDE9671")); -zdigest_destroy (&digest); -free (buffer); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zdir.3 b/external/zmq/share/man/man3/zdir.3 deleted file mode 100644 index 04cbc80542..0000000000 --- a/external/zmq/share/man/man3/zdir.3 +++ /dev/null @@ -1,287 +0,0 @@ -'\" t -.\" Title: zdir -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdir \- work with file\-system directories -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path\&. If parent is "\-", then -// loads only the top\-level directory, and does not use parent as a path\&. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains\&. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory\&. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree\&. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree\&. Do not destroy the -// original zdir tree until you are done with this list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels\&. If force is false, will only remove the directory if empty\&. -// If force is true, will remove all files and all subdirectories\&. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree\&. -// Returns a list of zdir_patch_t patches\&. Either older or newer may -// be null, indicating the directory is empty/absent\&. If alias is set, -// generates virtual filename (minus path, plus alias)\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA\-1 digests -// of every file in the tree\&. The cache is saved between runs in \&.cache\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data\&. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class\&. -CZMQ_EXPORT void - zdir_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdir class gives access to the file system index\&. It will load a directory tree (a directory plus all child directories) into a zdir structure and then let you navigate that structure\&. It exists mainly to wrap non\-portable OS functions to do this\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zdir_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// need to create a file in the test directory we\*(Aqre watching -// in order to ensure the directory exists -zfile_t *initfile = zfile_new ("\&./zdir\-test\-dir", "initial_file"); -assert (initfile); -zfile_output (initfile); -fprintf (zfile_handle (initfile), "initial file\en"); -zfile_close (initfile); -zfile_destroy (&initfile); - -zdir_t *older = zdir_new ("zdir\-test\-dir", NULL); -assert (older); -if (verbose) { - printf ("\en"); - zdir_dump (older, 0); -} -zdir_t *newer = zdir_new ("\&.", NULL); -assert (newer); -zlist_t *patches = zdir_diff (older, newer, "/"); -assert (patches); -while (zlist_size (patches)) { - zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); - zdir_patch_destroy (&patch); -} -zlist_destroy (&patches); -zdir_destroy (&older); -zdir_destroy (&newer); - -zdir_t *nosuch = zdir_new ("does\-not\-exist", NULL); -assert (nosuch == NULL); - -// zdir_watch test: -zactor_t *watch = zactor_new (zdir_watch, NULL); -assert (watch); - -if (verbose) { - zsock_send (watch, "s", "VERBOSE"); - assert (zsock_wait (watch) == 0); -} - -zclock_sleep (1001); // wait for initial file to become \*(Aqstable\*(Aq - -zsock_send (watch, "si", "TIMEOUT", 100); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "UNSUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zfile_t *newfile = zfile_new ("zdir\-test\-dir", "test_abc"); -zfile_output (newfile); -fprintf (zfile_handle (newfile), "test file\en"); -zfile_close (newfile); - -zpoller_t *watch_poll = zpoller_new (watch, NULL); - -// poll for a certain timeout before giving up and failing the test\&. -assert (zpoller_wait (watch_poll, 1001) == watch); - -// wait for notification of the file being added -char *path; -int rc = zsock_recv (watch, "sp", &path, &patches); -assert (rc == 0); - -assert (streq (path, "zdir\-test\-dir")); -free (path); - -assert (zlist_size (patches) == 1); - -zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); -assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); - -zfile_t *patch_file = zdir_patch_file (patch); -assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); - -zdir_patch_destroy (&patch); -zlist_destroy (&patches); - -// remove the file -zfile_remove (newfile); -zfile_destroy (&newfile); - -// poll for a certain timeout before giving up and failing the test\&. -assert (zpoller_wait (watch_poll, 1001) == watch); - -// wait for notification of the file being removed -rc = zsock_recv (watch, "sp", &path, &patches); -assert (rc == 0); - -assert (streq (path, "zdir\-test\-dir")); -free (path); - -assert (zlist_size (patches) == 1); - -patch = (zdir_patch_t *) zlist_pop (patches); -assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); - -patch_file = zdir_patch_file (patch); -assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); - -zdir_patch_destroy (&patch); -zlist_destroy (&patches); - -zpoller_destroy (&watch_poll); -zactor_destroy (&watch); - -// clean up by removing the test directory\&. -zdir_t *testdir = zdir_new ("zdir\-test\-dir", NULL); -zdir_remove (testdir, true); -zdir_destroy (&testdir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zdir_patch.3 b/external/zmq/share/man/man3/zdir_patch.3 deleted file mode 100644 index 61789b32c0..0000000000 --- a/external/zmq/share/man/man3/zdir_patch.3 +++ /dev/null @@ -1,129 +0,0 @@ -'\" t -.\" Title: zdir_patch -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIR_PATCH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdir_patch \- work with directory patches -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch\&. If the patch is null, or memory was exhausted, -// returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir_patch\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdir_patch class works with one patch, which says "create this file" or "delete this file" (referring to a zfile item each time)\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir_patch\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zdir_patch_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zfile_t *file = zfile_new ("\&.", "bilbo"); -assert (file); -zdir_patch_t *patch = zdir_patch_new ("\&.", file, patch_create, "/"); -assert (patch); -zfile_destroy (&file); - -file = zdir_patch_file (patch); -assert (file); -assert (streq (zfile_filename (file, "\&."), "bilbo")); -assert (streq (zdir_patch_vpath (patch), "/bilbo")); -zdir_patch_destroy (&patch); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zfile.3 b/external/zmq/share/man/man3/zfile.3 deleted file mode 100644 index f3b6591812..0000000000 --- a/external/zmq/share/man/man3/zfile.3 +++ /dev/null @@ -1,340 +0,0 @@ -'\" t -.\" Title: zfile -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZFILE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zfile \- provides methods to work with files in a portable fashion\&. -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// If file exists, populates properties\&. CZMQ supports portable symbolic -// links, which are files with the extension "\&.ln"\&. A symbolic link is a -// text file containing one line, the filename of a target file\&. Reading -// data from the symbolic link actually reads from the target file\&. Path -// may be NULL, in which case it is not used\&. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item\&. If the file -// is null, or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots\&. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified\&. If you want this to reflect the -// current situation, call zfile_restat before checking this property\&. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last\-known size of the file\&. If you want this to reflect the -// current situation, call zfile_restat before checking this property\&. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory\&. If you want this to reflect -// any external changes, call zfile_restat before checking this property\&. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file\&. If you want this to reflect -// any external changes, call zfile_restat before checking this property\&. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process\&. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property\&. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process\&. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property\&. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed\&. -// Updates the file statistics from disk at every call\&. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it\&. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, \-1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location\&. Returns 0 if OK, \-1 if error\&. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position\&. If this was the last chunk, -// sets the eof property\&. Returns a null chunk in case of error\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file\&. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else \-1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file\&. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file\&. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class\&. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// These methods are deprecated, and now moved to zsys class\&. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zfile\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zfile class provides methods to work with disk files\&. A file object provides the modified date, current size, and type of the file\&. You can create a file object for a filename that does not yet exist\&. To read or write data from the file, use the input and output methods, and then read and write chunks\&. The output method lets you both read and write chunks, at any offset\&. Finally, this class provides portable symbolic links\&. If a filename ends in "\&.ln", the first line of text in the file is read, and used as the underlying file for read/write operations\&. This lets you manipulate (e\&.g\&.) copy symbolic links without copying the perhaps very large files they point to\&. -.sp -This class is a new API, deprecating the old zfile class (which still exists but is implemented in zsys now)\&. -.SH "EXAMPLE" -.PP -\fBFrom zfile_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zfile_t *file = zfile_new (NULL, "bilbo"); -assert (file); -assert (streq (zfile_filename (file, "\&."), "bilbo")); -assert (zfile_is_readable (file) == false); -zfile_destroy (&file); - -// Create a test file in some random subdirectory -file = zfile_new ("\&./this/is/a/test", "bilbo"); -assert (file); -int rc = zfile_output (file); -assert (rc == 0); -zchunk_t *chunk = zchunk_new (NULL, 100); -assert (chunk); -zchunk_fill (chunk, 0, 100); - -// Write 100 bytes at position 1,000,000 in the file -rc = zfile_write (file, chunk, 1000000); -assert (rc == 0); -zchunk_destroy (&chunk); -zfile_close (file); -assert (zfile_is_readable (file)); -assert (zfile_cursize (file) == 1000100); -assert (!zfile_is_stable (file)); -assert (zfile_digest (file)); - -// Now truncate file from outside -int handle = open ("\&./this/is/a/test/bilbo", O_WRONLY | O_TRUNC | O_BINARY, 0); -assert (handle >= 0); -rc = write (handle, "Hello, World\en", 13); -assert (rc == 13); -close (handle); -assert (zfile_has_changed (file)); -zclock_sleep (1001); -assert (zfile_has_changed (file)); - -assert (!zfile_is_stable (file)); -zfile_restat (file); -assert (zfile_is_stable (file)); -assert (streq (zfile_digest (file), "4AB299C8AD6ED14F31923DD94F8B5F5CB89DFB54")); - -// Check we can read from file -rc = zfile_input (file); -assert (rc == 0); -chunk = zfile_read (file, 1000100, 0); -assert (chunk); -assert (zchunk_size (chunk) == 13); -zchunk_destroy (&chunk); -zfile_close (file); - -// Check we can read lines from file -rc = zfile_input (file); -assert (rc == 0); -const char *line = zfile_readln (file); -assert (streq (line, "Hello, World")); -line = zfile_readln (file); -assert (line == NULL); -zfile_close (file); - -// Try some fun with symbolic links -zfile_t *link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); -assert (link); -rc = zfile_output (link); -assert (rc == 0); -fprintf (zfile_handle (link), "\&./this/is/a/test/bilbo\en"); -zfile_destroy (&link); - -link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); -assert (link); -rc = zfile_input (link); -assert (rc == 0); -chunk = zfile_read (link, 1000100, 0); -assert (chunk); -assert (zchunk_size (chunk) == 13); -zchunk_destroy (&chunk); -zfile_destroy (&link); - -// Remove file and directory -zdir_t *dir = zdir_new ("\&./this", NULL); -assert (dir); -assert (zdir_cursize (dir) == 26); -zdir_remove (dir, true); -assert (zdir_cursize (dir) == 0); -zdir_destroy (&dir); - -// Check we can no longer read from file -assert (zfile_is_readable (file)); -zfile_restat (file); -assert (!zfile_is_readable (file)); -rc = zfile_input (file); -assert (rc == \-1); -zfile_destroy (&file); - -file = zfile_new ("\&./", "eof_checkfile"); -assert (file); -// 1\&. Write something first -rc = zfile_output (file); -assert (rc == 0); -chunk = zchunk_new ("123456789", 9); -assert (chunk); - -rc = zfile_write (file, chunk, 0); -assert (rc == 0); -zchunk_destroy (&chunk); -zfile_close (file); -assert (zfile_cursize (file) == 9); - -// 2\&. Read the written something -rc = zfile_input (file); -assert (rc != \-1); -// try to read more bytes than there is in the file -chunk = zfile_read (file, 1000, 0); -assert (zfile_eof(file)); -assert (zchunk_streq (chunk, "123456789")); -zchunk_destroy (&chunk); - -// reading is ok -chunk = zfile_read (file, 5, 0); -assert (!zfile_eof(file)); -assert (zchunk_streq (chunk, "12345")); -zchunk_destroy (&chunk); - -// read from non zero offset until the end -chunk = zfile_read (file, 5, 5); -assert (zfile_eof(file)); -assert (zchunk_streq (chunk, "6789")); -zchunk_destroy (&chunk); -zfile_remove (file); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zframe.3 b/external/zmq/share/man/man3/zframe.3 deleted file mode 100644 index f723dd6105..0000000000 --- a/external/zmq/share/man/man3/zframe.3 +++ /dev/null @@ -1,357 +0,0 @@ -'\" t -.\" Title: zframe -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZFRAME" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zframe \- working with single message frames -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame\&. If size is not null, allocates the frame data -// to the specified size\&. If additionally, data is not null, copies -// size octets from the specified data into the frame body\&. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero\-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content\&. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted\&. Does a blocking recv, if you want to not block then use -// zpoller or zloop\&. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending\&. -// Return \-1 on error, 0 on success\&. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it\&. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame\&. If frame is null, -// or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs\&. -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0)\&. Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly\&. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false\&. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream)\&. Prefix shows before frame, if not null\&. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t\&. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket\&. -// Else returns zero\&. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame\&. This is used if/when the frame is sent to a -// ZMQ_SERVER socket\&. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio\-dish pattern\&. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame\&. This is used if/when the frame is sent to a -// ZMQ_RADIO socket\&. -// Return \-1 on error, 0 on success\&. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zframe\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zframe class provides methods to send and receive single message frames across 0MQ sockets\&. A \fIframe\fR corresponds to one zmq_msg_t\&. When you read a frame from a socket, the zframe_more() method indicates if the frame is part of an unfinished multipart message\&. The zframe_send method normally destroys the frame, but with the ZFRAME_REUSE flag, you can send the same frame many times\&. Frames are binary, and this class has no special support for text data\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zframe\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zframe_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@tcp://127\&.0\&.0\&.1:9001"); -assert (output); -zsock_t *input = zsock_new_pair (">tcp://127\&.0\&.0\&.1:9001"); -assert (input); - -// Send five different frames, test ZFRAME_MORE -int frame_nbr; -for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { - frame = zframe_new ("Hello", 5); - assert (frame); - rc = zframe_send (&frame, output, ZFRAME_MORE); - assert (rc == 0); -} -// Send same frame five times, test ZFRAME_REUSE -frame = zframe_new ("Hello", 5); -assert (frame); -for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { - rc = zframe_send (&frame, output, ZFRAME_MORE + ZFRAME_REUSE); - assert (rc == 0); -} -assert (frame); -zframe_t *copy = zframe_dup (frame); -assert (zframe_eq (frame, copy)); -zframe_destroy (&frame); -assert (!zframe_eq (frame, copy)); -assert (zframe_size (copy) == 5); -zframe_destroy (©); -assert (!zframe_eq (frame, copy)); - -// Test zframe_new_empty -frame = zframe_new_empty (); -assert (frame); -assert (zframe_size (frame) == 0); -zframe_destroy (&frame); - -// Send END frame -frame = zframe_new ("NOT", 3); -assert (frame); -zframe_reset (frame, "END", 3); -char *string = zframe_strhex (frame); -assert (streq (string, "454E44")); -free (string); -string = zframe_strdup (frame); -assert (streq (string, "END")); -free (string); -rc = zframe_send (&frame, output, 0); -assert (rc == 0); - -// Read and count until we receive END -frame_nbr = 0; -for (frame_nbr = 0;; frame_nbr++) { - zframe_t *frame = zframe_recv (input); - if (zframe_streq (frame, "END")) { - zframe_destroy (&frame); - break; - } - assert (zframe_more (frame)); - zframe_set_more (frame, 0); - assert (zframe_more (frame) == 0); - zframe_destroy (&frame); -} -assert (frame_nbr == 10); - -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) -// Test zframe_meta -frame = zframe_new ("Hello", 5); -assert (frame); -rc = zframe_send (&frame, output, 0); -assert (rc == 0); -frame = zframe_recv (input); -const char *meta = zframe_meta (frame, "Socket\-Type"); -assert (meta != NULL); -assert (streq (meta, "PAIR")); -assert (zframe_meta (frame, "nonexistent") == NULL); -zframe_destroy (&frame); -#endif - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Create server and client sockets and connect over inproc -zsock_t *server = zsock_new_server ("inproc://zframe\-test\-routing"); -assert (server); -zsock_t *client = zsock_new_client ("inproc://zframe\-test\-routing"); -assert (client); - -// Send request from client to server -zframe_t *request = zframe_new ("Hello", 5); -assert (request); -rc = zframe_send (&request, client, 0); -assert (rc == 0); -assert (!request); - -// Read request and send reply -request = zframe_recv (server); -assert (request); -assert (zframe_streq (request, "Hello")); -assert (zframe_routing_id (request)); - -zframe_t *reply = zframe_new ("World", 5); -assert (reply); -zframe_set_routing_id (reply, zframe_routing_id (request)); -rc = zframe_send (&reply, server, 0); -assert (rc == 0); -zframe_destroy (&request); - -// Read reply -reply = zframe_recv (client); -assert (zframe_streq (reply, "World")); -assert (zframe_routing_id (reply) == 0); -zframe_destroy (&reply); - -// Client and server disallow multipart -frame = zframe_new ("Hello", 5); -rc = zframe_send (&frame, client, ZFRAME_MORE); -assert (rc == \-1); -rc = zframe_send (&frame, server, ZFRAME_MORE); -assert (rc == \-1); -zframe_destroy (&frame); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif - -#ifdef ZMQ_RADIO -// Create radio and dish sockets and connect over inproc -zsock_t *radio = zsock_new_radio ("inproc://zframe\-test\-radio"); -assert (radio); -zsock_t *dish = zsock_new_dish ("inproc://zframe\-test\-radio"); -assert (dish); - -// Join the group -rc = zsock_join (dish, "World"); -assert (rc == 0); - -// Publish message from radio -zframe_t *message = zframe_new ("Hello", 5); -assert (message); -rc = zframe_set_group (message, "World"); -assert (rc == 0); -rc = zframe_send (&message, radio, 0); -assert (rc == 0); -assert (!message); - -// Receive the message from dish -message = zframe_recv (dish); -assert (message); -assert (zframe_streq (message, "Hello")); -assert (strcmp("World", zframe_group (message)) == 0); -zframe_destroy (&message); - -zsock_destroy (&dish); -zsock_destroy (&radio); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zgossip.3 b/external/zmq/share/man/man3/zgossip.3 deleted file mode 100644 index 170d3a2271..0000000000 --- a/external/zmq/share/man/man3/zgossip.3 +++ /dev/null @@ -1,338 +0,0 @@ -'\" t -.\" Title: zgossip -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZGOSSIP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zgossip \- decentralized configuration management -.SH "SYNOPSIS" -.sp -.nf -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint\&. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zgossip\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Implements a gossip protocol for decentralized configuration management\&. Your applications nodes form a loosely connected network (which can have cycles), and publish name/value tuples\&. Each node re\-distributes the new tuples it receives, so that the entire network eventually achieves a consistent state\&. The current design does not expire tuples\&. -.sp -Provides these commands (sent as multipart strings to the actor): -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -BIND endpoint \(em binds the gossip service to specified endpoint -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PORT \(em returns the last TCP port, if any, used for binding -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -LOAD configfile \(em load configuration from specified file -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SET configpath value \(em set configuration path = value -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SAVE configfile \(em save configuration to specified file -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -CONNECT endpoint \(em connect the gossip service to the specified peer -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PUBLISH key value \(em publish a key/value pair to the gossip cluster -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -STATUS \(em return number of key/value pairs held by gossip service -.RE -.sp -Returns these messages: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PORT number \(em reply to PORT command -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -STATUS number \(em reply to STATUS command -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -DELIVER key value \(em new tuple delivered from network -.RE -.sp -The gossip protocol distributes information around a loosely\-connected network of gossip services\&. The information consists of name/value pairs published by applications at any point in the network\&. The goal of the gossip protocol is to create eventual consistency between all the using applications\&. -.sp -The name/value pairs (tuples) can be used for configuration data, for status updates, for presence, or for discovery\&. When used for discovery, the gossip protocol works as an alternative to e\&.g\&. UDP beaconing\&. -.sp -The gossip network consists of a set of loosely\-coupled nodes that exchange tuples\&. Nodes can be connected across arbitrary transports, so the gossip network can have nodes that communicate over inproc, over IPC, and/or over TCP, at the same time\&. -.sp -Each node runs the same stack, which is a server\-client hybrid using a modified Harmony pattern (from Chapter 8 of the Guide): \m[blue]\fBhttp://zguide\&.zeromq\&.org/page:all#True\-Peer\-Connectivity\-Harmony\-Pattern\fR\m[] -.sp -Each node provides a ROUTER socket that accepts client connections on an key defined by the application via a BIND command\&. The state machine for these connections is in zgossip\&.xml, and the generated code is in zgossip_engine\&.inc\&. -.sp -Each node additionally creates outbound connections via DEALER sockets to a set of servers ("remotes"), and under control of the calling app, which sends CONNECT commands for each configured remote\&. -.sp -The messages between client and server are defined in zgossip_msg\&.xml\&. We built this stack using the zeromq/zproto toolkit\&. -.sp -To join the gossip network, a node connects to one or more peers\&. Each peer acts as a forwarder\&. This loosely\-coupled network can scale to thousands of nodes\&. However the gossip protocol is NOT designed to be efficient, and should not be used for application data, as the same tuples may be sent many times across the network\&. -.sp -The basic logic of the gossip service is to accept PUBLISH messages from its owning application, and to forward these to every remote, and every client it talks to\&. When a node gets a duplicate tuple, it throws it away\&. When a node gets a new tuple, it stores it, and fowards it as just described\&. At any point the application can access the node\(cqs set of tuples\&. -.sp -At present there is no way to expire tuples from the network\&. -.sp -The assumptions in this design are: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The data set is slow\-changing\&. Thus, the cost of the gossip protocol is irrelevant with respect to other traffic\&. -.RE -.SH "EXAMPLE" -.PP -\fBFrom zgossip_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Test basic client\-to\-server operation of the protocol -zactor_t *server = zactor_new (zgossip, "server"); -assert (server); -if (verbose) - zstr_send (server, "VERBOSE"); -zstr_sendx (server, "BIND", "inproc://zgossip", NULL); - -zsock_t *client = zsock_new (ZMQ_DEALER); -assert (client); -zsock_set_rcvtimeo (client, 2000); -int rc = zsock_connect (client, "inproc://zgossip"); -assert (rc == 0); - -// Send HELLO, which gets no message -zgossip_msg_t *message = zgossip_msg_new (); -zgossip_msg_set_id (message, ZGOSSIP_MSG_HELLO); -zgossip_msg_send (message, client); - -// Send PING, expect PONG back -zgossip_msg_set_id (message, ZGOSSIP_MSG_PING); -zgossip_msg_send (message, client); -zgossip_msg_recv (message, client); -assert (zgossip_msg_id (message) == ZGOSSIP_MSG_PONG); -zgossip_msg_destroy (&message); - -zactor_destroy (&server); -zsock_destroy (&client); - -// Test peer\-to\-peer operations -zactor_t *base = zactor_new (zgossip, "base"); -assert (base); -if (verbose) - zstr_send (base, "VERBOSE"); -// Set a 100msec timeout on clients so we can test expiry -zstr_sendx (base, "SET", "server/timeout", "100", NULL); -zstr_sendx (base, "BIND", "inproc://base", NULL); - -zactor_t *alpha = zactor_new (zgossip, "alpha"); -assert (alpha); -zstr_sendx (alpha, "CONNECT", "inproc://base", NULL); -zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-1", "service1", NULL); -zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-2", "service2", NULL); - -zactor_t *beta = zactor_new (zgossip, "beta"); -assert (beta); -zstr_sendx (beta, "CONNECT", "inproc://base", NULL); -zstr_sendx (beta, "PUBLISH", "inproc://beta\-1", "service1", NULL); -zstr_sendx (beta, "PUBLISH", "inproc://beta\-2", "service2", NULL); - -// got nothing -zclock_sleep (200); - -zactor_destroy (&base); -zactor_destroy (&alpha); -zactor_destroy (&beta); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zhash.3 b/external/zmq/share/man/man3/zhash.3 deleted file mode 100644 index 8d0d45ab3f..0000000000 --- a/external/zmq/share/man/man3/zhash.3 +++ /dev/null @@ -1,382 +0,0 @@ -'\" t -.\" Title: zhash -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZHASH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zhash \- simple generic hash container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table\&. Packed data must follow format -// defined by zhash_pack\&. Hash table is set to autofree\&. An empty frame -// unpacks to an empty hash table\&. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item\&. -// If key is already present returns \-1 and leaves existing item unchanged -// Returns 0 on success\&. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item\&. -// If key is already present, destroys old item and inserts new one\&. -// Use free_fn method to ensure deallocator is properly called on item\&. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table\&. If there was no such -// item, this function does nothing\&. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key\&. If there was no such -// item, does nothing\&. Returns 0 if successful, else \-1\&. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when hash items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null\&. -// Does not copy items themselves\&. Rebuilds new table so may be slow on -// very large tables\&. NOTE: only works with item values that are strings -// since there\*(Aqs no other way to know how to duplicate the item value\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty\&. This method is simpler to use than the -// foreach() method, which is deprecated\&. To access the key for this item -// use zhash_cursor()\&. NOTE: do NOT modify the table while iterating\&. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned\&. Use this together with -// zhash_first() to process all items in a hash table\&. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort()\&. To -// access the key for this item use zhash_cursor()\&. NOTE: do NOT modify -// the table while iterating\&. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned\&. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash\&. After an -// unsuccessful first/next, returns NULL\&. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk\&. You can add as many -// comment lines as you like\&. These comment lines are discarded when loading -// the file\&. If you use a null format, all comments are deleted\&. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message\&. -// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in -// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict\-count *( dict\-name dict\-value ) -// dict\-count = number\-4 -// dict\-value = longstr -// dict\-name = string -// -// ; Strings are always length + text contents -// longstr = number\-4 *VCHAR -// string = number\-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number\-1 = 1OCTET -// number\-4 = 4OCTET -// -// Comments are not included in the packed data\&. Item values MUST be -// strings\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format\&. Hash values must be -// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, -// else \-1 if a file error occurred\&. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist\&. Hash values must printable strings; keys may not contain -// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i\&.e\&. not -// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the -// file\&. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zhash_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhash\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zhash is an expandable hash table container\&. This is a simple container\&. For heavy\-duty applications we recommend using zhashx\&. -.sp -Note that it\(cqs relatively slow (50K insertions/deletes per second), so don\(cqt do inserts/updates on the critical path for message I/O\&. It can do 2\&.5M lookups per second for 16\-char keys\&. Timed on a 1\&.6GHz CPU\&. -.SH "EXAMPLE" -.PP -\fBFrom zhash_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zhash_t *hash = zhash_new (); -assert (hash); -assert (zhash_size (hash) == 0); -assert (zhash_first (hash) == NULL); -assert (zhash_cursor (hash) == NULL); - -// Insert some items -int rc; -rc = zhash_insert (hash, "DEADBEEF", "dead beef"); -char *item = (char *) zhash_first (hash); -assert (streq (zhash_cursor (hash), "DEADBEEF")); -assert (streq (item, "dead beef")); -assert (rc == 0); -rc = zhash_insert (hash, "ABADCAFE", "a bad cafe"); -assert (rc == 0); -rc = zhash_insert (hash, "C0DEDBAD", "coded bad"); -assert (rc == 0); -rc = zhash_insert (hash, "DEADF00D", "dead food"); -assert (rc == 0); -assert (zhash_size (hash) == 4); - -// Look for existing items -item = (char *) zhash_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhash_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); -item = (char *) zhash_lookup (hash, "C0DEDBAD"); -assert (streq (item, "coded bad")); -item = (char *) zhash_lookup (hash, "DEADF00D"); -assert (streq (item, "dead food")); - -// Look for non\-existent items -item = (char *) zhash_lookup (hash, "foo"); -assert (item == NULL); - -// Try to insert duplicate items -rc = zhash_insert (hash, "DEADBEEF", "foo"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); - -// Some rename tests - -// Valid rename, key is now LIVEBEEF -rc = zhash_rename (hash, "DEADBEEF", "LIVEBEEF"); -assert (rc == 0); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an unknown item to a non\-existent key -rc = zhash_rename (hash, "WHATBEEF", "NONESUCH"); -assert (rc == \-1); - -// Trying to rename an unknown item to an existing key -rc = zhash_rename (hash, "WHATBEEF", "LIVEBEEF"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an existing item to another existing item -rc = zhash_rename (hash, "LIVEBEEF", "ABADCAFE"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhash_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); - -// Test keys method -zlist_t *keys = zhash_keys (hash); -assert (zlist_size (keys) == 4); -zlist_destroy (&keys); - -// Test dup method -zhash_t *copy = zhash_dup (hash); -assert (zhash_size (copy) == 4); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); - -// Test pack/unpack methods -zframe_t *frame = zhash_pack (hash); -copy = zhash_unpack (frame); -zframe_destroy (&frame); -assert (zhash_size (copy) == 4); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); - -// Test save and load -zhash_comment (hash, "This is a test file"); -zhash_comment (hash, "Created by %s", "czmq_selftest"); -zhash_save (hash, "\&.cache"); -copy = zhash_new (); -assert (copy); -zhash_load (copy, "\&.cache"); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); -zsys_file_delete ("\&.cache"); - -// Delete a item -zhash_delete (hash, "LIVEBEEF"); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (item == NULL); -assert (zhash_size (hash) == 3); - -// Check that the queue is robust against random usage -struct { - char name [100]; - bool exists; -} testset [200]; -memset (testset, 0, sizeof (testset)); -int testmax = 200, testnbr, iteration; - -srandom ((unsigned) time (NULL)); -for (iteration = 0; iteration < 25000; iteration++) { - testnbr = randof (testmax); - assert (testnbr != testmax); - assert (testnbr < testmax); - if (testset [testnbr]\&.exists) { - item = (char *) zhash_lookup (hash, testset [testnbr]\&.name); - assert (item); - zhash_delete (hash, testset [testnbr]\&.name); - testset [testnbr]\&.exists = false; - } - else { - sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); - if (zhash_insert (hash, testset [testnbr]\&.name, "") == 0) - testset [testnbr]\&.exists = true; - } -} -// Test 10K lookups -for (iteration = 0; iteration < 10000; iteration++) - item = (char *) zhash_lookup (hash, "DEADBEEFABADCAFE"); - -// Destructor should be safe to call twice -zhash_destroy (&hash); -zhash_destroy (&hash); -assert (hash == NULL); - -// Test autofree; automatically copies and frees string values -hash = zhash_new (); -assert (hash); -zhash_autofree (hash); -char value [255]; -strcpy (value, "This is a string"); -rc = zhash_insert (hash, "key1", value); -assert (rc == 0); -strcpy (value, "Inserting with the same key will fail"); -rc = zhash_insert (hash, "key1", value); -assert (rc == \-1); -strcpy (value, "Ring a ding ding"); -rc = zhash_insert (hash, "key2", value); -assert (rc == 0); -assert (streq ((char *) zhash_lookup (hash, "key1"), "This is a string")); -assert (streq ((char *) zhash_lookup (hash, "key2"), "Ring a ding ding")); -zhash_destroy (&hash); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zhashx.3 b/external/zmq/share/man/man3/zhashx.3 deleted file mode 100644 index d78b29a431..0000000000 --- a/external/zmq/share/man/man3/zhashx.3 +++ /dev/null @@ -1,498 +0,0 @@ -'\" t -.\" Title: zhashx -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZHASHX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zhashx \- extended generic hash container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr\&. -// The caller takes ownership of the newly created object\&. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item\&. -// The caller takes ownership of the newly created object\&. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table\&. Packed data must follow format -// defined by zhashx_pack\&. Hash table is set to autofree\&. An empty frame -// unpacks to an empty hash table\&. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item\&. -// If key is already present returns \-1 and leaves existing item unchanged -// Returns 0 on success\&. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item\&. If the -// key is already present, destroys old item and inserts new one\&. If you set -// a container item destructor, this is called on the old value\&. If the key -// was not already present, inserts a new item\&. Sets the hash cursor to the -// new item\&. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table\&. If there was no such -// item, this function does nothing\&. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table\&. If the key destructor is -// set, calls it on every key\&. If the item destructor is set, calls -// it on every item\&. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key\&. If there was no such -// item, does nothing\&. Returns 0 if successful, else \-1\&. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when hash items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table\&. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table\&. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty\&. This method is simpler to use than the -// foreach() method, which is deprecated\&. To access the key for this item -// use zhashx_cursor()\&. NOTE: do NOT modify the table while iterating\&. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned\&. Use this together with -// zhashx_first() to process all items in a hash table\&. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort()\&. To -// access the key for this item use zhashx_cursor()\&. NOTE: do NOT modify -// the table while iterating\&. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned\&. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash\&. After an -// unsuccessful first/next, returns NULL\&. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk\&. You can add as many -// comment lines as you like\&. These comment lines are discarded when loading -// the file\&. If you use a null format, all comments are deleted\&. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format\&. Hash values must be -// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, -// else \-1 if a file error occurred\&. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist\&. Hash values must printable strings; keys may not contain -// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i\&.e\&. not -// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the -// file\&. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message\&. -// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in -// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict\-count *( dict\-name dict\-value ) -// dict\-count = number\-4 -// dict\-value = longstr -// dict\-name = string -// -// ; Strings are always length + text contents -// longstr = number\-4 *VCHAR -// string = number\-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number\-1 = 1OCTET -// number\-4 = 4OCTET -// -// Comments are not included in the packed data\&. Item values MUST be -// strings\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not\&. Copying a null reference returns a null -// reference\&. Note that this method\*(Aqs behavior changed slightly for CZMQ -// v3\&.x, as it does not set nor respect autofree\&. It does however let you -// duplicate any hash table safely\&. The old behavior is in zhashx_dup_v2\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user\-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed\&. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user\-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated\&. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user\-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free()\&. -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user\-defined duplicator for keys; by default keys are duplicated -// using strdup\&. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user\-defined comparator for keys; by default keys are -// compared using strcmp\&. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user\-defined comparator for keys; by default keys are -// compared using strcmp\&. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null\&. -// Does not copy items themselves\&. Rebuilds new table so may be slow on -// very large tables\&. NOTE: only works with item values that are strings -// since there\*(Aqs no other way to know how to duplicate the item value\&. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user\-defined deserializer function to convert -// a longstr back into item format\&. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user\-defined serializer function to convert items -// into longstr\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhashx\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zhashx is an extended hash table container with more functionality than zhash, its simpler cousin\&. -.sp -The hash table always has a size that is prime and roughly doubles its size when 75% full\&. In case of hash collisions items are chained in a linked list\&. The hash table size is increased slightly (up to 5 times before roughly doubling the size) when an overly long chain (between 1 and 63 items depending on table size) is detected\&. -.SH "EXAMPLE" -.PP -\fBFrom zhashx_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zhashx_t *hash = zhashx_new (); -assert (hash); -assert (zhashx_size (hash) == 0); -assert (zhashx_first (hash) == NULL); -assert (zhashx_cursor (hash) == NULL); - -// Insert some items -int rc; -rc = zhashx_insert (hash, "DEADBEEF", "dead beef"); -char *item = (char *) zhashx_first (hash); -assert (streq ((char *) zhashx_cursor (hash), "DEADBEEF")); -assert (streq (item, "dead beef")); -assert (rc == 0); -rc = zhashx_insert (hash, "ABADCAFE", "a bad cafe"); -assert (rc == 0); -rc = zhashx_insert (hash, "C0DEDBAD", "coded bad"); -assert (rc == 0); -rc = zhashx_insert (hash, "DEADF00D", "dead food"); -assert (rc == 0); -assert (zhashx_size (hash) == 4); - -// Look for existing items -item = (char *) zhashx_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhashx_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); -item = (char *) zhashx_lookup (hash, "C0DEDBAD"); -assert (streq (item, "coded bad")); -item = (char *) zhashx_lookup (hash, "DEADF00D"); -assert (streq (item, "dead food")); - -// Look for non\-existent items -item = (char *) zhashx_lookup (hash, "foo"); -assert (item == NULL); - -// Try to insert duplicate items -rc = zhashx_insert (hash, "DEADBEEF", "foo"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); - -// Some rename tests - -// Valid rename, key is now LIVEBEEF -rc = zhashx_rename (hash, "DEADBEEF", "LIVEBEEF"); -assert (rc == 0); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an unknown item to a non\-existent key -rc = zhashx_rename (hash, "WHATBEEF", "NONESUCH"); -assert (rc == \-1); - -// Trying to rename an unknown item to an existing key -rc = zhashx_rename (hash, "WHATBEEF", "LIVEBEEF"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an existing item to another existing item -rc = zhashx_rename (hash, "LIVEBEEF", "ABADCAFE"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhashx_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); - -// Test keys method -zlistx_t *keys = zhashx_keys (hash); -assert (zlistx_size (keys) == 4); -zlistx_destroy (&keys); - -zlistx_t *values = zhashx_values(hash); -assert (zlistx_size (values) == 4); -zlistx_destroy (&values); - -// Test dup method -zhashx_t *copy = zhashx_dup (hash); -assert (zhashx_size (copy) == 4); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); - -// Test pack/unpack methods -zframe_t *frame = zhashx_pack (hash); -copy = zhashx_unpack (frame); -zframe_destroy (&frame); -assert (zhashx_size (copy) == 4); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); - -#ifdef CZMQ_BUILD_DRAFT_API -// Test own pack/unpack methods -zhashx_t *own_hash = zhashx_new (); -zhashx_set_destructor (own_hash, s_test_destroy_int); -assert (own_hash); -int *val1 = (int *) zmalloc (sizeof (int)); -int *val2 = (int *) zmalloc (sizeof (int)); -*val1 = 25; -*val2 = 100; -zhashx_insert (own_hash, "val1", val1); -zhashx_insert (own_hash, "val2", val2); -frame = zhashx_pack_own (own_hash, s_test_serialize_int); -copy = zhashx_unpack_own (frame, s_test_deserialze_int); -zhashx_set_destructor (copy, s_test_destroy_int); -zframe_destroy (&frame); -assert (zhashx_size (copy) == 2); -assert (*((int *) zhashx_lookup (copy, "val1")) == 25); -assert (*((int *) zhashx_lookup (copy, "val2")) == 100); -zhashx_destroy (©); -zhashx_destroy (&own_hash); -#endif // CZMQ_BUILD_DRAFT_API - -// Test save and load -zhashx_comment (hash, "This is a test file"); -zhashx_comment (hash, "Created by %s", "czmq_selftest"); -zhashx_save (hash, "\&.cache"); -copy = zhashx_new (); -assert (copy); -zhashx_load (copy, "\&.cache"); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); -zsys_file_delete ("\&.cache"); - -// Delete a item -zhashx_delete (hash, "LIVEBEEF"); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (item == NULL); -assert (zhashx_size (hash) == 3); - -// Check that the queue is robust against random usage -struct { - char name [100]; - bool exists; -} testset [200]; -memset (testset, 0, sizeof (testset)); -int testmax = 200, testnbr, iteration; - -srandom ((unsigned) time (NULL)); -for (iteration = 0; iteration < 25000; iteration++) { - testnbr = randof (testmax); - if (testset [testnbr]\&.exists) { - item = (char *) zhashx_lookup (hash, testset [testnbr]\&.name); - assert (item); - zhashx_delete (hash, testset [testnbr]\&.name); - testset [testnbr]\&.exists = false; - } - else { - sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); - if (zhashx_insert (hash, testset [testnbr]\&.name, "") == 0) - testset [testnbr]\&.exists = true; - } -} -// Test 10K lookups -for (iteration = 0; iteration < 10000; iteration++) - item = (char *) zhashx_lookup (hash, "DEADBEEFABADCAFE"); - -// Destructor should be safe to call twice -zhashx_destroy (&hash); -zhashx_destroy (&hash); -assert (hash == NULL); - -// Test destructor; automatically copies and frees string values -hash = zhashx_new (); -assert (hash); -zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); -zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); -char value [255]; -strcpy (value, "This is a string"); -rc = zhashx_insert (hash, "key1", value); -assert (rc == 0); -strcpy (value, "Ring a ding ding"); -rc = zhashx_insert (hash, "key2", value); -assert (rc == 0); -assert (streq ((char *) zhashx_lookup (hash, "key1"), "This is a string")); -assert (streq ((char *) zhashx_lookup (hash, "key2"), "Ring a ding ding")); -zhashx_destroy (&hash); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/ziflist.3 b/external/zmq/share/man/man3/ziflist.3 deleted file mode 100644 index b50b06c0f3..0000000000 --- a/external/zmq/share/man/man3/ziflist.3 +++ /dev/null @@ -1,134 +0,0 @@ -'\" t -.\" Title: ziflist -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZIFLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ziflist \- list of network interfaces available on system -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces\&. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ziflist\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The ziflist class takes a snapshot of the network interfaces that the system currently supports (this can change arbitrarily, especially on mobile devices)\&. The caller can then access the network interface information using an iterator that works like zlistx\&. Only stores those interfaces with broadcast capability, and ignores the loopback interface\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ziflist\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom ziflist_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -ziflist_t *iflist = ziflist_new (); -assert (iflist); - -size_t items = ziflist_size (iflist); - -if (verbose) { - printf ("ziflist: interfaces=%zu\en", ziflist_size (iflist)); - const char *name = ziflist_first (iflist); - while (name) { - printf (" \- name=%s address=%s netmask=%s broadcast=%s\en", - name, ziflist_address (iflist), ziflist_netmask (iflist), ziflist_broadcast (iflist)); - name = ziflist_next (iflist); - } -} -ziflist_reload (iflist); -assert (items == ziflist_size (iflist)); -ziflist_destroy (&iflist); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zlist.3 b/external/zmq/share/man/man3/zlist.3 deleted file mode 100644 index a7131f40e0..0000000000 --- a/external/zmq/share/man/man3/zlist.3 +++ /dev/null @@ -1,316 +0,0 @@ -'\" t -.\" Title: zlist -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zlist \- simple generic list container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Comparison function e\&.g\&. for sorting and removing\&. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the head item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item\&. If the list is empty, returns NULL\&. To move to -// the start of the list call zlist_first ()\&. Advances the cursor\&. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the current item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or \-1 if this -// failed for some reason (out of memory)\&. Note that if a duplicator has -// been set, this method will also duplicate the item\&. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or \-1 if this -// failed for some reason (out of memory)\&. Note that if a duplicator has -// been set, this method will also duplicate the item\&. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present\&. Uses compare method to determine if -// items are equal\&. If the compare method is NULL the check will only compare -// pointers\&. Returns true if item is present else false\&. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list\&. If the list has autofree set, the copied list will -// duplicate all items, which must be strings\&. Otherwise, the list will hold -// pointers back to the items in the original list\&. If list is null, returns -// NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list\&. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison\&. If you specify -// a compare function, this decides how items are sorted\&. The sort is not -// stable, so may reorder items with the same keys\&. The algorithm used is -// combsort, a compromise between performance and simplicity\&. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings\&. -// By default a list item refers to a value held elsewhere\&. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value\&. Then, when you destroy the list, it will free all -// item values automatically\&. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list\&. -// The usual technique is to pop list items and destroy them, until the -// list is empty\&. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list\&. The function compares two items\&. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item\&. -// This function is used for sorting, removal and exists checking\&. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when list items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class\&. -CZMQ_EXPORT void - zlist_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlist\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Provides a generic container implementing a fast singly\-linked list\&. You can use this to construct multi\-dimensional lists, and other structures together with other generic containers like zhash\&. This is a simple class\&. For demanding applications we recommend using zlistx\&. -.sp -To iterate through a list, use zlist_first to get the first item, then loop while not null, and do zlist_next at the end of each iteration\&. -.SH "EXAMPLE" -.PP -\fBFrom zlist_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zlist_t *list = zlist_new (); -assert (list); -assert (zlist_size (list) == 0); - -// Three items we\*(Aqll use as test data -// List items are void *, not particularly strings -char *cheese = "boursin"; -char *bread = "baguette"; -char *wine = "bordeaux"; - -zlist_append (list, cheese); -assert (zlist_size (list) == 1); -assert ( zlist_exists (list, cheese)); -assert (!zlist_exists (list, bread)); -assert (!zlist_exists (list, wine)); -zlist_append (list, bread); -assert (zlist_size (list) == 2); -assert ( zlist_exists (list, cheese)); -assert ( zlist_exists (list, bread)); -assert (!zlist_exists (list, wine)); -zlist_append (list, wine); -assert (zlist_size (list) == 3); -assert ( zlist_exists (list, cheese)); -assert ( zlist_exists (list, bread)); -assert ( zlist_exists (list, wine)); - -assert (zlist_head (list) == cheese); -assert (zlist_next (list) == cheese); - -assert (zlist_first (list) == cheese); -assert (zlist_tail (list) == wine); -assert (zlist_next (list) == bread); - -assert (zlist_first (list) == cheese); -assert (zlist_next (list) == bread); -assert (zlist_next (list) == wine); -assert (zlist_next (list) == NULL); -// After we reach end of list, next wraps around -assert (zlist_next (list) == cheese); -assert (zlist_size (list) == 3); - -zlist_remove (list, wine); -assert (zlist_size (list) == 2); - -assert (zlist_first (list) == cheese); -zlist_remove (list, cheese); -assert (zlist_size (list) == 1); -assert (zlist_first (list) == bread); - -zlist_remove (list, bread); -assert (zlist_size (list) == 0); - -zlist_append (list, cheese); -zlist_append (list, bread); -assert (zlist_last (list) == bread); -zlist_remove (list, bread); -assert (zlist_last (list) == cheese); -zlist_remove (list, cheese); -assert (zlist_last (list) == NULL); - -zlist_push (list, cheese); -assert (zlist_size (list) == 1); -assert (zlist_first (list) == cheese); - -zlist_push (list, bread); -assert (zlist_size (list) == 2); -assert (zlist_first (list) == bread); -assert (zlist_item (list) == bread); - -zlist_append (list, wine); -assert (zlist_size (list) == 3); -assert (zlist_first (list) == bread); - -zlist_t *sub_list = zlist_dup (list); -assert (sub_list); -assert (zlist_size (sub_list) == 3); - -zlist_sort (list, NULL); -char *item; -item = (char *) zlist_pop (list); -assert (item == bread); -item = (char *) zlist_pop (list); -assert (item == wine); -item = (char *) zlist_pop (list); -assert (item == cheese); -assert (zlist_size (list) == 0); - -assert (zlist_size (sub_list) == 3); -zlist_push (list, sub_list); -zlist_t *sub_list_2 = zlist_dup (sub_list); -zlist_append (list, sub_list_2); -assert (zlist_freefn (list, sub_list, &s_zlist_free, false) == sub_list); -assert (zlist_freefn (list, sub_list_2, &s_zlist_free, true) == sub_list_2); -zlist_destroy (&list); - -// Test autofree functionality -list = zlist_new (); -assert (list); -zlist_autofree (list); -// Set equals function otherwise equals will not work as autofree copies strings -zlist_comparefn (list, (zlist_compare_fn *) strcmp); -zlist_push (list, bread); -zlist_append (list, cheese); -assert (zlist_size (list) == 2); -zlist_append (list, wine); -assert (zlist_exists (list, wine)); -zlist_remove (list, wine); -assert (!zlist_exists (list, wine)); -assert (streq ((const char *) zlist_first (list), bread)); -item = (char *) zlist_pop (list); -assert (streq (item, bread)); -free (item); -item = (char *) zlist_pop (list); -assert (streq (item, cheese)); -free (item); - -zlist_destroy (&list); -assert (list == NULL); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zlistx.3 b/external/zmq/share/man/man3/zlistx.3 deleted file mode 100644 index 2e1068554b..0000000000 --- a/external/zmq/share/man/man3/zlistx.3 +++ /dev/null @@ -1,346 +0,0 @@ -'\" t -.\" Title: zlistx -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLISTX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zlistx \- extended generic list container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list\&. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list\&. If an item destructor was specified, all items in the -// list are automatically destroyed as well\&. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list\&. Calls the item duplicator, if any, -// on the item\&. Resets cursor to list head\&. Returns an item handle on -// success, NULL if memory was exhausted\&. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list\&. Calls the item duplicator, if any, -// on the item\&. Resets cursor to list head\&. Returns an item handle on -// success, NULL if memory was exhausted\&. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the head item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item\&. At the end of the list (or in an empty list), -// returns NULL\&. Use repeated zlistx_next () calls to work through the list -// from zlistx_first ()\&. First time, acts as zlistx_first()\&. -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item\&. At the start of the list (or in an empty list), -// returns NULL\&. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last ()\&. First time, acts as zlistx_last()\&. -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item\&. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item\&. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL\&. Asserts that the passed in handle points to a list element\&. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start\&. Uses the item -// comparator, if any, else compares item values directly\&. Returns the -// item handle found, or NULL\&. Sets the cursor to the found item, if any\&. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle\&. The item is not modified, -// and the caller is responsible for destroying it if necessary\&. If handle is -// null, detaches the first item on the list\&. Returns item that was detached, -// or null if none was\&. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list\&. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list\&. The item is not modified, -// and the caller is responsible for destroying it as necessary\&. Returns item -// that was detached, or null if none was\&. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list\&. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle\&. Calls the item destructor is any is -// set\&. If handle is null, deletes the first item on the list\&. Returns 0 -// if an item was deleted, \-1 if not\&. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list\&. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle\&. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle\&. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set\&. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list\&. If an item comparator was set, calls that to compare -// items, otherwise compares on item value\&. The sort is not stable, so may -// reorder equal items\&. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list\&. Calls the item -// duplicator, if any, on the item\&. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end\&. Use the item -// comparator, if any, to find where to place the new node\&. Returns a handle -// to the new node, or NULL if memory was exhausted\&. Resets the cursor to the -// list head\&. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list\&. Uses -// the item comparator, if any, to determine the new location\&. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end\&. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not\&. Copying a null reference returns a null -// reference\&. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user\-defined deallocator for list items; by default items are not -// freed when the list is destroyed\&. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user\-defined duplicator for list items; by default items are not -// copied when the list is duplicated\&. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user\-defined comparator for zlistx_find and zlistx_sort; the method -// must return \-1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2\&. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class\&. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlistx\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Provides a generic doubly\-linked list container\&. This container provides hooks for duplicator, comparator, and destructor functions\&. These tie into CZMQ and standard C semantics, so e\&.g\&. for string items you can use strdup, strcmp, and zstr_free\&. To store custom objects, define your own duplicator and comparator, and use the standard object destructor\&. -.sp -This is a reworking of the simpler zlist container\&. It is faster to insert and delete items anywhere in the list, and to keep ordered lists\&. -.SH "EXAMPLE" -.PP -\fBFrom zlistx_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zlistx_t *list = zlistx_new (); -assert (list); -assert (zlistx_size (list) == 0); - -// Test operations on an empty list -assert (zlistx_first (list) == NULL); -assert (zlistx_last (list) == NULL); -assert (zlistx_next (list) == NULL); -assert (zlistx_prev (list) == NULL); -assert (zlistx_find (list, "hello") == NULL); -assert (zlistx_delete (list, NULL) == \-1); -assert (zlistx_detach (list, NULL) == NULL); -assert (zlistx_delete (list, NULL) == \-1); -assert (zlistx_detach (list, NULL) == NULL); -zlistx_purge (list); -zlistx_sort (list); - -// Use item handlers -zlistx_set_destructor (list, (zlistx_destructor_fn *) zstr_free); -zlistx_set_duplicator (list, (zlistx_duplicator_fn *) strdup); -zlistx_set_comparator (list, (zlistx_comparator_fn *) strcmp); - -// Try simple insert/sort/delete/next -assert (zlistx_next (list) == NULL); -zlistx_add_end (list, "world"); -assert (streq ((char *) zlistx_next (list), "world")); -zlistx_add_end (list, "hello"); -assert (streq ((char *) zlistx_prev (list), "hello")); -zlistx_sort (list); -assert (zlistx_size (list) == 2); -void *handle = zlistx_find (list, "hello"); -char *item1 = (char *) zlistx_item (list); -char *item2 = (char *) zlistx_handle_item (handle); -assert (item1 == item2); -assert (streq (item1, "hello")); -zlistx_delete (list, handle); -assert (zlistx_size (list) == 1); -char *string = (char *) zlistx_detach (list, NULL); -assert (streq (string, "world")); -free (string); -assert (zlistx_size (list) == 0); - -// Check next/back work -// Now populate the list with items -zlistx_add_start (list, "five"); -zlistx_add_end (list, "six"); -zlistx_add_start (list, "four"); -zlistx_add_end (list, "seven"); -zlistx_add_start (list, "three"); -zlistx_add_end (list, "eight"); -zlistx_add_start (list, "two"); -zlistx_add_end (list, "nine"); -zlistx_add_start (list, "one"); -zlistx_add_end (list, "ten"); - -// Test our navigation skills -assert (zlistx_size (list) == 10); -assert (streq ((char *) zlistx_last (list), "ten")); -assert (streq ((char *) zlistx_prev (list), "nine")); -assert (streq ((char *) zlistx_prev (list), "eight")); -assert (streq ((char *) zlistx_prev (list), "seven")); -assert (streq ((char *) zlistx_prev (list), "six")); -assert (streq ((char *) zlistx_prev (list), "five")); -assert (streq ((char *) zlistx_first (list), "one")); -assert (streq ((char *) zlistx_next (list), "two")); -assert (streq ((char *) zlistx_next (list), "three")); -assert (streq ((char *) zlistx_next (list), "four")); - -// Sort by alphabetical order -zlistx_sort (list); -assert (streq ((char *) zlistx_first (list), "eight")); -assert (streq ((char *) zlistx_last (list), "two")); - -// Moving items around -handle = zlistx_find (list, "six"); -zlistx_move_start (list, handle); -assert (streq ((char *) zlistx_first (list), "six")); -zlistx_move_end (list, handle); -assert (streq ((char *) zlistx_last (list), "six")); -zlistx_sort (list); -assert (streq ((char *) zlistx_last (list), "two")); - -// Copying a list -zlistx_t *copy = zlistx_dup (list); -assert (copy); -assert (zlistx_size (copy) == 10); -assert (streq ((char *) zlistx_first (copy), "eight")); -assert (streq ((char *) zlistx_last (copy), "two")); -zlistx_destroy (©); - -// Delete items while iterating -string = (char *) zlistx_first (list); -assert (streq (string, "eight")); -string = (char *) zlistx_next (list); -assert (streq (string, "five")); -zlistx_delete (list, zlistx_cursor (list)); -string = (char *) zlistx_next (list); -assert (streq (string, "four")); - -zlistx_purge (list); -zlistx_destroy (&list); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zloop.3 b/external/zmq/share/man/man3/zloop.3 deleted file mode 100644 index 7d5c84949f..0000000000 --- a/external/zmq/share/man/man3/zloop.3 +++ /dev/null @@ -1,261 +0,0 @@ -'\" t -.\" Title: zloop -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLOOP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zloop \- event\-driven reactor -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low\-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor\&. When the reader has messages, -// the reactor will call the handler, passing the arg\&. Returns 0 if OK, \-1 -// if there was an error\&. If you register the same socket more than once, -// each instance will invoke its corresponding handler\&. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor\&. If multiple readers exist for -// same socket, cancels ALL of them\&. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors\&. If you do not set this, -// then readers that have errors are removed from the reactor silently\&. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low\-level libzmq pollitem with the reactor\&. When the pollitem -// is ready, will call the handler, passing the arg\&. Returns 0 if OK, \-1 -// if there was an error\&. If you register the pollitem more than once, each -// instance will invoke its corresponding handler\&. A pollitem with -// socket=NULL and fd=0 means \*(Aqpoll on FD zero\*(Aq\&. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD\&. If both -// are specified, uses only socket\&. If multiple poll items exist for same -// socket/FD, cancels ALL of them\&. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors\&. If you do not set this, -// then poller that have errors are removed from the reactor silently\&. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times\&. At each expiry, will call the handler, passing the arg\&. To run a -// timer forever, use 0 times\&. Returns a timer_id that is used to cancel the -// timer in the future\&. Returns \-1 if there was an error\&. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer)\&. -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer\&. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them\&. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client\&. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients\&. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket\&. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete\&. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time\&. This is a very fast operation\&. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer\&. We do not actually delete the ticket here, as -// other code may still refer to the ticket\&. We mark as deleted, and remove -// later and safely\&. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets\&. If you lower the -// delay and there are already tickets created, the results are undefined\&. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed\&. Setting more than a small -// number of timers (10\-100) can have a dramatic impact on the performance -// of the reactor\&. For high\-volume cases, use ticket timers\&. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error\&. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off\&. The default verbose setting is -// off (false)\&. -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal\&. This makes it impossible to shut\-down message based architectures -// like zactors\&. This method lets you switch off break handling\&. The default -// nonstop setting is off (false)\&. -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor\&. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns \-1\&. Event handlers may register new sockets and timers, and -// cancel sockets\&. Returns 0 if interrupted, \-1 if canceled by a handler\&. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zloop_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zloop\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zloop class provides an event\-driven reactor pattern\&. The reactor handles zmq_pollitem_t items (pollers or writers, sockets or fds), and once\-off or repeated timers\&. Its resolution is 1 msec\&. It uses a tickless timer to reduce CPU interrupts in inactive processes\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zloop\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zloop_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new (ZMQ_PAIR); -assert (output); -zsock_bind (output, "inproc://zloop\&.test"); - -zsock_t *input = zsock_new (ZMQ_PAIR); -assert (input); -zsock_connect (input, "inproc://zloop\&.test"); - -zloop_t *loop = zloop_new (); -assert (loop); -zloop_set_verbose (loop, verbose); - -// Create a timer that will be cancelled -int timer_id = zloop_timer (loop, 1000, 1, s_timer_event, NULL); -zloop_timer (loop, 5, 1, s_cancel_timer_event, &timer_id); - -// After 20 msecs, send a ping message to output3 -zloop_timer (loop, 20, 1, s_timer_event, output); - -// Set up some tickets that will never expire -zloop_set_ticket_delay (loop, 10000); -void *ticket1 = zloop_ticket (loop, s_timer_event, NULL); -void *ticket2 = zloop_ticket (loop, s_timer_event, NULL); -void *ticket3 = zloop_ticket (loop, s_timer_event, NULL); - -// When we get the ping message, end the reactor -rc = zloop_reader (loop, input, s_socket_event, NULL); -assert (rc == 0); -zloop_reader_set_tolerant (loop, input); -zloop_start (loop); - -zloop_ticket_delete (loop, ticket1); -zloop_ticket_delete (loop, ticket2); -zloop_ticket_delete (loop, ticket3); - -// Check whether loop properly ignores zsys_interrupted flag -// when asked to -zloop_destroy (&loop); -loop = zloop_new (); - -bool timer_event_called = false; -zloop_timer (loop, 1, 1, s_timer_event3, &timer_event_called); - -zsys_interrupted = 1; -zloop_start (loop); -// zloop returns immediately without giving any handler a chance to run -assert (!timer_event_called); - -zloop_set_nonstop (loop, true); -zloop_start (loop); -// zloop runs the handler which will terminate the loop -assert (timer_event_called); -zsys_interrupted = 0; - -// cleanup -zloop_destroy (&loop); -assert (loop == NULL); - -zsock_destroy (&input); -zsock_destroy (&output); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zmonitor.3 b/external/zmq/share/man/man3/zmonitor.3 deleted file mode 100644 index 8d716863d4..0000000000 --- a/external/zmq/share/man/man3/zmonitor.3 +++ /dev/null @@ -1,157 +0,0 @@ -'\" t -.\" Title: zmonitor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMONITOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmonitor \- socket event monitor -.SH "SYNOPSIS" -.sp -.nf -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance\&. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity\&. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, \&.\&.\&., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored\&. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmonitor\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zmonitor actor provides an API for obtaining socket events such as connected, listen, disconnected, etc\&. Socket events are only available for sockets connecting or bound to ipc:// and tcp:// endpoints\&. -.sp -This class wraps the ZMQ socket monitor API, see zmq_socket_monitor for details\&. Works on all versions of libzmq from 3\&.2 onwards\&. This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zmonitor_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsock_t *client = zsock_new (ZMQ_DEALER); -assert (client); -zactor_t *clientmon = zactor_new (zmonitor, client); -assert (clientmon); -if (verbose) - zstr_sendx (clientmon, "VERBOSE", NULL); -zstr_sendx (clientmon, "LISTEN", "LISTENING", "ACCEPTED", NULL); -zstr_sendx (clientmon, "START", NULL); -zsock_wait (clientmon); - -zsock_t *server = zsock_new (ZMQ_DEALER); -assert (server); -zactor_t *servermon = zactor_new (zmonitor, server); -assert (servermon); -if (verbose) - zstr_sendx (servermon, "VERBOSE", NULL); -zstr_sendx (servermon, "LISTEN", "CONNECTED", "DISCONNECTED", NULL); -zstr_sendx (servermon, "START", NULL); -zsock_wait (servermon); - -// Allow a brief time for the message to get there\&.\&.\&. -zmq_poll (NULL, 0, 200); - -// Check client is now listening -int port_nbr = zsock_bind (client, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -s_assert_event (clientmon, "LISTENING"); - -// Check server connected to client -zsock_connect (server, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -s_assert_event (servermon, "CONNECTED"); - -// Check client accepted connection -s_assert_event (clientmon, "ACCEPTED"); - -zactor_destroy (&clientmon); -zactor_destroy (&servermon); -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zmonitor_v2.3 b/external/zmq/share/man/man3/zmonitor_v2.3 deleted file mode 100644 index f7394183ea..0000000000 --- a/external/zmq/share/man/man3/zmonitor_v2.3 +++ /dev/null @@ -1,134 +0,0 @@ -'\" t -.\" Title: zmonitor_v2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZMONITOR_V2" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmonitor_v2 \- socket event monitor (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// This code needs backporting to work with ZMQ v3\&.2 -#if (ZMQ_VERSION_MAJOR == 4) - -// Create a new socket monitor -CZMQ_EXPORT zmonitor_t * - zmonitor_new (zctx_t *ctx, void *socket, int events); - -// Destroy a socket monitor -CZMQ_EXPORT void - zmonitor_destroy (zmonitor_t **self_p); - -// Receive a status message from the monitor; if no message arrives within -// 500 msec, or the call was interrupted, returns NULL\&. -CZMQ_EXPORT zmsg_t * - zmonitor_recv (zmonitor_t *self); - -// Get the ZeroMQ socket, for polling -CZMQ_EXPORT void * - zmonitor_socket (zmonitor_t *self); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zmonitor_set_verbose (zmonitor_t *self, bool verbose); -#endif // ZeroMQ 4\&.0 or later - -// Self test of this class -CZMQ_EXPORT void - zmonitor_v2_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zmonitor class provides an API for obtaining socket events such as connected, listen, disconnected, etc\&. Socket events are only available for sockets connecting or bound to ipc:// and tcp:// endpoints\&. This class wraps the ZMQ socket monitor API, see zmq_socket_monitor for details\&. Currently this class requires libzmq v4\&.0 or later and is empty on older versions of libzmq\&. -.sp -This class is deprecated in CZMQ v3; it works together with zctx, zsocket, and other deprecated V2 classes\&. New applications should use the V3 zmonitor interface, based on zactor, together with the zsock class for sockets\&. -.SH "EXAMPLE" -.PP -\fBFrom zmonitor_v2_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zctx_t *ctx = zctx_new (); -assert (ctx); -bool result; - -void *sink = zsocket_new (ctx, ZMQ_PULL); -assert (sink); -zmonitor_t *sinkmon = zmonitor_new (ctx, - sink, ZMQ_EVENT_LISTENING | ZMQ_EVENT_ACCEPTED); -assert (sinkmon); -zmonitor_set_verbose (sinkmon, verbose); - -// Check sink is now listening -int port_nbr = zsocket_bind (sink, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -result = s_check_event (sinkmon, ZMQ_EVENT_LISTENING); -assert (result); - -void *source = zsocket_new (ctx, ZMQ_PUSH); -assert (source); -zmonitor_t *sourcemon = zmonitor_new (ctx, - source, ZMQ_EVENT_CONNECTED | ZMQ_EVENT_DISCONNECTED); -assert (sourcemon); -zmonitor_set_verbose (sourcemon, verbose); -zsocket_connect (source, "tcp://127\&.0\&.0\&.1:%d", port_nbr); - -// Check source connected to sink -result = s_check_event (sourcemon, ZMQ_EVENT_CONNECTED); -assert (result); - -// Check sink accepted connection -result = s_check_event (sinkmon, ZMQ_EVENT_ACCEPTED); -assert (result); - -zmonitor_destroy (&sinkmon); -zmonitor_destroy (&sourcemon); -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zmq_bind.3 b/external/zmq/share/man/man3/zmq_bind.3 deleted file mode 100644 index 62196751bb..0000000000 --- a/external/zmq/share/man/man3/zmq_bind.3 +++ /dev/null @@ -1,194 +0,0 @@ -'\" t -.\" Title: zmq_bind -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_BIND" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_bind \- accept incoming connections on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_bind (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_bind()\fR function binds the \fIsocket\fR to a local \fIendpoint\fR and then accepts incoming connections on that endpoint\&. -.sp -The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to bind to\&. -.sp -0MQ provides the the following transports: -.PP -\fItcp\fR -.RS 4 -unicast transport using TCP, see -\fBzmq_tcp\fR(7) -.RE -.PP -\fIipc\fR -.RS 4 -local inter\-process communication transport, see -\fBzmq_ipc\fR(7) -.RE -.PP -\fIinproc\fR -.RS 4 -local in\-process (inter\-thread) communication transport, see -\fBzmq_inproc\fR(7) -.RE -.PP -\fIpgm\fR, \fIepgm\fR -.RS 4 -reliable multicast transport using PGM, see -\fBzmq_pgm\fR(7) -.RE -.sp -Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. -.sp -The \fIipc\fR and \fItcp\fR transports accept wildcard addresses: see \fBzmq_ipc\fR(7) and \fBzmq_tcp\fR(7) for details\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -the address syntax may be different for \fIzmq_bind()\fR and \fIzmq_connect()\fR especially for the \fItcp\fR, \fIpgm\fR and \fIepgm\fR transports\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -following a \fIzmq_bind()\fR, the socket enters a \fImute\fR state unless or until at least one incoming or outgoing connection is made, at which point the socket enters a \fIready\fR state\&. In the mute state, the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. By contrast, following a libzmq:zmq_connect[3], the socket enters the \fIready\fR state\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_bind()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. -.RE -.PP -\fBENOCOMPATPROTO\fR -.RS 4 -The requested -\fItransport\fR -protocol is not compatible with the socket type\&. -.RE -.PP -\fBEADDRINUSE\fR -.RS 4 -The requested -\fIaddress\fR -is already in use\&. -.RE -.PP -\fBEADDRNOTAVAIL\fR -.RS 4 -The requested -\fIaddress\fR -was not local\&. -.RE -.PP -\fBENODEV\fR -.RS 4 -The requested -\fIaddress\fR -specifies a nonexistent interface\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEMTHREAD\fR -.RS 4 -No I/O thread is available to accomplish the task\&. -.RE -.SH "EXAMPLE" -.PP -\fBBinding a publisher socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_PUB socket */ -void *socket = zmq_socket (context, ZMQ_PUB); -assert (socket); -/* Bind it to a in\-process transport with the address \*(Aqmy_publisher\*(Aq */ -int rc = zmq_bind (socket, "inproc://my_publisher"); -assert (rc == 0); -/* Bind it to a TCP transport on port 5555 of the \*(Aqeth0\*(Aq interface */ -rc = zmq_bind (socket, "tcp://eth0:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_close.3 b/external/zmq/share/man/man3/zmq_close.3 deleted file mode 100644 index 6bccd18046..0000000000 --- a/external/zmq/share/man/man3/zmq_close.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" t -.\" Title: zmq_close -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CLOSE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_close \- close 0MQ socket -.SH "SYNOPSIS" -.sp -\fBint zmq_close (void \fR\fB\fI*socket\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_close()\fR function shall destroy the socket referenced by the \fIsocket\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_term\fR(3)\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_socket\fR(3) \fBzmq_term\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_connect.3 b/external/zmq/share/man/man3/zmq_connect.3 deleted file mode 100644 index f7b72b7c5c..0000000000 --- a/external/zmq/share/man/man3/zmq_connect.3 +++ /dev/null @@ -1,171 +0,0 @@ -'\" t -.\" Title: zmq_connect -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CONNECT" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_connect \- create outgoing connection from socket -.SH "SYNOPSIS" -.sp -\fBint zmq_connect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_connect()\fR function connects the \fIsocket\fR to an \fIendpoint\fR and then accepts incoming connections on that endpoint\&. -.sp -The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -0MQ provides the the following transports: -.PP -\fItcp\fR -.RS 4 -unicast transport using TCP, see -\fBzmq_tcp\fR(7) -.RE -.PP -\fIipc\fR -.RS 4 -local inter\-process communication transport, see -\fBzmq_ipc\fR(7) -.RE -.PP -\fIinproc\fR -.RS 4 -local in\-process (inter\-thread) communication transport, see -\fBzmq_inproc\fR(7) -.RE -.PP -\fIpgm\fR, \fIepgm\fR -.RS 4 -reliable multicast transport using PGM, see -\fBzmq_pgm\fR(7) -.RE -.sp -Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -for most transports and socket types the connection is not performed immediately but as needed by 0MQ\&. Thus a successful call to \fIzmq_connect()\fR does not mean that the connection was or could actually be established\&. Because of this, for most transports and socket types the order in which a \fIserver\fR socket is bound and a \fIclient\fR socket is connected to it does not matter\&. The first exception is when using the inproc:// transport: you must call \fIzmq_bind()\fR before calling \fIzmq_connect()\fR\&. The second exception are \fIZMQ_PAIR\fR sockets, which do not automatically reconnect to endpoints\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -following a \fIzmq_connect()\fR, for socket types except for ZMQ_ROUTER, the socket enters its normal \fIready\fR state\&. By contrast, following a \fIzmq_bind()\fR alone, the socket enters a \fImute\fR state in which the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. A ZMQ_ROUTER socket enters its normal \fIready\fR state for a specific peer only when handshaking is complete for that peer, which may take an arbitrary time\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_connect()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. -.RE -.PP -\fBENOCOMPATPROTO\fR -.RS 4 -The requested -\fItransport\fR -protocol is not compatible with the socket type\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEMTHREAD\fR -.RS 4 -No I/O thread is available to accomplish the task\&. -.RE -.SH "EXAMPLE" -.PP -\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to an in\-process transport with the address \*(Aqmy_publisher\*(Aq */ -int rc = zmq_connect (socket, "inproc://my_publisher"); -assert (rc == 0); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_connect (socket, "tcp://server001:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_ctx_get.3 b/external/zmq/share/man/man3/zmq_ctx_get.3 deleted file mode 100644 index 7318092bbf..0000000000 --- a/external/zmq/share/man/man3/zmq_ctx_get.3 +++ /dev/null @@ -1,85 +0,0 @@ -'\" t -.\" Title: zmq_ctx_get -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CTX_GET" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_get \- get context options -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_get (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_get()\fR function shall return the option specified by the \fIoption_name\fR argument\&. -.sp -The \fIzmq_ctx_get()\fR function accepts the following option names: -.SS "ZMQ_IO_THREADS: Get number of I/O threads" -.sp -The \fIZMQ_IO_THREADS\fR argument returns the size of the 0MQ thread pool for this context\&. -.SS "ZMQ_MAX_SOCKETS: Get maximum number of sockets" -.sp -The \fIZMQ_MAX_SOCKETS\fR argument returns the maximum number of sockets allowed for this context\&. -.SS "ZMQ_SOCKET_LIMIT: Get largest configurable number of sockets" -.sp -The \fIZMQ_SOCKET_LIMIT\fR argument returns the largest number of sockets that \fBzmq_ctx_set\fR(3) will accept\&. -.SS "ZMQ_IPV6: Set IPv6 option" -.sp -The \fIZMQ_IPV6\fR argument returns the IPv6 option for the context\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_get()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBSetting a limit on the number of sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *context = zmq_ctx_new (); -zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); -int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); -assert (max_sockets == 256); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_ctx_set\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_ctx_new.3 b/external/zmq/share/man/man3/zmq_ctx_new.3 deleted file mode 100644 index 0591f753ad..0000000000 --- a/external/zmq/share/man/man3/zmq_ctx_new.3 +++ /dev/null @@ -1,55 +0,0 @@ -'\" t -.\" Title: zmq_ctx_new -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CTX_NEW" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_new \- create new 0MQ context -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_ctx_new ();\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_new()\fR function creates a new 0MQ \fIcontext\fR\&. -.sp -This function replaces the deprecated function \fBzmq_init\fR(3)\&. -.PP -\fBThread safety\fR. A 0MQ -\fIcontext\fR -is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_new()\fR function shall return an opaque handle to the newly created \fIcontext\fR if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.sp -No error values are defined for this function\&. -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_ctx_set\fR(3) \fBzmq_ctx_get\fR(3) \fBzmq_ctx_term\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_ctx_set.3 b/external/zmq/share/man/man3/zmq_ctx_set.3 deleted file mode 100644 index 396ad562ff..0000000000 --- a/external/zmq/share/man/man3/zmq_ctx_set.3 +++ /dev/null @@ -1,148 +0,0 @@ -'\" t -.\" Title: zmq_ctx_set -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CTX_SET" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_set \- set context options -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_set (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, int \fR\fB\fIoption_value\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_set()\fR function shall set the option specified by the \fIoption_name\fR argument to the value of the \fIoption_value\fR argument\&. -.sp -The \fIzmq_ctx_set()\fR function accepts the following options: -.SS "ZMQ_IO_THREADS: Set number of I/O threads" -.sp -The \fIZMQ_IO_THREADS\fR argument specifies the size of the 0MQ thread pool to handle I/O operations\&. If your application is using only the \fIinproc\fR transport for messaging you may set this to zero, otherwise set it to at least one\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -.TE -.sp 1 -.SS "ZMQ_THREAD_SCHED_POLICY: Set scheduling policy for I/O threads" -.sp -The \fIZMQ_THREAD_SCHED_POLICY\fR argument sets the scheduling policy for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -.TE -.sp 1 -.SS "ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads" -.sp -The \fIZMQ_THREAD_PRIORITY\fR argument sets scheduling priority for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option depend on chosen scheduling policy\&. Details can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -.TE -.sp 1 -.SS "ZMQ_MAX_SOCKETS: Set maximum number of sockets" -.sp -The \fIZMQ_MAX_SOCKETS\fR argument sets the maximum number of sockets allowed on the context\&. You can query the maximal allowed value with \fBzmq_ctx_get\fR(3) using the \fIZMQ_SOCKET_LIMIT\fR option\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -1024 -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Set IPv6 option" -.sp -The \fIZMQ_IPV6\fR argument sets the IPv6 value for all sockets created in the context from this point onwards\&. A value of 1 means IPv6 is enabled, while 0 means the socket will use only IPv4\&. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_set()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBSetting a limit on the number of sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *context = zmq_ctx_new (); -zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); -int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); -assert (max_sockets == 256); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_ctx_get\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_ctx_shutdown.3 b/external/zmq/share/man/man3/zmq_ctx_shutdown.3 deleted file mode 100644 index 05185142d0..0000000000 --- a/external/zmq/share/man/man3/zmq_ctx_shutdown.3 +++ /dev/null @@ -1,58 +0,0 @@ -'\" t -.\" Title: zmq_ctx_shutdown -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CTX_SHUTDOWN" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_shutdown \- shutdown a 0MQ context -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_shutdown (void \fR\fB\fI*context\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_shutdown()\fR function shall shutdown the 0MQ context \fIcontext\fR\&. -.sp -Context shutdown will cause any blocking operations currently in progress on sockets open within \fIcontext\fR to return immediately with an error code of ETERM\&. With the exception of \fIzmq_close()\fR, any further operations on sockets open within \fIcontext\fR shall fail with an error code of ETERM\&. -.sp -This function is optional, client code is still required to call the \fBzmq_ctx_term\fR(3) function to free all resources allocated by zeromq\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_shutdown()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -was invalid\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_ctx_term\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_ctx_term.3 b/external/zmq/share/man/man3/zmq_ctx_term.3 deleted file mode 100644 index 2c8d29927f..0000000000 --- a/external/zmq/share/man/man3/zmq_ctx_term.3 +++ /dev/null @@ -1,129 +0,0 @@ -'\" t -.\" Title: zmq_ctx_term -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CTX_TERM" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_term \- destroy a 0MQ context -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_term (void \fR\fB\fI*context\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_term()\fR function shall destroy the 0MQ context \fIcontext\fR\&. -.sp -Context termination is performed in the following steps: -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -Any blocking operations currently in progress on sockets open within -\fIcontext\fR -shall return immediately with an error code of ETERM\&. With the exception of -\fIzmq_close()\fR, any further operations on sockets open within -\fIcontext\fR -shall fail with an error code of ETERM\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -After interrupting all blocking calls, -\fIzmq_ctx_term()\fR -shall -\fIblock\fR -until the following conditions are satisfied: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -All sockets open within -\fIcontext\fR -have been closed with -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For each socket within -\fIcontext\fR, all messages sent by the application with -\fIzmq_send()\fR -have either been physically transferred to a network peer, or the socket\(cqs linger period set with the -\fIZMQ_LINGER\fR -socket option has expired\&. -.RE -.RE -.sp -For further details regarding socket linger behavior refer to the \fIZMQ_LINGER\fR option in \fBzmq_setsockopt\fR(3)\&. -.sp -This function replaces the deprecated function \fBzmq_term\fR(3)\&. -.SH "WARNING" -.sp -As \fIZMQ_LINGER\fR defaults to "infinite", by default this function will block indefinitely if there are any pending connects or sends\&. We strongly recommend to (a) set \fIZMQ_LINGER\fR to zero on all sockets and (b) close all sockets, before calling this function\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_term()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -Termination was interrupted by a signal\&. It can be restarted if needed\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_curve_keypair.3 b/external/zmq/share/man/man3/zmq_curve_keypair.3 deleted file mode 100644 index 2285182595..0000000000 --- a/external/zmq/share/man/man3/zmq_curve_keypair.3 +++ /dev/null @@ -1,69 +0,0 @@ -'\" t -.\" Title: zmq_curve_keypair -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CURVE_KEYPAIR" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_curve_keypair \- generate a new CURVE keypair -.SH "SYNOPSIS" -.sp -\fBint zmq_curve_keypair (char *z85_public_key, char *z85_secret_key);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_curve_keypair()\fR function shall return a newly generated random keypair consisting of a public key and a secret key\&. The caller provides two buffers, each at least 41 octets large, in which this method will store the keys\&. The keys are encoded using \fBzmq_z85_encode\fR(3)\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_curve_keypair()\fR function shall return 0 if successful, else it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOTSUP\fR -.RS 4 -The libzmq library was not built with cryptographic support (libsodium)\&. -.RE -.SH "EXAMPLE" -.PP -\fBGenerating a new CURVE keypair\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -char public_key [41]; -char secret_key [41]; -int rc = zmq_curve_keypair (public_key, secret_key); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_z85_encode\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_disconnect.3 b/external/zmq/share/man/man3/zmq_disconnect.3 deleted file mode 100644 index 2539d0eb08..0000000000 --- a/external/zmq/share/man/man3/zmq_disconnect.3 +++ /dev/null @@ -1,113 +0,0 @@ -'\" t -.\" Title: zmq_disconnect -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_DISCONNECT" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_disconnect \- Disconnect a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_disconnect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_disconnect()\fR function shall disconnect a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. -.sp -The \fIendpoint\fR argument is as described in \fBzmq_connect\fR(3) -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_term\fR(3)\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_disconnect()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBENOENT\fR -.RS 4 -The provided endpoint is not connected\&. -.RE -.SH "EXAMPLE" -.PP -\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_connect (socket, "tcp://server001:5555"); -assert (rc == 0); -/* Disconnect from the previously connected endpoint */ -rc = zmq_disconnect (socket, "tcp://server001:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_errno.3 b/external/zmq/share/man/man3/zmq_errno.3 deleted file mode 100644 index 2814d5ec91..0000000000 --- a/external/zmq/share/man/man3/zmq_errno.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_errno -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_ERRNO" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_errno \- retrieve value of errno for the calling thread -.SH "SYNOPSIS" -.sp -\fBint zmq_errno (void);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_errno()\fR function shall retrieve the value of the \fIerrno\fR variable for the calling thread\&. -.sp -The \fIzmq_errno()\fR function is provided to assist users on non\-POSIX systems who are experiencing issues with retrieving the correct value of \fIerrno\fR directly\&. Specifically, users on Win32 systems whose application is using a different C run\-time library from the C run\-time library in use by 0MQ will need to use \fIzmq_errno()\fR for correct operation\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.sp -Users not experiencing issues with retrieving the correct value of \fIerrno\fR should not use this function and should instead access the \fIerrno\fR variable directly\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_errno()\fR function shall return the value of the \fIerrno\fR variable for the calling thread\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_getsockopt.3 b/external/zmq/share/man/man3/zmq_getsockopt.3 deleted file mode 100644 index 3b369f9076..0000000000 --- a/external/zmq/share/man/man3/zmq_getsockopt.3 +++ /dev/null @@ -1,1879 +0,0 @@ -'\" t -.\" Title: zmq_getsockopt -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_GETSOCKOPT" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_getsockopt \- get 0MQ socket options -.SH "SYNOPSIS" -.sp -\fBint zmq_getsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fI*option_len\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_getsockopt()\fR function shall retrieve the value for the option specified by the \fIoption_name\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument, and store it in the buffer pointed to by the \fIoption_value\fR argument\&. The \fIoption_len\fR argument is the size in bytes of the buffer pointed to by \fIoption_value\fR; upon successful completion \fIzmq_getsockopt()\fR shall modify the \fIoption_len\fR argument to indicate the actual size of the option value stored in the buffer\&. -.sp -The following options can be retrieved with the \fIzmq_getsockopt()\fR function: -.SS "ZMQ_AFFINITY: Retrieve I/O thread affinity" -.sp -The \fIZMQ_AFFINITY\fR option shall retrieve the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. -.sp -Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. -.sp -See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (bitmap) -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.SS "ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections" -.sp -The \fIZMQ_BACKLOG\fR option shall retrieve the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -connections -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key" -.sp -Retrieves the current long term public key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key" -.sp -Retrieves the current long term secret key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key" -.sp -Retrieves the current server key for the client socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41\-byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_EVENTS: Retrieve socket event state" -.sp -The \fIZMQ_EVENTS\fR option shall retrieve the event state for the specified \fIsocket\fR\&. The returned value is a bit mask constructed by OR\(cqing a combination of the following event flags: -.PP -\fBZMQ_POLLIN\fR -.RS 4 -Indicates that at least one message may be received from the specified socket without blocking\&. -.RE -.PP -\fBZMQ_POLLOUT\fR -.RS 4 -Indicates that at least one message may be sent to the specified socket without blocking\&. -.RE -.sp -The combination of a file descriptor returned by the \fIZMQ_FD\fR option being ready for reading but no actual events returned by a subsequent retrieval of the \fIZMQ_EVENTS\fR option is valid; applications should simply ignore this case and restart their polling operation/event loop\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (flags) -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_FD: Retrieve file descriptor associated with the socket" -.sp -The \fIZMQ_FD\fR option shall retrieve the file descriptor associated with the specified \fIsocket\fR\&. The returned file descriptor can be used to integrate the socket into an existing event loop; the 0MQ library shall signal any pending events on the socket in an \fIedge\-triggered\fR fashion by making the file descriptor become ready for reading\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The ability to read from the returned file descriptor does not necessarily indicate that messages are available to be read from, or can be written to, the underlying socket; applications must retrieve the actual event state with a subsequent retrieval of the \fIZMQ_EVENTS\fR option\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The returned file descriptor is also used internally by the \fIzmq_send\fR and \fIzmq_recv\fR functions\&. As the descriptor is edge triggered, applications must update the state of \fIZMQ_EVENTS\fR after each invocation of \fIzmq_send\fR or \fIzmq_recv\fR\&.To be more explicit: after calling \fIzmq_send\fR the socket may become readable (and vice versa) without triggering a read event on the file descriptor\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The returned file descriptor is intended for use with a \fIpoll\fR or similar system call only\&. Applications must never attempt to read or write data to it directly, neither should they try to close it\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int on POSIX systems, SOCKET on Windows -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status" -.sp -Returns the \fIZMQ_GSSAPI_PLAINTEXT\fR option, if any, previously set on the socket\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal" -.sp -The \fIZMQ_GSSAPI_PRINCIPAL\fR option shall retrieve the principal name set for the GSSAPI security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role" -.sp -Returns the \fIZMQ_GSSAPI_SERVER\fR option, if any, previously set on the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal" -.sp -The \fIZMQ_GSSAPI_SERVICE_PRINCIPAL\fR option shall retrieve the principal name of the GSSAPI server to which a GSSAPI client socket intends to connect\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval" -.sp -The \fIZMQ_HANDSHAKE_IVL\fR option shall retrieve the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -30000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all but ZMQ_STREAM, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_IDENTITY: Retrieve socket identity" -.sp -The \fIZMQ_IDENTITY\fR option shall retrieve the identity of the specified \fIsocket\fR\&. Socket identity is used only by request/reply pattern\&. Namely, it can be used in tandem with ROUTER socket to route messages to the peer with specific identity\&. -.sp -Identity should be at least one byte and at most 255 bytes long\&. Identities starting with binary zero are reserved for use by 0MQ infrastructure\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REP, ZMQ_REQ, ZMQ_ROUTER, ZMQ_DEALER\&. -T} -.TE -.sp 1 -.SS "ZMQ_IMMEDIATE: Retrieve attach\-on\-connect value" -.sp -Retrieve the state of the attach on connect value\&. If set to 1, will delay the attachment of a pipe on connect until the underlying connection has completed\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, primarily when using TCP/IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV4ONLY: Retrieve IPv4\-only socket override status" -.sp -Retrieve the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -1 (true) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Retrieve IPv6 socket status" -.sp -Retrieve the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set" -.sp -The \fIZMQ_LAST_ENDPOINT\fR option shall retrieve the last endpoint bound for TCP and IPC transports\&. The returned value will be a string in the form of a ZMQ DSN\&. Note that if the TCP host is INADDR_ANY, indicated by a *, then the returned address will be 0\&.0\&.0\&.0 (for IPv4)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when binding TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_LINGER: Retrieve linger period for socket shutdown" -.sp -The \fIZMQ_LINGER\fR option shall retrieve the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_term\fR(3)\&. The following outlines the different behaviours: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The default value of -\fI\-1\fR -specifies an infinite linger period\&. Pending messages shall not be discarded after a call to -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_term()\fR -shall block until all pending messages have been sent to a peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The value of -\fI0\fR -specifies no linger period\&. Pending messages shall be discarded immediately when the socket is closed with -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_term()\fR -shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -Option value type -T}:T{ -int -T} -T{ -Option value unit -T}:T{ -milliseconds -T} -T{ -Default value -T}:T{ -\-1 (infinite) -T} -T{ -Applicable socket types -T}:T{ -all -T} -.TE -.sp 1 -.RE -.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" -.sp -The option shall retrieve limit for the inbound messages\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_MECHANISM: Retrieve current security mechanism" -.sp -The \fIZMQ_MECHANISM\fR option shall retrieve the current security mechanism for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -ZMQ_NULL, ZMQ_PLAIN, ZMQ_CURVE, or ZMQ_GSSAPI -T} -T{ -.sp -Default value -T}:T{ -.sp -ZMQ_NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" -.sp -The option shall retrieve time\-to\-live used for outbound multicast packets\&. The default of 1 means that the multicast packets don\(cqt leave the local network\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -network hops -T} -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_PASSWORD: Retrieve current password" -.sp -The \fIZMQ_PLAIN_PASSWORD\fR option shall retrieve the last password set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role" -.sp -Returns the \fIZMQ_PLAIN_SERVER\fR option, if any, previously set on the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -int -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username" -.sp -The \fIZMQ_PLAIN_USERNAME\fR option shall retrieve the last username set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_RATE: Retrieve multicast data rate" -.sp -The \fIZMQ_RATE\fR option shall retrieve the maximum send or receive data rate for multicast transports using the specified \fIsocket\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -kilobits per second -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_RCVBUF: Retrieve kernel receive buffer size" -.sp -The \fIZMQ_RCVBUF\fR option shall retrieve the underlying kernel receive buffer size for the specified \fIsocket\fR\&. A value of zero means that the OS default is in effect\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVHWM: Retrieve high water mark for inbound messages" -.sp -The \fIZMQ_RCVHWM\fR option shall return the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVMORE: More message data parts to follow" -.sp -The \fIZMQ_RCVMORE\fR option shall return True (1) if the message part last received from the \fIsocket\fR was a data part with more parts to follow\&. If there are no data parts to follow, this option shall return False (0)\&. -.sp -Refer to \fBzmq_send\fR(3) and \fBzmq_recv\fR(3) for a detailed description of multi\-part messages\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN" -.sp -Retrieve the timeout for recv operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL: Retrieve reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL\fR option shall retrieve the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL_MAX\fR option shall retrieve the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Values less than ZMQ_RECONNECT_IVL will be ignored\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (only use ZMQ_RECONNECT_IVL) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transport -T} -.TE -.sp 1 -.SS "ZMQ_RECOVERY_IVL: Get multicast recovery interval" -.sp -The \fIZMQ_RECOVERY_IVL\fR option shall retrieve the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -10000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_SNDBUF: Retrieve kernel transmit buffer size" -.sp -The \fIZMQ_SNDBUF\fR option shall retrieve the underlying kernel transmit buffer size for the specified \fIsocket\fR\&. A value of zero means that the OS default is in effect\&. For details refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDHWM: Retrieves high water mark for outbound messages" -.sp -The \fIZMQ_SNDHWM\fR option shall return the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN" -.sp -Retrieve the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" -.sp -Override \fISO_KEEPALIVE\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" -.sp -Override \fITCP_KEEPCNT\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS)" -.sp -Override \fITCP_KEEPCNT\fR(or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" -.sp -Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TOS: Retrieve the Type\-of\-Service socket override status" -.sp -Retrieve the IP_TOS option for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp ->0 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_TYPE: Retrieve socket type" -.sp -The \fIZMQ_TYPE\fR option shall retrieve the socket type for the specified \fIsocket\fR\&. The socket type is specified at socket creation time and cannot be modified afterwards\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain" -.sp -The \fIZMQ_ZAP_DOMAIN\fR option shall retrieve the last ZAP domain set for the socket\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_getsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown, or the requested -\fIoption_len\fR -or -\fIoption_value\fR -is invalid, or the size of the buffer pointed to by -\fIoption_value\fR, as specified by -\fIoption_len\fR, is insufficient for storing the option value\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal\&. -.RE -.SH "EXAMPLE" -.PP -\fBRetrieving the high water mark for outgoing messages\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Retrieve high water mark into sndhwm */ -int sndhwm; -size_t sndhwm_size = sizeof (sndhwm); -rc = zmq_getsockopt (socket, ZMQ_SNDHWM, &sndhwm, &sndhwm_size); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_setsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_has.3 b/external/zmq/share/man/man3/zmq_has.3 deleted file mode 100644 index 929478447a..0000000000 --- a/external/zmq/share/man/man3/zmq_has.3 +++ /dev/null @@ -1,113 +0,0 @@ -'\" t -.\" Title: zmq_has -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_HAS" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_has \- check a ZMQ capability -.SH "SYNOPSIS" -.sp -\fBint zmq_has (const char *capability);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_has()\fR function shall report whether a specified capability is available in the library\&. This allows bindings and applications to probe a library directly, for transport and security options\&. -.sp -Capabilities shall be lowercase strings\&. The following capabilities are defined: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ipc \- the library supports the ipc:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -pgm \- the library supports the pgm:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -tipc \- the library supports the tipc:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -norm \- the library supports the norm:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -curve \- the library supports the CURVE security mechanism -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -gssapi \- the library supports the GSSAPI security mechanism -.RE -.sp -When this method is provided, the zmq\&.h header file will define ZMQ_HAS_CAPABILITIES\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_has()\fR function shall return 1 if the specified capability is provided\&. Otherwise it shall return 0\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_close.3 b/external/zmq/share/man/man3/zmq_msg_close.3 deleted file mode 100644 index 1435ea3dfd..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_close.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" t -.\" Title: zmq_msg_close -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_CLOSE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_close \- release 0MQ message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_close (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_close()\fR function shall inform the 0MQ infrastructure that any resources associated with the message object referenced by \fImsg\fR are no longer required and may be released\&. Actual release of resources associated with the message object shall be postponed by 0MQ until all users of the message or underlying data buffer have indicated it is no longer required\&. -.sp -Applications should ensure that \fIzmq_msg_close()\fR is called once a message is no longer required, otherwise memory leaks may occur\&. Note that this is NOT necessary after a successful \fIzmq_msg_send()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_copy.3 b/external/zmq/share/man/man3/zmq_msg_copy.3 deleted file mode 100644 index 1bfdbfbb69..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_copy.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" t -.\" Title: zmq_msg_copy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_COPY" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_copy \- copy content of a message to another message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_copy (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_copy()\fR function shall copy the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. The original content of \fIdest\fR, if any, shall be released\&. You must initialize \fIdest\fR before copying to it\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The implementation may choose not to physically copy the message content, rather to share the underlying buffer between \fIsrc\fR and \fIdest\fR\&. Avoid modifying message content after a message has been copied with \fIzmq_msg_copy()\fR, doing so can result in undefined behaviour\&. If what you need is an actual hard copy, allocate a new message using \fIzmq_msg_init_size()\fR and copy the message content using \fImemcpy()\fR\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_copy()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "EXAMPLE" -.PP -\fBCopying a message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -zmq_msg_init_size (&msg, 255); -memcpy (zmq_msg_data (&msg, "Hello, World", 12); -zmq_msg_t copy; -zmq_msg_init (©); -zmq_msg_copy (©, &msg); -\&.\&.\&. -zmq_msg_close (©); -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_move\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_data.3 b/external/zmq/share/man/man3/zmq_msg_data.3 deleted file mode 100644 index 0c73d313cd..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_data.3 +++ /dev/null @@ -1,65 +0,0 @@ -'\" t -.\" Title: zmq_msg_data -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_DATA" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_data \- retrieve pointer to message content -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_msg_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_data()\fR function shall return a pointer to the message content of the message object referenced by \fImsg\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, \fIzmq_msg_data()\fR shall return a pointer to the message content\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq_msg_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_get.3 b/external/zmq/share/man/man3/zmq_msg_get.3 deleted file mode 100644 index c68fef4a04..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_get.3 +++ /dev/null @@ -1,104 +0,0 @@ -'\" t -.\" Title: zmq_msg_get -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_GET" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_get \- get message property -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_get (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_get()\fR function shall return the value for the property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. -.sp -The following properties can be retrieved with the \fIzmq_msg_get()\fR function: -.PP -\fBZMQ_MORE\fR -.RS 4 -Indicates that there are more message frames to follow after the -\fImessage\fR\&. -.RE -.PP -\fBZMQ_SRCFD\fR -.RS 4 -Returns the file descriptor of the socket the -\fImessage\fR -was read from\&. This allows application to retrieve the remote endpoint via -\fIgetpeername(2)\fR\&. Be aware that the respective socket might be closed already, reused even\&. Currently only implemented for TCP sockets\&. -.RE -.PP -\fBZMQ_SHARED\fR -.RS 4 -Indicates that a message MAY share underlying storage with another copy of this message\&. -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_get()\fR function shall return the value for the property if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested -\fIproperty\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a multi-frame message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t frame; -while (true) { - // Create an empty 0MQ message to hold the message frame - int rc = zmq_msg_init (&frame); - assert (rc == 0); - // Block until a message is available to be received from socket - rc = zmq_msg_recv (socket, &frame, 0); - assert (rc != \-1); - if (zmq_msg_get (&frame, ZMQ_MORE)) - fprintf (stderr, "more\en"); - else { - fprintf (stderr, "end\en"); - break; - } - zmq_msg_close (&frame); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_gets.3 b/external/zmq/share/man/man3/zmq_msg_gets.3 deleted file mode 100644 index 410ab07363..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_gets.3 +++ /dev/null @@ -1,93 +0,0 @@ -'\" t -.\" Title: zmq_msg_gets -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_GETS" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_gets \- get message metadata property -.SH "SYNOPSIS" -.sp -\fBconst char *zmq_msg_gets (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, const char *\fR\fB\fIproperty\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_gets()\fR function shall return the string value for the metadata property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. Both the \fIproperty\fR argument and the \fIvalue\fR shall be NULL\-terminated UTF8\-encoded strings\&. -.sp -Metadata is defined on a per\-connection basis during the ZeroMQ connection handshake as specified in \&. -.sp -The following ZMTP properties can be retrieved with the \fIzmq_msg_gets()\fR function: -.sp -.if n \{\ -.RS 4 -.\} -.nf -Socket\-Type -Identity -Resource -.fi -.if n \{\ -.RE -.\} -.sp -Additionally, when available for the underlying transport, the \fBPeer\-Address\fR property will return the IP address of the remote endpoint as returned by getnameinfo(2)\&. -.sp -Other properties may be defined based on the underlying security mechanism, see ZAP authenticated connection sample below\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_gets()\fR function shall return the string value for the property if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. The caller shall not modify or free the returned value, which shall be owned by the message\&. The encoding of the property and value shall be UTF8\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested -\fIproperty\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBGetting the ZAP authenticated user id for a message:\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -zmq_msg_init (&msg); -rc = zmq_msg_recv (&msg, dealer, 0); -assert (rc != \-1); -const char *user_id = zmq_msg_gets (&msg, "User\-Id"); -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_init.3 b/external/zmq/share/man/man3/zmq_msg_init.3 deleted file mode 100644 index f56c9eb5a8..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_init.3 +++ /dev/null @@ -1,99 +0,0 @@ -'\" t -.\" Title: zmq_msg_init -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init \- initialise empty 0MQ message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_init (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init()\fR function shall initialise the message object referenced by \fImsg\fR to represent an empty message\&. This function is most useful when called before receiving a message with \fIzmq_recv()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialize the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init()\fR function always returns zero\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -rc = zmq_msg_init (&msg); -assert (rc == 0); -int nbytes = zmq_recv (socket, &msg, 0); -assert (nbytes != \-1); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_init_data.3 b/external/zmq/share/man/man3/zmq_msg_init_data.3 deleted file mode 100644 index 362344bc4c..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_init_data.3 +++ /dev/null @@ -1,146 +0,0 @@ -'\" t -.\" Title: zmq_msg_init_data -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT_DATA" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init_data \- initialise 0MQ message from a supplied buffer -.SH "SYNOPSIS" -.sp -\fBtypedef void (zmq_free_fn) (void \fR\fB\fI*data\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR -.sp -\fBint zmq_msg_init_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*data\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB, zmq_free_fn \fR\fB\fI*ffn\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init_data()\fR function shall initialise the message object referenced by \fImsg\fR to represent the content referenced by the buffer located at address \fIdata\fR, \fIsize\fR bytes long\&. No copy of \fIdata\fR shall be performed and 0MQ shall take ownership of the supplied buffer\&. -.sp -If provided, the deallocation function \fIffn\fR shall be called once the data buffer is no longer required by 0MQ, with the \fIdata\fR and \fIhint\fR arguments supplied to \fIzmq_msg_init_data()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The deallocation function \fIffn\fR needs to be thread\-safe, since it will be called from an arbitrary thread\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -If the deallocation function is not provided, the allocated memory will not be freed, and this may cause a memory leak\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialize the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init_data()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOMEM\fR -.RS 4 -Insufficient storage space is available\&. -.RE -.SH "EXAMPLE" -.PP -\fBInitialising a message from a supplied buffer\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void my_free (void *data, void *hint) -{ - free (data); -} - - /* \&.\&.\&. */ - -void *data = malloc (6); -assert (data); -memcpy (data, "ABCDEF", 6); -zmq_msg_t msg; -rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_init_size.3 b/external/zmq/share/man/man3/zmq_msg_init_size.3 deleted file mode 100644 index 0a5c3b87bb..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_init_size.3 +++ /dev/null @@ -1,86 +0,0 @@ -'\" t -.\" Title: zmq_msg_init_size -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT_SIZE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init_size \- initialise 0MQ message of a specified size -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_init_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init_size()\fR function shall allocate any resources required to store a message \fIsize\fR bytes long and initialise the message object referenced by \fImsg\fR to represent the newly allocated message\&. -.sp -The implementation shall choose whether to store message content on the stack (small messages) or on the heap (large messages)\&. For performance reasons \fIzmq_msg_init_size()\fR shall not clear the message data\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialize the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init_size()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOMEM\fR -.RS 4 -Insufficient storage space is available\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_more.3 b/external/zmq/share/man/man3/zmq_msg_more.3 deleted file mode 100644 index 89144c6203..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_more.3 +++ /dev/null @@ -1,75 +0,0 @@ -'\" t -.\" Title: zmq_msg_more -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_MORE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_more \- indicate if there are more message parts to receive -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_more (zmq_msg_t \fR\fB\fI*message\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_more()\fR function indicates whether this is part of a multi\-part message, and there are further parts to receive\&. This method can safely be called after \fIzmq_msg_close()\fR\&. This method is identical to \fIzmq_msg_get()\fR with an argument of ZMQ_MORE\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_more()\fR function shall return zero if this is the final part of a multi\-part message, or the only part of a single\-part message\&. It shall return 1 if there are further parts to receive\&. -.SH "EXAMPLE" -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t part; -while (true) { - // Create an empty 0MQ message to hold the message part - int rc = zmq_msg_init (&part); - assert (rc == 0); - // Block until a message is available to be received from socket - rc = zmq_msg_recv (socket, &part, 0); - assert (rc != \-1); - if (zmq_msg_more (&part)) - fprintf (stderr, "more\en"); - else { - fprintf (stderr, "end\en"); - break; - } - zmq_msg_close (&part); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_get\fR(3) \fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_move.3 b/external/zmq/share/man/man3/zmq_msg_move.3 deleted file mode 100644 index 0e8af7b179..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_move.3 +++ /dev/null @@ -1,68 +0,0 @@ -'\" t -.\" Title: zmq_msg_move -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_MOVE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_move \- move content of a message to another message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_move (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_move()\fR function shall move the content of the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. No actual copying of message content is performed, \fIdest\fR is simply updated to reference the new content\&. \fIsrc\fR becomes an empty message after calling \fIzmq_msg_move()\fR\&. The original content of \fIdest\fR, if any, shall be released\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_move()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_copy\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_recv.3 b/external/zmq/share/man/man3/zmq_msg_recv.3 deleted file mode 100644 index 54504b975e..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_recv.3 +++ /dev/null @@ -1,161 +0,0 @@ -'\" t -.\" Title: zmq_msg_recv -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_RECV" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_recv \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_recv (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_recv()\fR function is identical to \fBzmq_recvmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_recv()\fR is more consistent with other message manipulation functions\&. -.sp -The \fIzmq_msg_recv()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_msg_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_msg_recv()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_msg_recv()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_recv()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_msg_recv()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_msg_recv()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The message passed to the function was invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create an empty 0MQ message */ -zmq_msg_t msg; -int rc = zmq_msg_init (&msg); -assert (rc == 0); -/* Block until a message is available to be received from socket */ -rc = zmq_msg_recv (&msg, socket, 0); -assert (rc != \-1); -/* Release message */ -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int more; -size_t more_size = sizeof (more); -do { - /* Create an empty 0MQ message to hold the message part */ - zmq_msg_t part; - int rc = zmq_msg_init (&part); - assert (rc == 0); - /* Block until a message is available to be received from socket */ - rc = zmq_msg_recv (&part, socket, 0); - assert (rc != \-1); - /* Determine if more message parts are to follow */ - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - zmq_msg_close (&part); -} while (more); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_send.3 b/external/zmq/share/man/man3/zmq_msg_send.3 deleted file mode 100644 index f9e5dfb9ba..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_send.3 +++ /dev/null @@ -1,179 +0,0 @@ -'\" t -.\" Title: zmq_msg_send -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_SEND" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_send \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_send (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_send()\fR function is identical to \fBzmq_sendmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_send()\fR is more consistent with other message manipulation functions\&. -.sp -The \fIzmq_msg_send()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_msg_send()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.sp -The \fIzmq_msg_t\fR structure passed to \fIzmq_msg_send()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it using (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_msg_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. You do not need to call \fIzmq_msg_close()\fR after a successful \fIzmq_msg_send()\fR\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_msg_send()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_msg_send()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBFilling in a message and sending it to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a new message, allocating 6 bytes for message content */ -zmq_msg_t msg; -int rc = zmq_msg_init_size (&msg, 6); -assert (rc == 0); -/* Fill in message content with \*(AqAAAAAA\*(Aq */ -memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); -/* Send the message to the socket */ -rc = zmq_msg_send (&msg, socket, 0); -assert (rc == 6); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_msg_send (&part1, socket, ZMQ_SNDMORE); -rc = zmq_msg_send (&part2, socket, ZMQ_SNDMORE); -/* Final part; no more parts to follow */ -rc = zmq_msg_send (&part3, socket, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_set.3 b/external/zmq/share/man/man3/zmq_msg_set.3 deleted file mode 100644 index d929e5eda1..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_set.3 +++ /dev/null @@ -1,56 +0,0 @@ -'\" t -.\" Title: zmq_msg_set -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_SET" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_set \- set message property -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_set (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB, int \fR\fB\fIvalue\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_set()\fR function shall set the property specified by the \fIproperty\fR argument to the value of the \fIvalue\fR argument for the 0MQ message fragment pointed to by the \fImessage\fR argument\&. -.sp -Currently the \fIzmq_msg_set()\fR function does not support any property names\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_set()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested property -\fIproperty\fR -is unknown\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_get\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_msg_size.3 b/external/zmq/share/man/man3/zmq_msg_size.3 deleted file mode 100644 index 02ad983651..0000000000 --- a/external/zmq/share/man/man3/zmq_msg_size.3 +++ /dev/null @@ -1,65 +0,0 @@ -'\" t -.\" Title: zmq_msg_size -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_MSG_SIZE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_size \- retrieve message content size in bytes -.SH "SYNOPSIS" -.sp -\fBsize_t zmq_msg_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_size()\fR function shall return the size in bytes of the content of the message object referenced by \fImsg\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, \fIzmq_msg_size()\fR shall return the size of the message content in bytes\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq_msg_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_poll.3 b/external/zmq/share/man/man3/zmq_poll.3 deleted file mode 100644 index 24e413d20a..0000000000 --- a/external/zmq/share/man/man3/zmq_poll.3 +++ /dev/null @@ -1,177 +0,0 @@ -'\" t -.\" Title: zmq_poll -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_POLL" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_poll \- input/output multiplexing -.SH "SYNOPSIS" -.sp -\fBint zmq_poll (zmq_pollitem_t \fR\fB\fI*items\fR\fR\fB, int \fR\fB\fInitems\fR\fR\fB, long \fR\fB\fItimeout\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_poll()\fR function provides a mechanism for applications to multiplex input/output events in a level\-triggered fashion over a set of sockets\&. Each member of the array pointed to by the \fIitems\fR argument is a \fBzmq_pollitem_t\fR structure\&. The \fInitems\fR argument specifies the number of items in the \fIitems\fR array\&. The \fBzmq_pollitem_t\fR structure is defined as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf -typedef struct -{ - void \fI*socket\fR; - int \fIfd\fR; - short \fIevents\fR; - short \fIrevents\fR; -} zmq_pollitem_t; -.fi -.if n \{\ -.RE -.\} -.sp -For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall examine either the 0MQ socket referenced by \fIsocket\fR \fBor\fR the standard socket specified by the file descriptor \fIfd\fR, for the event(s) specified in \fIevents\fR\&. If both \fIsocket\fR and \fIfd\fR are set in a single \fBzmq_pollitem_t\fR, the 0MQ socket referenced by \fIsocket\fR shall take precedence and the value of \fIfd\fR shall be ignored\&. -.sp -For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall first clear the \fIrevents\fR member, and then indicate any requested events that have occurred by setting the bit corresponding to the event condition in the \fIrevents\fR member\&. -.sp -If none of the requested events have occurred on any \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall wait \fItimeout\fR milliseconds for an event to occur on any of the requested items\&. If the value of \fItimeout\fR is 0, \fIzmq_poll()\fR shall return immediately\&. If the value of \fItimeout\fR is \-1, \fIzmq_poll()\fR shall block indefinitely until a requested event has occurred on at least one \fBzmq_pollitem_t\fR\&. -.sp -The \fIevents\fR and \fIrevents\fR members of \fBzmq_pollitem_t\fR are bit masks constructed by OR\(cqing a combination of the following event flags: -.PP -\fBZMQ_POLLIN\fR -.RS 4 -For 0MQ sockets, at least one message may be received from the -\fIsocket\fR -without blocking\&. For standard sockets this is equivalent to the -\fIPOLLIN\fR -flag of the -\fIpoll()\fR -system call and generally means that at least one byte of data may be read from -\fIfd\fR -without blocking\&. -.RE -.PP -\fBZMQ_POLLOUT\fR -.RS 4 -For 0MQ sockets, at least one message may be sent to the -\fIsocket\fR -without blocking\&. For standard sockets this is equivalent to the -\fIPOLLOUT\fR -flag of the -\fIpoll()\fR -system call and generally means that at least one byte of data may be written to -\fIfd\fR -without blocking\&. -.RE -.PP -\fBZMQ_POLLERR\fR -.RS 4 -For standard sockets, this flag is passed through -\fIzmq_poll()\fR -to the underlying -\fIpoll()\fR -system call and generally means that some sort of error condition is present on the socket specified by -\fIfd\fR\&. For 0MQ sockets this flag has no effect if set in -\fIevents\fR, and shall never be returned in -\fIrevents\fR -by -\fIzmq_poll()\fR\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The \fIzmq_poll()\fR function may be implemented or emulated using operating system interfaces other than \fIpoll()\fR, and as such may be subject to the limits of those interfaces in ways not defined in this documentation\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, the \fIzmq_poll()\fR function shall return the number of \fBzmq_pollitem_t\fR structures with events signaled in \fIrevents\fR or 0 if no events have been signaled\&. Upon failure, \fIzmq_poll()\fR shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBETERM\fR -.RS 4 -At least one of the members of the -\fIitems\fR -array refers to a -\fIsocket\fR -whose associated 0MQ -\fIcontext\fR -was terminated\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIitems\fR -was not valid (NULL)\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before any events were available\&. -.RE -.SH "EXAMPLE" -.PP -\fBPolling indefinitely for input events on both a 0MQ socket and a standard socket.\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_pollitem_t items [2]; -/* First item refers to 0MQ socket \*(Aqsocket\*(Aq */ -items[0]\&.socket = socket; -items[0]\&.events = ZMQ_POLLIN; -/* Second item refers to standard socket \*(Aqfd\*(Aq */ -items[1]\&.socket = NULL; -items[1]\&.fd = fd; -items[1]\&.events = ZMQ_POLLIN; -/* Poll for events indefinitely */ -int rc = zmq_poll (items, 2, \-1); -assert (rc >= 0); -/* Returned events will be stored in items[]\&.revents */ -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_socket\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq\fR(7) -.sp -Your operating system documentation for the \fIpoll()\fR system call\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_proxy.3 b/external/zmq/share/man/man3/zmq_proxy.3 deleted file mode 100644 index 0d65168cbd..0000000000 --- a/external/zmq/share/man/man3/zmq_proxy.3 +++ /dev/null @@ -1,89 +0,0 @@ -'\" t -.\" Title: zmq_proxy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_PROXY" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_proxy \- start built\-in 0MQ proxy -.SH "SYNOPSIS" -.sp -\fBint zmq_proxy (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_proxy()\fR function starts the built\-in 0MQ proxy in the current application thread\&. -.sp -The proxy connects a frontend socket to a backend socket\&. Conceptually, data flows from frontend to backend\&. Depending on the socket types, replies may flow in the opposite direction\&. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend\&. -.sp -Before calling \fIzmq_proxy()\fR you must set any socket options, and connect or bind both frontend and backend sockets\&. The two conventional proxy models are: -.sp -\fIzmq_proxy()\fR runs in the current thread and returns only if/when the current context is closed\&. -.sp -If the capture socket is not NULL, the proxy shall send all messages, received on both frontend and backend, to the capture socket\&. The capture socket should be a \fIZMQ_PUB\fR, \fIZMQ_DEALER\fR, \fIZMQ_PUSH\fR, or \fIZMQ_PAIR\fR socket\&. -.sp -Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. -.SH "EXAMPLE USAGE" -.SS "Shared Queue" -.sp -When the frontend is a ZMQ_ROUTER socket, and the backend is a ZMQ_DEALER socket, the proxy shall act as a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services\&. Requests shall be fair\-queued from frontend connections and distributed evenly across backend connections\&. Replies shall automatically return to the client that made the original request\&. -.SS "Forwarder" -.sp -When the frontend is a ZMQ_XSUB socket, and the backend is a ZMQ_XPUB socket, the proxy shall act as a message forwarder that collects messages from a set of publishers and forwards these to a set of subscribers\&. This may be used to bridge networks transports, e\&.g\&. read on tcp:// and forward on pgm://\&. -.SS "Streamer" -.sp -When the frontend is a ZMQ_PULL socket, and the backend is a ZMQ_PUSH socket, the proxy shall collect tasks from a set of clients and forwards these to a set of workers using the pipeline pattern\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_proxy()\fR function always returns \-1 and \fIerrno\fR set to \fBETERM\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. -.SH "EXAMPLE" -.PP -\fBCreating a shared queue proxy\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create frontend and backend sockets -void *frontend = zmq_socket (context, ZMQ_ROUTER); -assert (backend); -void *backend = zmq_socket (context, ZMQ_DEALER); -assert (frontend); -// Bind both sockets to TCP ports -assert (zmq_bind (frontend, "tcp://*:5555") == 0); -assert (zmq_bind (backend, "tcp://*:5556") == 0); -// Start the queue proxy, which runs until ETERM -zmq_proxy (frontend, backend, NULL); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_proxy_steerable.3 b/external/zmq/share/man/man3/zmq_proxy_steerable.3 deleted file mode 100644 index 64ac88d65d..0000000000 --- a/external/zmq/share/man/man3/zmq_proxy_steerable.3 +++ /dev/null @@ -1,112 +0,0 @@ -'\" t -.\" Title: zmq_proxy_steerable -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_PROXY_STEERABLE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_proxy_steerable \- built\-in 0MQ proxy with control flow -.SH "SYNOPSIS" -.sp -\fBint zmq_proxy_steerable (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB, const void \fR\fB\fI*control\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_proxy_steerable()\fR function starts the built\-in 0MQ proxy in the current application thread, as \fIzmq_proxy()\fR do\&. Please, refer to this function for the general description and usage\&. We describe here only the additional control flow provided by the socket passed as the fourth argument "control"\&. -.sp -If the control socket is not NULL, the proxy supports control flow\&. If \fIPAUSE\fR is received on this socket, the proxy suspends its activities\&. If \fIRESUME\fR is received, it goes on\&. If \fITERMINATE\fR is received, it terminates smoothly\&. At start, the proxy runs normally as if zmq_proxy was used\&. -.sp -If the control socket is NULL, the function behave exactly as if zmq_proxy had been called\&. -.sp -Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. Refer to \fBzmq_proxy\fR(3) for a description of the zmq_proxy\&. -.SH "EXAMPLE USAGE" -.sp -cf zmq_proxy -.SH "RETURN VALUE" -.sp -The \fIzmq_proxy_steerable()\fR function returns 0 if TERMINATE is sent to its control socket\&. Otherwise, it returns \-1 and \fIerrno\fR set to \fBETERM\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. -.SH "EXAMPLE" -.PP -\fBCreating a shared queue proxy\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create frontend, backend and control sockets -void *frontend = zmq_socket (context, ZMQ_ROUTER); -assert (backend); -void *backend = zmq_socket (context, ZMQ_DEALER); -assert (frontend); -void *control = zmq_socket (context, ZMQ_SUB); -assert (control); - -// Bind sockets to TCP ports -assert (zmq_bind (frontend, "tcp://*:5555") == 0); -assert (zmq_bind (backend, "tcp://*:5556") == 0); -assert (zmq_connect (control, "tcp://*:5557") == 0); - -// Subscribe to the control socket since we have chosen SUB here -assert (zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0)); - -// Start the queue proxy, which runs until ETERM or "TERMINATE" -// received on the control socket -zmq_proxy_steerable (frontend, backend, NULL, control); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSet up a controller in another node, process or whatever\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *control = zmq_socket (context, ZMQ_PUB); -assert (control); -assert (zmq_bind (control, "tcp://*:5557") == 0); - -// pause the proxy -assert (zmq_send (control, "PAUSE", 5, 0) == 0); - -// resume the proxy -assert (zmq_send (control, "RESUME", 6, 0) == 0); - -// terminate the proxy -assert (zmq_send (control, "TERMINATE", 9, 0) == 0); -\-\-\- - - -SEE ALSO -.fi -.if n \{\ -.RE -.\} -.sp -\fBzmq_proxy\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_recv.3 b/external/zmq/share/man/man3/zmq_recv.3 deleted file mode 100644 index b4a190d011..0000000000 --- a/external/zmq/share/man/man3/zmq_recv.3 +++ /dev/null @@ -1,122 +0,0 @@ -'\" t -.\" Title: zmq_recv -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_RECV" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_recv \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_recv (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_recv()\fR function shall receive a message from the socket referenced by the \fIsocket\fR argument and store it in the buffer referenced by the \fIbuf\fR argument\&. Any bytes exceeding the length specified by the \fIlen\fR argument shall be truncated\&. If there are no messages available on the specified \fIsocket\fR the \fIzmq_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_recv()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recv()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_recv()\fR function shall return number of bytes in the message if successful\&. Note that the value can exceed the value of the \fIlen\fR parameter in case the message was truncated\&. If not successful the function shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_recv()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_recv()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -char buf [256]; -nbytes = zmq_recv (socket, buf, 256, 0); -assert (nbytes != \-1); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_recvmsg.3 b/external/zmq/share/man/man3/zmq_recvmsg.3 deleted file mode 100644 index 53c704c170..0000000000 --- a/external/zmq/share/man/man3/zmq_recvmsg.3 +++ /dev/null @@ -1,175 +0,0 @@ -'\" t -.\" Title: zmq_recvmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_RECVMSG" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_recvmsg \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_recvmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_recvmsg()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_recvmsg()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_recvmsg()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -this API method is deprecated in favor of zmq_msg_recv(3)\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recvmsg()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_recvmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_recvmsg()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_recvmsg()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The message passed to the function was invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create an empty 0MQ message */ -zmq_msg_t msg; -int rc = zmq_msg_init (&msg); -assert (rc == 0); -/* Block until a message is available to be received from socket */ -rc = zmq_recvmsg (socket, &msg, 0); -assert (rc != \-1); -/* Release message */ -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int more; -size_t more_size = sizeof (more); -do { - /* Create an empty 0MQ message to hold the message part */ - zmq_msg_t part; - int rc = zmq_msg_init (&part); - assert (rc == 0); - /* Block until a message is available to be received from socket */ - rc = zmq_recvmsg (socket, &part, 0); - assert (rc != \-1); - /* Determine if more message parts are to follow */ - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - zmq_msg_close (&part); -} while (more); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_send.3 b/external/zmq/share/man/man3/zmq_send.3 deleted file mode 100644 index efd6725c00..0000000000 --- a/external/zmq/share/man/man3/zmq_send.3 +++ /dev/null @@ -1,153 +0,0 @@ -'\" t -.\" Title: zmq_send -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SEND" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_send \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_send (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_send()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_send()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_send()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_send()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_send (socket, "ABC", 3, ZMQ_SNDMORE); -assert (rc == 3); -rc = zmq_send (socket, "DEFGH", 5, ZMQ_SNDMORE); -assert (rc == 5); -/* Final part; no more parts to follow */ -rc = zmq_send (socket, "JK", 2, 0); -assert (rc == 2); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send_const\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_send_const.3 b/external/zmq/share/man/man3/zmq_send_const.3 deleted file mode 100644 index 2cac45eb28..0000000000 --- a/external/zmq/share/man/man3/zmq_send_const.3 +++ /dev/null @@ -1,153 +0,0 @@ -'\" t -.\" Title: zmq_send_const -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SEND_CONST" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_send_const \- send a constant\-memory message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_send_const (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_send_const()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The message buffer is assumed to be constant\-memory and will therefore not be copied or deallocated in any way\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_send_const()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_send_const()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_send_const()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_send_const()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_send_const()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_send_const (socket, "ABC", 3, ZMQ_SNDMORE); -assert (rc == 3); -rc = zmq_send_const (socket, "DEFGH", 5, ZMQ_SNDMORE); -assert (rc == 5); -/* Final part; no more parts to follow */ -rc = zmq_send_const (socket, "JK", 2, 0); -assert (rc == 2); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_sendmsg.3 b/external/zmq/share/man/man3/zmq_sendmsg.3 deleted file mode 100644 index bf016127f9..0000000000 --- a/external/zmq/share/man/man3/zmq_sendmsg.3 +++ /dev/null @@ -1,193 +0,0 @@ -'\" t -.\" Title: zmq_sendmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SENDMSG" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_sendmsg \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_sendmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_sendmsg()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_sendmsg()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.sp -The \fIzmq_msg_t\fR structure passed to \fIzmq_sendmsg()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it using (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_sendmsg()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -this API method is deprecated in favor of zmq_msg_send(3)\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_sendmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_sendmsg()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_sendmsg()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBFilling in a message and sending it to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a new message, allocating 6 bytes for message content */ -zmq_msg_t msg; -int rc = zmq_msg_init_size (&msg, 6); -assert (rc == 0); -/* Fill in message content with \*(AqAAAAAA\*(Aq */ -memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); -/* Send the message to the socket */ -rc = zmq_sendmsg (socket, &msg, 0); -assert (rc == 6); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_sendmsg (socket, &part1, ZMQ_SNDMORE); -rc = zmq_sendmsg (socket, &part2, ZMQ_SNDMORE); -/* Final part; no more parts to follow */ -rc = zmq_sendmsg (socket, &part3, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_setsockopt.3 b/external/zmq/share/man/man3/zmq_setsockopt.3 deleted file mode 100644 index e4eaa0d6ec..0000000000 --- a/external/zmq/share/man/man3/zmq_setsockopt.3 +++ /dev/null @@ -1,2473 +0,0 @@ -'\" t -.\" Title: zmq_setsockopt -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SETSOCKOPT" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_setsockopt \- set 0MQ socket options -.SH "SYNOPSIS" -.sp -\fBint zmq_setsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, const void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fIoption_len\fR\fR\fB);\fR -.sp -Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE, ZMQ_LINGER, ZMQ_ROUTER_HANDOVER, ZMQ_ROUTER_MANDATORY, ZMQ_PROBE_ROUTER, ZMQ_XPUB_VERBOSE, ZMQ_REQ_CORRELATE, and ZMQ_REQ_RELAXED, only take effect for subsequent socket bind/connects\&. -.sp -Specifically, security options take effect for subsequent bind/connect calls, and can be changed at any time to affect subsequent binds and/or connects\&. -.SH "DESCRIPTION" -.sp -The \fIzmq_setsockopt()\fR function shall set the option specified by the \fIoption_name\fR argument to the value pointed to by the \fIoption_value\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument\&. The \fIoption_len\fR argument is the size of the option value in bytes\&. -.sp -The following socket options can be set with the \fIzmq_setsockopt()\fR function: -.SS "ZMQ_AFFINITY: Set I/O thread affinity" -.sp -The \fIZMQ_AFFINITY\fR option shall set the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. -.sp -Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. -.sp -See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (bitmap) -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.SS "ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections" -.sp -The \fIZMQ_BACKLOG\fR option shall set the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -connections -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_CONNECT_RID: Assign the next outbound connection id" -.sp -The \fIZMQ_CONNECT_RID\fR option sets the peer id of the next host connected via the zmq_connect() call, and immediately readies that connection for data transfer with the named id\&. This option applies only to the first subsequent call to zmq_connect(), calls thereafter use default connection behavior\&. -.sp -Typical use is to set this socket option ahead of each zmq_connect() attempt to a new host\&. Each connection MUST be assigned a unique name\&. Assigning a name that is already in use is not allowed\&. -.sp -Useful when connecting ROUTER to ROUTER, or STREAM to STREAM, as it allows for immediate sending to peers\&. Outbound id framing requirements for ROUTER and STREAM sockets apply\&. -.sp -The peer id should be from 1 to 255 bytes long and MAY NOT start with binary zero\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER, ZMQ_STREAM -T} -.TE -.sp 1 -.SS "ZMQ_CONFLATE: Keep only last message" -.sp -If set, a socket shall keep only one message in its inbound/outbound queue, this message being the last message received/the last message to be sent\&. Ignores \fIZMQ_RCVHWM\fR and \fIZMQ_SNDHWM\fR options\&. Does not support multi\-part messages, in particular, only one part of it is kept in the socket internal queue\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_PULL, ZMQ_PUSH, ZMQ_SUB, ZMQ_PUB, ZMQ_DEALER -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_PUBLICKEY: Set CURVE public key" -.sp -Sets the socket\(cqs long term public key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. The public key must always be used with the matching secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SECRETKEY: Set CURVE secret key" -.sp -Sets the socket\(cqs long term secret key\&. You must set this on both CURVE client and server sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVER: Set CURVE server role" -.sp -Defines whether the socket will act as server for CURVE security, see \fBzmq_curve\fR(7)\&. A value of \fI1\fR means the socket will act as CURVE server\&. A value of \fI0\fR means the socket will not act as CURVE server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. When you set this you must also set the server\(cqs secret key using the ZMQ_CURVE_SECRETKEY option\&. A server socket does not need to know its own public key\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVERKEY: Set CURVE server key" -.sp -Sets the socket\(cqs long term server key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. This key must have been generated together with the server\(cqs secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption" -.sp -Defines whether communications on the socket will encrypted, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal" -.sp -Sets the name of the pricipal for whom GSSAPI credentials should be acquired\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVER: Set GSSAPI server role" -.sp -Defines whether the socket will act as server for GSSAPI security, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means the socket will act as GSSAPI server\&. A value of \fI0\fR means the socket will act as GSSAPI client\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal" -.sp -Sets the name of the pricipal of the GSSAPI server to which a GSSAPI client intends to connect\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_HANDSHAKE_IVL: Set maximum handshake interval" -.sp -The \fIZMQ_HANDSHAKE_IVL\fR option shall set the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -30000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all but ZMQ_STREAM, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_IDENTITY: Set socket identity" -.sp -The \fIZMQ_IDENTITY\fR option shall set the identity of the specified \fIsocket\fR when connecting to a ROUTER socket\&. The identity should be from 1 to 255 bytes long and may contain any values\&. -.sp -If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ, ZMQ_REP, ZMQ_ROUTER, ZMQ_DEALER\&. -T} -.TE -.sp 1 -.SS "ZMQ_IMMEDIATE: Queue messages only to completed connections" -.sp -By default queues will fill on outgoing connections even if the connection has not completed\&. This can lead to "lost" messages on sockets with round\-robin routing (REQ, PUSH, DEALER)\&. If this option is set to 1, messages shall be queued only to completed connections\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Enable IPv6 on socket" -.sp -Set the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_LINGER: Set linger period for socket shutdown" -.sp -The \fIZMQ_LINGER\fR option shall set the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is disconnected with \fBzmq_disconnect\fR(3) or closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_term\fR(3)\&. The following outlines the different behaviours: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The default value of -\fI\-1\fR -specifies an infinite linger period\&. Pending messages shall not be discarded after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_term()\fR -shall block until all pending messages have been sent to a peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The value of -\fI0\fR -specifies no linger period\&. Pending messages shall be discarded immediately after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_term()\fR -shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -Option value type -T}:T{ -int -T} -T{ -Option value unit -T}:T{ -milliseconds -T} -T{ -Default value -T}:T{ -\-1 (infinite) -T} -T{ -Applicable socket types -T}:T{ -all -T} -.TE -.sp 1 -.RE -.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" -.sp -Limits the size of the inbound message\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" -.sp -Sets the time\-to\-live field in every multicast packet sent from this socket\&. The default is 1 which means that the multicast packets don\(cqt leave the local network\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -network hops -T} -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_PASSWORD: Set PLAIN security password" -.sp -Sets the password for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_SERVER: Set PLAIN server role" -.sp -Defines whether the socket will act as server for PLAIN security, see \fBzmq_plain\fR(7)\&. A value of \fI1\fR means the socket will act as PLAIN server\&. A value of \fI0\fR means the socket will not act as PLAIN server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_USERNAME: Set PLAIN security username" -.sp -Sets the username for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets" -.sp -When set to 1, the socket will automatically send an empty message when a new connection is made or accepted\&. You may set this on REQ, DEALER, or ROUTER sockets connected to a ROUTER socket\&. The application must filter such empty messages\&. The ZMQ_PROBE_ROUTER option in effect provides the ROUTER application with an event signaling the arrival of a new peer\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -do not set this option on a socket that talks to any other socket types: the results are undefined\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER, ZMQ_DEALER, ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_RATE: Set multicast data rate" -.sp -The \fIZMQ_RATE\fR option shall set the maximum send or receive data rate for multicast transports such as \fBzmq_pgm\fR(7) using the specified \fIsocket\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -kilobits per second -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_RCVBUF: Set kernel receive buffer size" -.sp -The \fIZMQ_RCVBUF\fR option shall set the underlying kernel receive buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of zero means leave the OS default unchanged\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVHWM: Set high water mark for inbound messages" -.sp -The \fIZMQ_RCVHWM\fR option shall set the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN" -.sp -Sets the timeout for receive operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL: Set reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL\fR option shall set the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL_MAX\fR option shall set the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Values less than ZMQ_RECONNECT_IVL will be ignored\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (only use ZMQ_RECONNECT_IVL) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECOVERY_IVL: Set multicast recovery interval" -.sp -The \fIZMQ_RECOVERY_IVL\fR option shall set the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Exercise care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -10000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_REQ_CORRELATE: match replies with requests" -.sp -The default behavior of REQ sockets is to rely on the ordering of messages to match requests and responses and that is usually sufficient\&. When this option is set to 1, the REQ socket will prefix outgoing messages with an extra frame containing a request id\&. That means the full message is (request id, identity, 0, user frames\&...)\&. The REQ socket will discard all incoming messages that don\(cqt begin with these two frames\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_REQ_RELAXED: relax strict alternation between request and reply" -.sp -By default, a REQ socket does not allow initiating a new request with \fIzmq_send(3)\fR until the reply to the previous one has been received\&. When set to 1, sending another message is allowed and has the effect of disconnecting the underlying connection to the peer from which the reply was expected, triggering a reconnection attempt on transports that support it\&. The request\-reply state machine is reset and a new request is sent to the next available peer\&. -.sp -If set to 1, also enable ZMQ_REQ_CORRELATE to ensure correct matching of requests and replies\&. Otherwise a late reply to an aborted request can be reported as the reply to the superseding request\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets" -.sp -If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets" -.sp -Sets the ROUTER socket behavior when an unroutable message is encountered\&. A value of 0 is the default and discards the message silently when it cannot be routed or the peers SNDHWM is reached\&. A value of 1 returns an \fIEHOSTUNREACH\fR error code if the message cannot be routed or \fIEAGAIN\fR error code if the SNDHWM is reached and ZMQ_DONTWAIT was used\&. Without ZMQ_DONTWAIT it will block until the SNDTIMEO is reached or a spot in the send queue opens up\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode" -.sp -Sets the raw mode on the ROUTER, when set to 1\&. When the ROUTER socket is in raw mode, and when using the tcp:// transport, it will read and write TCP data without 0MQ framing\&. This lets 0MQ applications talk to non\-0MQ applications\&. When using raw mode, you cannot set explicit identities, and the ZMQ_SNDMORE flag is ignored when sending data messages\&. In raw mode you can close a specific connection by sending it a zero\-length message (following the identity frame)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use ZMQ_STREAM sockets instead\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_SNDBUF: Set kernel transmit buffer size" -.sp -The \fIZMQ_SNDBUF\fR option shall set the underlying kernel transmit buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of zero means leave the OS default unchanged\&. For details please refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDHWM: Set high water mark for outbound messages" -.sp -The \fIZMQ_SNDHWM\fR option shall set the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -0MQ does not guarantee that the socket will accept as many as ZMQ_SNDHWM messages, and the actual limit may be as much as 60\-70% lower depending on the flow of messages on the socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN" -.sp -Sets the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SUBSCRIBE: Establish message filter" -.sp -The \fIZMQ_SUBSCRIBE\fR option shall establish a new message filter on a \fIZMQ_SUB\fR socket\&. Newly created \fIZMQ_SUB\fR sockets shall filter out all incoming messages, therefore you should call this option to establish an initial message filter\&. -.sp -An empty \fIoption_value\fR of length zero shall subscribe to all incoming messages\&. A non\-empty \fIoption_value\fR shall subscribe to all messages beginning with the specified prefix\&. Multiple filters may be attached to a single \fIZMQ_SUB\fR socket, in which case a message shall be accepted if it matches at least one filter\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" -.sp -Override \fISO_KEEPALIVE\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" -.sp -Override \fITCP_KEEPCNT\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT (or TCP_KEEPALIVE on some OS)" -.sp -Override \fITCP_KEEPCNT\fR (or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" -.sp -Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TOS: Set the Type\-of\-Service on socket" -.sp -Sets the ToS fields (Differentiated services (DS) and Explicit Congestion Notification (ECN) field of the IP header\&. The ToS field is typically used to specify a packets priority\&. The availability of this option is dependent on intermediate network equipment that inspect the ToS field andprovide a path for low\-delay, high\-throughput, highly\-reliable service, etc\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp ->0 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_UNSUBSCRIBE: Remove message filter" -.sp -The \fIZMQ_UNSUBSCRIBE\fR option shall remove an existing message filter on a \fIZMQ_SUB\fR socket\&. The filter specified must match an existing filter previously established with the \fIZMQ_SUBSCRIBE\fR option\&. If the socket has several instances of the same filter attached the \fIZMQ_UNSUBSCRIBE\fR option shall remove only one instance, leaving the rest in place and functional\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets" -.sp -Sets the \fIXPUB\fR socket behavior on new subscriptions and unsubscriptions\&. A value of \fI0\fR is the default and passes only new subscription messages to upstream\&. A value of \fI1\fR passes all subscription messages upstream\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB -T} -.TE -.sp 1 -.SS "ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain" -.sp -Sets the domain for ZAP (ZMQ RFC 27) authentication\&. For NULL security (the default on all tcp:// connections), ZAP authentication only happens if you set a non\-empty domain\&. For PLAIN and CURVE security, ZAP requests are always made, if there is a ZAP handler present\&. See \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:27\fR\m[] for more details\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections" -.sp -Assign an arbitrary number of filters that will be applied for each new TCP transport connection on a listening socket\&. If no filters are applied, then the TCP transport allows connections from any IP address\&. If at least one filter is applied then new connection source ip should be matched\&. To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0)\&. Filter is a null\-terminated string with ipv6 or ipv4 CIDR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IP address whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all GID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_GID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -GID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -gid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all PID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_PID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -PID filters are only available on platforms supporting the SO_PEERCRED socket option (currently only Linux)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -pid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all UID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_UID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -UID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV4ONLY: Use IPv4\-only on socket" -.sp -Set the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -1 (true) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_setsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown, or the requested -\fIoption_len\fR -or -\fIoption_value\fR -is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal\&. -.RE -.SH "EXAMPLE" -.PP -\fBSubscribing to messages on a ZMQ_SUB socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Subscribe to all messages */ -rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0); -assert (rc == 0); -/* Subscribe to messages prefixed with "ANIMALS\&.CATS" */ -rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS\&.CATS", 12); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSetting I/O thread affinity\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int64_t affinity; -/* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */ -affinity = 1; -rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); -assert (rc); -rc = zmq_bind (socket, "tcp://lo:5555"); -assert (rc); -/* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */ -affinity = 2; -rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); -assert (rc); -rc = zmq_bind (socket, "tcp://lo:5556"); -assert (rc); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_socket.3 b/external/zmq/share/man/man3/zmq_socket.3 deleted file mode 100644 index a0e75f6e51..0000000000 --- a/external/zmq/share/man/man3/zmq_socket.3 +++ /dev/null @@ -1,1025 +0,0 @@ -'\" t -.\" Title: zmq_socket -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SOCKET" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_socket \- create 0MQ socket -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_socket (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fItype\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_socket()\fR function shall create a 0MQ socket within the specified \fIcontext\fR and return an opaque handle to the newly created socket\&. The \fItype\fR argument specifies the socket type, which determines the semantics of communication over the socket\&. -.sp -The newly created socket is initially unbound, and not associated with any endpoints\&. In order to establish a message flow a socket must first be connected to at least one endpoint with \fBzmq_connect\fR(3), or at least one endpoint must be created for accepting incoming connections with \fBzmq_bind\fR(3)\&. -.PP -\fBKey differences to conventional sockets\fR. Generally speaking, conventional sockets present a -\fIsynchronous\fR -interface to either connection\-oriented reliable byte streams (SOCK_STREAM), or connection\-less unreliable datagrams (SOCK_DGRAM)\&. In comparison, 0MQ sockets present an abstraction of an asynchronous -\fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. Where conventional sockets transfer streams of bytes or discrete datagrams, 0MQ sockets transfer discrete -\fImessages\fR\&. -.sp -0MQ sockets being \fIasynchronous\fR means that the timings of the physical connection setup and tear down, reconnect and effective delivery are transparent to the user and organized by 0MQ itself\&. Further, messages may be \fIqueued\fR in the event that a peer is unavailable to receive them\&. -.sp -Conventional sockets allow only strict one\-to\-one (two peers), many\-to\-one (many clients, one server), or in some cases one\-to\-many (multicast) relationships\&. With the exception of \fIZMQ_PAIR\fR, 0MQ sockets may be connected \fBto multiple endpoints\fR using \fIzmq_connect()\fR, while simultaneously accepting incoming connections \fBfrom multiple endpoints\fR bound to the socket using \fIzmq_bind()\fR, thus allowing many\-to\-many relationships\&. -.PP -\fBThread safety\fR. 0MQ -\fIsockets\fR -are -\fInot\fR -thread safe\&. Applications MUST NOT use a socket from multiple threads except after migrating a socket from one thread to another with a "full fence" memory barrier\&. -.PP -\fBSocket types\fR. The following sections present the socket types defined by 0MQ, grouped by the general -\fImessaging pattern\fR -which is built from related socket types\&. -.SS "Request\-reply pattern" -.sp -The request\-reply pattern is used for sending requests from a ZMQ_REQ \fIclient\fR to one or more ZMQ_REP \fIservices\fR, and receiving subsequent replies to each request sent\&. -.sp -The request\-reply pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:28\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_REQ\fR -.RS 4 -.sp -A socket of type \fIZMQ_REQ\fR is used by a \fIclient\fR to send requests to and receive replies from a \fIservice\fR\&. This socket type allows only an alternating sequence of \fIzmq_send(request)\fR and subsequent \fIzmq_recv(reply)\fR calls\&. Each request sent is round\-robined among all \fIservices\fR, and each reply received is matched with the last issued request\&. -.sp -If no services are available, then any send operation on the socket shall block until at least one \fIservice\fR becomes available\&. The REQ socket shall not discard messages\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&1.\ \&Summary of ZMQ_REQ characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_REP\fR, \fIZMQ_ROUTER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send, Receive, Send, Receive, \&... -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Last peer -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_REP\fR -.RS 4 -.sp -A socket of type \fIZMQ_REP\fR is used by a \fIservice\fR to receive requests from and send replies to a \fIclient\fR\&. This socket type allows only an alternating sequence of \fIzmq_recv(request)\fR and subsequent \fIzmq_send(reply)\fR calls\&. Each request received is fair\-queued from among all \fIclients\fR, and each reply sent is routed to the \fIclient\fR that issued the last request\&. If the original requester does not exist any more the reply is silently discarded\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&2.\ \&Summary of ZMQ_REP characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_REQ\fR, \fIZMQ_DEALER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive, Send, Receive, Send, \&... -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Last peer -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_DEALER\fR -.RS 4 -.sp -A socket of type \fIZMQ_DEALER\fR is an advanced pattern used for extending request/reply sockets\&. Each message sent is round\-robined among all connected peers, and each message received is fair\-queued from all connected peers\&. -.sp -When a \fIZMQ_DEALER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, or if there are no peers at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one peer becomes available for sending; messages are not discarded\&. -.sp -When a \fIZMQ_DEALER\fR socket is connected to a \fIZMQ_REP\fR socket each message sent must consist of an empty message part, the \fIdelimiter\fR, followed by one or more \fIbody parts\fR\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&3.\ \&Summary of ZMQ_DEALER characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_ROUTER\fR, \fIZMQ_REP\fR, \fIZMQ_DEALER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_ROUTER\fR -.RS 4 -.sp -A socket of type \fIZMQ_ROUTER\fR is an advanced socket type used for extending request/reply sockets\&. When receiving messages a \fIZMQ_ROUTER\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. When sending messages a \fIZMQ_ROUTER\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to\&. If the peer does not exist anymore the message shall be silently discarded by default, unless \fIZMQ_ROUTER_MANDATORY\fR socket option is set to \fI1\fR\&. -.sp -When a \fIZMQ_ROUTER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, then any messages sent to the socket shall be dropped until the mute state ends\&. Likewise, any messages routed to a peer for which the individual high water mark has been reached shall also be dropped\&. -.sp -When a \fIZMQ_REQ\fR socket is connected to a \fIZMQ_ROUTER\fR socket, in addition to the \fIidentity\fR of the originating peer each message received shall contain an empty \fIdelimiter\fR message part\&. Hence, the entire structure of each received message as seen by the application becomes: one or more \fIidentity\fR parts, \fIdelimiter\fR part, one or more \fIbody parts\fR\&. When sending replies to a \fIZMQ_REQ\fR socket the application must include the \fIdelimiter\fR part\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&4.\ \&Summary of ZMQ_ROUTER characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_DEALER\fR, \fIZMQ_REQ\fR, \fIZMQ_ROUTER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -See text -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.SS "Publish\-subscribe pattern" -.sp -The publish\-subscribe pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. -.sp -The publish\-subscribe pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:29\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PUB\fR -.RS 4 -.sp -A socket of type \fIZMQ_PUB\fR is used by a \fIpublisher\fR to distribute data\&. Messages sent are distributed in a fan out fashion to all connected peers\&. The \fBzmq_recv\fR(3) function is not implemented for this socket type\&. -.sp -When a \fIZMQ_PUB\fR socket enters the \fImute\fR state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the mute state ends\&. The \fIzmq_send()\fR function shall never block for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&5.\ \&Summary of ZMQ_PUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Fan out -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_SUB\fR -.RS 4 -.sp -A socket of type \fIZMQ_SUB\fR is used by a \fIsubscriber\fR to subscribe to data distributed by a \fIpublisher\fR\&. Initially a \fIZMQ_SUB\fR socket is not subscribed to any messages, use the \fIZMQ_SUBSCRIBE\fR option of \fBzmq_setsockopt\fR(3) to specify which messages to subscribe to\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&6.\ \&Summary of ZMQ_SUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_XPUB\fR -.RS 4 -.sp -Same as ZMQ_PUB except that you can receive subscriptions from the peers in form of incoming messages\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix are also received, but have no effect on subscription status\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&7.\ \&Summary of ZMQ_XPUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send messages, receive subscriptions -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Fan out -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_XSUB\fR -.RS 4 -.sp -Same as ZMQ_SUB except that you subscribe by sending subscription messages to the socket\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix may also be sent, but have no effect on subscription status\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&8.\ \&Summary of ZMQ_XSUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive messages, send subscriptions -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.SS "Pipeline pattern" -.sp -The pipeline pattern is used for distributing data to \fInodes\fR arranged in a pipeline\&. Data always flows down the pipeline, and each stage of the pipeline is connected to at least one \fInode\fR\&. When a pipeline stage is connected to multiple \fInodes\fR data is round\-robined among all connected \fInodes\fR\&. -.sp -The pipeline pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:30\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PUSH\fR -.RS 4 -.sp -A socket of type \fIZMQ_PUSH\fR is used by a pipeline \fInode\fR to send messages to downstream pipeline \fInodes\fR\&. Messages are round\-robined to all connected downstream \fInodes\fR\&. The \fIzmq_recv()\fR function is not implemented for this socket type\&. -.sp -When a \fIZMQ_PUSH\fR socket enters the \fImute\fR state due to having reached the high water mark for all downstream \fInodes\fR, or if there are no downstream \fInodes\fR at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one downstream \fInode\fR becomes available for sending; messages are not discarded\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&9.\ \&Summary of ZMQ_PUSH characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PULL\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PULL\fR -.RS 4 -.sp -A socket of type \fIZMQ_PULL\fR is used by a pipeline \fInode\fR to receive messages from upstream pipeline \fInodes\fR\&. Messages are fair\-queued from among all connected upstream \fInodes\fR\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&10.\ \&Summary of ZMQ_PULL characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUSH\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.SS "Exclusive pair pattern" -.sp -The exclusive pair pattern is used to connect a peer to precisely one other peer\&. This pattern is used for inter\-thread communication across the inproc transport\&. -.sp -The exclusive pair pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:31\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PAIR\fR -.RS 4 -.sp -A socket of type \fIZMQ_PAIR\fR can only be connected to a single peer at any one time\&. No message routing or filtering is performed on messages sent over a \fIZMQ_PAIR\fR socket\&. -.sp -When a \fIZMQ_PAIR\fR socket enters the \fImute\fR state due to having reached the high water mark for the connected peer, or if no peer is connected, then any \fBzmq_send\fR(3) operations on the socket shall block until the peer becomes available for sending; messages are not discarded\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_PAIR\fR sockets are designed for inter\-thread communication across the \fBzmq_inproc\fR(7) transport and do not implement functionality such as auto\-reconnection\&. \fIZMQ_PAIR\fR sockets are considered experimental and may have other missing or broken aspects\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&11.\ \&Summary of ZMQ_PAIR characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PAIR\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.SS "Native Pattern" -.sp -The native pattern is used for communicating with TCP peers and allows asynchronous requests and replies in either direction\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_STREAM\fR -.RS 4 -.sp -A socket of type \fIZMQ_STREAM\fR is used to send and receive TCP data from a non\-0MQ peer, when using the tcp:// transport\&. A \fIZMQ_STREAM\fR socket can act as client and/or server, sending and/or receiving TCP data asynchronously\&. -.sp -When receiving TCP data, a \fIZMQ_STREAM\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. -.sp -When sending TCP data, a \fIZMQ_STREAM\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error\&. -.sp -To open a connection to a server, use the zmq_connect call, and then fetch the socket identity using the ZMQ_IDENTITY zmq_getsockopt call\&. -.sp -To close a specific connection, send the identity frame followed by a zero\-length message (see EXAMPLE section)\&. -.sp -When a connection is made, a zero\-length message will be received by the application\&. Similarly, when the peer disconnects (or the connection is lost), a zero\-length message will be received by the application\&. -.sp -The ZMQ_SNDMORE flag is ignored on data frames\&. You must send one identity frame followed by one data frame\&. -.sp -Also, please note that omitting the ZMQ_SNDMORE flag will prevent sending further data (from any client) on the same socket\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&12.\ \&Summary of ZMQ_STREAM characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -none\&. -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -See text -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -EAGAIN -T} -.TE -.sp 1 -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_socket()\fR function shall return an opaque handle to the newly created socket if successful\&. Otherwise, it shall return NULL and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested socket -\fItype\fR -is invalid\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -is invalid\&. -.RE -.PP -\fBEMFILE\fR -.RS 4 -The limit on the total number of open 0MQ sockets has been reached\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The context specified was terminated\&. -.RE -.SH "EXAMPLE" -.PP -\fBCreating a simple HTTP server using ZMQ_STREAM\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *ctx = zmq_ctx_new (); -assert (ctx); -/* Create ZMQ_STREAM socket */ -void *socket = zmq_socket (ctx, ZMQ_STREAM); -assert (socket); -int rc = zmq_bind (socket, "tcp://*:8080"); -assert (rc == 0); -/* Data structure to hold the ZMQ_STREAM ID */ -uint8_t id [256]; -size_t id_size = 256; -/* Data structure to hold the ZMQ_STREAM received data */ -uint8_t raw [256]; -size_t raw_size = 256; -while (1) { - /* Get HTTP request; ID frame and then request */ - id_size = zmq_recv (socket, id, 256, 0); - assert (id_size > 0); - do { - raw_size = zmq_recv (socket, raw, 256, 0); - assert (raw_size >= 0); - } while (raw_size == 256); - /* Prepares the response */ - char http_response [] = - "HTTP/1\&.0 200 OK\er\en" - "Content\-Type: text/plain\er\en" - "\er\en" - "Hello, World!"; - /* Sends the ID frame followed by the response */ - zmq_send (socket, id, id_size, ZMQ_SNDMORE); - zmq_send (socket, http_response, strlen (http_response), ZMQ_SNDMORE); - /* Closes the connection by sending the ID frame followed by a zero response */ - zmq_send (socket, id, id_size, ZMQ_SNDMORE); - zmq_send (socket, 0, 0, ZMQ_SNDMORE); - /* NOTE: If we don\*(Aqt use ZMQ_SNDMORE, then we won\*(Aqt be able to send more */ - /* message to any client */ -} -zmq_close (socket); -zmq_ctx_destroy (ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_init\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_inproc\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_socket_monitor.3 b/external/zmq/share/man/man3/zmq_socket_monitor.3 deleted file mode 100644 index 0b0ab16fd5..0000000000 --- a/external/zmq/share/man/man3/zmq_socket_monitor.3 +++ /dev/null @@ -1,235 +0,0 @@ -'\" t -.\" Title: zmq_socket_monitor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_SOCKET_MONITOR" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_socket_monitor \- monitor socket events -.SH "SYNOPSIS" -.sp -\fBint zmq_socket_monitor (void \fR\fB\fI*socket\fR\fR\fB, char \fR\fB\fI*endpoint\fR\fR\fB, int \fR\fB\fIevents\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_socket_monitor()\fR method lets an application thread track socket events (like connects) on a ZeroMQ socket\&. Each call to this method creates a \fIZMQ_PAIR\fR socket and binds that to the specified inproc:// \fIendpoint\fR\&. To collect the socket events, you must create your own \fIZMQ_PAIR\fR socket, and connect that to the endpoint\&. -.sp -The \fIevents\fR argument is a bitmask of the socket events you wish to monitor, see \fISupported events\fR below\&. To monitor all events, use the event value ZMQ_EVENT_ALL\&. -.sp -Each event is sent as two frames\&. The first frame contains an event number (16 bits), and an event value (32 bits) that provides additional data according to the event number\&. The second frame contains a string that specifies the affected TCP or IPC endpoint\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -The _zmq_socket_monitor()_ method supports only connection\-oriented -transports, that is, TCP, IPC, and TIPC\&. -.fi -.if n \{\ -.RE -.\} -.SH "SUPPORTED EVENTS" -.SS "ZMQ_EVENT_CONNECTED" -.sp -The socket has successfully connected to a remote peer\&. The event value is the file descriptor (FD) of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_CONNECT_DELAYED" -.sp -A connect request on the socket is pending\&. The event value is unspecified\&. -.SS "ZMQ_EVENT_CONNECT_RETRIED" -.sp -A connect request failed, and is now being retried\&. The event value is the reconnect interval in milliseconds\&. Note that the reconnect interval is recalculated at each retry\&. -.SS "ZMQ_EVENT_LISTENING" -.sp -The socket was successfully bound to a network interface\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_BIND_FAILED" -.sp -The socket could not bind to a given interface\&. The event value is the errno generated by the system bind call\&. -.SS "ZMQ_EVENT_ACCEPTED" -.sp -The socket has accepted a connection from a remote peer\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_ACCEPT_FAILED" -.sp -The socket has rejected a connection from a remote peer\&. The event value is the errno generated by the accept call\&. -.SS "ZMQ_EVENT_CLOSED" -.sp -The socket was closed\&. The event value is the FD of the (now closed) network socket\&. -.SS "ZMQ_EVENT_CLOSE_FAILED" -.sp -The socket close failed\&. The event value is the errno returned by the system call\&. Note that this event occurs only on IPC transports\&. -.SS "ZMQ_EVENT_DISCONNECTED" -.sp -The socket was disconnected unexpectedly\&. The event value is the FD of the underlying network socket\&. Warning: this socket will be closed\&. -.SS "ZMQ_EVENT_MONITOR_STOPPED" -.sp -Monitoring on this socket ended\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_socket_monitor()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. Monitor sockets are required to use the inproc:// transport\&. -.RE -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBMonitoring client and server sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Read one event off the monitor socket; return value and address -// by reference, if not null, and event number by value\&. Returns \-1 -// in case of error\&. - -static int -get_monitor_event (void *monitor, int *value, char **address) -{ - // First frame in message contains event number and value - zmq_msg_t msg; - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == \-1) - return \-1; // Interruped, presumably - assert (zmq_msg_more (&msg)); - - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - uint16_t event = *(uint16_t *) (data); - if (value) - *value = *(uint32_t *) (data + 2); - - // Second frame in message contains event address - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == \-1) - return \-1; // Interruped, presumably - assert (!zmq_msg_more (&msg)); - - if (address) { - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - size_t size = zmq_msg_size (&msg); - *address = (char *) malloc (size + 1); - memcpy (*address, data, size); - *address [size] = 0; - } - return event; -} - -int main (void) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We\*(Aqll monitor these two sockets - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - - // Socket monitoring only works over inproc:// - int rc = zmq_socket_monitor (client, "tcp://127\&.0\&.0\&.1:9999", 0); - assert (rc == \-1); - assert (zmq_errno () == EPROTONOSUPPORT); - - // Monitor all events on client and server sockets - rc = zmq_socket_monitor (client, "inproc://monitor\-client", ZMQ_EVENT_ALL); - assert (rc == 0); - rc = zmq_socket_monitor (server, "inproc://monitor\-server", ZMQ_EVENT_ALL); - assert (rc == 0); - - // Create two sockets for collecting monitor events - void *client_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (client_mon); - void *server_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (server_mon); - - // Connect these to the inproc endpoints so they\*(Aqll get events - rc = zmq_connect (client_mon, "inproc://monitor\-client"); - assert (rc == 0); - rc = zmq_connect (server_mon, "inproc://monitor\-server"); - assert (rc == 0); - - // Now do a basic ping test - rc = zmq_bind (server, "tcp://127\&.0\&.0\&.1:9998"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127\&.0\&.0\&.1:9998"); - assert (rc == 0); - bounce (client, server); - - // Close client and server - close_zero_linger (client); - close_zero_linger (server); - - // Now collect and check events from both sockets - int event = get_monitor_event (client_mon, NULL, NULL); - if (event == ZMQ_EVENT_CONNECT_DELAYED) - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CONNECTED); - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // This is the flow of server events - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_LISTENING); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_ACCEPTED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CLOSED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // Close down the sockets - close_zero_linger (client_mon); - close_zero_linger (server_mon); - zmq_ctx_term (ctx); - - return 0 ; -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_strerror.3 b/external/zmq/share/man/man3/zmq_strerror.3 deleted file mode 100644 index f5b4f174bd..0000000000 --- a/external/zmq/share/man/man3/zmq_strerror.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_strerror -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_STRERROR" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_strerror \- get 0MQ error message string -.SH "SYNOPSIS" -.sp -\fBconst char *zmq_strerror (int \fR\fB\fIerrnum\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_strerror()\fR function shall return a pointer to an error message string corresponding to the error number specified by the \fIerrnum\fR argument\&. As 0MQ defines additional error numbers over and above those defined by the operating system, applications should use \fIzmq_strerror()\fR in preference to the standard \fIstrerror()\fR function\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_strerror()\fR function shall return a pointer to an error message string\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBDisplaying an error message when a 0MQ context cannot be initialised\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *ctx = zmq_init (1, 1, 0); -if (!ctx) { - printf ("Error occurred during zmq_init(): %s\en", zmq_strerror (errno)); - abort (); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_unbind.3 b/external/zmq/share/man/man3/zmq_unbind.3 deleted file mode 100644 index ee583d0000..0000000000 --- a/external/zmq/share/man/man3/zmq_unbind.3 +++ /dev/null @@ -1,120 +0,0 @@ -'\" t -.\" Title: zmq_unbind -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_UNBIND" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_unbind \- Stop accepting connections on a socket -.SH "SYNOPSIS" -.sp -int zmq_unbind (void \fI*socket\fR, const char \fI*endpoint\fR); -.SH "DESCRIPTION" -.sp -The \fIzmq_unbind()\fR function shall unbind a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. -.sp -The \fIendpoint\fR argument is as described in \fBzmq_bind\fR(3) -.SS "Unbinding wild\-card addres from a socket" -.sp -When wild\-card * \fIendpoint\fR (described in \fBzmq_tcp\fR(7) and \fBzmq_ipc\fR(7)) was used in \fIzmq_bind()\fR, the caller should use real \fIendpoind\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_unbind()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.SH "EXAMPLES" -.PP -\fBUnbind a subscriber socket from a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -/* Disconnect from the previously connected endpoint */ -rc = zmq_unbind (socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBUnbind wild-card * binded socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Bind it to the system\-assigned ephemeral port using a TCP transport */ -rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:*"); -assert (rc == 0); -/* Obtain real endpoint */ -const size_t buf_size = 32; -char buf[buf_size]; -rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size); -assert (rc == 0); -/* Unbind socket by real endpoint */ -rc = zmq_unbind (socket, buf); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_version.3 b/external/zmq/share/man/man3/zmq_version.3 deleted file mode 100644 index 966b85db15..0000000000 --- a/external/zmq/share/man/man3/zmq_version.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_version -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_VERSION" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_version \- report 0MQ library version -.SH "SYNOPSIS" -.sp -\fBvoid zmq_version (int \fR\fB\fI*major\fR\fR\fB, int \fR\fB\fI*minor\fR\fR\fB, int \fR\fB\fI*patch\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_version()\fR function shall fill in the integer variables pointed to by the \fImajor\fR, \fIminor\fR and \fIpatch\fR arguments with the major, minor and patch level components of the 0MQ library version\&. -.sp -This functionality is intended for applications or language bindings dynamically linking to the 0MQ library that wish to determine the actual version of the 0MQ library they are using\&. -.SH "RETURN VALUE" -.sp -There is no return value\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBPrinting out the version of the 0MQ library\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int major, minor, patch; -zmq_version (&major, &minor, &patch); -printf ("Current 0MQ version is %d\&.%d\&.%d\en", major, minor, patch); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_z85_decode.3 b/external/zmq/share/man/man3/zmq_z85_decode.3 deleted file mode 100644 index 971548b091..0000000000 --- a/external/zmq/share/man/man3/zmq_z85_decode.3 +++ /dev/null @@ -1,64 +0,0 @@ -'\" t -.\" Title: zmq_z85_decode -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_Z85_DECODE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_z85_decode \- decode a binary key from Z85 printable text -.SH "SYNOPSIS" -.sp -\fBuint8_t *zmq_z85_decode (uint8_t *dest, const char *string);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_z85_decode()\fR function shall decode \fIstring\fR into \fIdest\fR\&. The length of \fIstring\fR shall be divisible by 5\&. \fIdest\fR must be large enough for the decoded value (0\&.8 x strlen (string))\&. -.sp -The encoding shall follow the ZMQ RFC 32 specification\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_z85_decode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. -.SH "EXAMPLE" -.PP -\fBDecoding a CURVE key\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -const char decoded [] = "rq:rM>}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7"; -uint8_t public_key [32]; -zmq_z85_decode (public_key, decoded); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmq_z85_encode.3 b/external/zmq/share/man/man3/zmq_z85_encode.3 deleted file mode 100644 index 1546cb37cc..0000000000 --- a/external/zmq/share/man/man3/zmq_z85_encode.3 +++ /dev/null @@ -1,69 +0,0 @@ -'\" t -.\" Title: zmq_z85_encode -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_Z85_ENCODE" "3" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_z85_encode \- encode a binary key as Z85 printable text -.SH "SYNOPSIS" -.sp -\fBchar *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_z85_encode()\fR function shall encode the binary block specified by \fIdata\fR and \fIsize\fR into a string in \fIdest\fR\&. The size of the binary block must be divisible by 4\&. The \fIdest\fR must have sufficient space for size * 1\&.25 plus 1 for a null terminator\&. A 32\-byte CURVE key is encoded as 40 ASCII characters plus a null terminator\&. -.sp -The encoding shall follow the ZMQ RFC 32 specification\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_z85_encode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. -.SH "EXAMPLE" -.PP -\fBEncoding a CURVE key\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -#include -uint8_t public_key [32]; -uint8_t secret_key [32]; -int rc = crypto_box_keypair (public_key, secret_key); -assert (rc == 0); -char encoded [41]; -zmq_z85_encode (encoded, public_key, 32); -puts (encoded); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man3/zmsg.3 b/external/zmq/share/man/man3/zmsg.3 deleted file mode 100644 index 0be48b58cf..0000000000 --- a/external/zmq/share/man/man3/zmsg.3 +++ /dev/null @@ -1,545 +0,0 @@ -'\" t -.\" Title: zmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMSG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmsg \- working with multipart messages -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted\&. Does a blocking recv\&. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving\&. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message\&. -// Returns NULL if the message could not be loaded\&. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object\&. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work\&. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status\&. A signal is a short -// message carrying a 1\-byte success/failure code (by convention, 0 means -// OK)\&. Signals are encoded to be distinguishable from "normal" messages\&. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully\&. If the message has no frames, sends nothing but destroys -// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as -// it is a destructor)\&. -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully\&. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part\&. If the message has no frames, sends nothing but destroys -// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as -// it is a destructor)\&. -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i\&.e\&. number of frames (0 or more)\&. -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message\&. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i\&.e\&. before all other frames\&. -// Message takes ownership of frame, will destroy it when message is sent\&. -// Returns 0 on success, \-1 on error\&. Deprecates zmsg_push, which did not -// nullify the caller\*(Aqs frame reference\&. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i\&.e\&. after all other frames\&. -// Message takes ownership of frame, will destroy it when message is sent\&. -// Returns 0 on success\&. Deprecates zmsg_add, which did not nullify the -// caller\*(Aqs frame reference\&. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any\&. Returns frame, or NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string\&. If there were -// no more frames in the message, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame\&. Message takes ownership of -// submessage, so the original is destroyed in this call\&. Returns 0 on -// success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any\&. Returns zmsg_t, or NULL if -// decoding was not successful\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present\&. Does not destroy frame\&. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message\&. Returns frame, or NULL, if the -// message is empty\&. Use this to navigate the frames as a list\&. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame\&. If there are no more frames, returns NULL\&. To move -// to the first frame call zmsg_first()\&. Advances the cursor\&. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame\&. If there are no frames, returns NULL\&. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else \-1\&. The message is -// saved as a series of frames, each with length and data\&. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ\&. The file format is at present undocumented and liable -// to arbitrary change\&. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame\&. Use this method -// to send structured messages across transports that do not support -// multipart data\&. Allocates and returns a new frame containing the -// serialized message\&. To decode a serialized message frame, use -// zmsg_decode ()\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object\&. Returns a fresh zmsg_t -// object\&. If message is null, or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream)\&. -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message\&. As with zframe_eq, return false if either message is NULL\&. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, \-1 if not\&. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t\&. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket\&. -// Else returns zero\&. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message\&. This is used if/when the message is sent to a -// ZMQ_SERVER socket\&. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmsg\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zmsg class provides methods to send and receive multipart messages across 0MQ sockets\&. This class provides a list\-like container interface, with methods to work with the overall container\&. zmsg_t messages are composed of zero or more zframe_t frames\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmsg\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zmsg_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@inproc://zmsg\&.test"); -assert (output); -zsock_t *input = zsock_new_pair (">inproc://zmsg\&.test"); -assert (input); - -// Test send and receive of single\-frame message -zmsg_t *msg = zmsg_new (); -assert (msg); -zframe_t *frame = zframe_new ("Hello", 5); -assert (frame); -zmsg_prepend (msg, &frame); -assert (zmsg_size (msg) == 1); -assert (zmsg_content_size (msg) == 5); -rc = zmsg_send (&msg, output); -assert (msg == NULL); -assert (rc == 0); - -msg = zmsg_recv (input); -assert (msg); -assert (zmsg_size (msg) == 1); -assert (zmsg_content_size (msg) == 5); -zmsg_destroy (&msg); - -// Test send and receive of multi\-frame message -msg = zmsg_new (); -assert (msg); -rc = zmsg_addmem (msg, "Frame0", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame1", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame2", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame3", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame4", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame5", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame6", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame7", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame8", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame9", 6); -assert (rc == 0); -zmsg_t *copy = zmsg_dup (msg); -assert (copy); -rc = zmsg_send (©, output); -assert (rc == 0); -rc = zmsg_send (&msg, output); -assert (rc == 0); - -copy = zmsg_recv (input); -assert (copy); -assert (zmsg_size (copy) == 10); -assert (zmsg_content_size (copy) == 60); -zmsg_destroy (©); - -msg = zmsg_recv (input); -assert (msg); -assert (zmsg_size (msg) == 10); -assert (zmsg_content_size (msg) == 60); - -// Save to a file, read back -FILE *file = fopen ("zmsg\&.test", "w"); -assert (file); -rc = zmsg_save (msg, file); -assert (rc == 0); -fclose (file); - -file = fopen ("zmsg\&.test", "r"); -rc = zmsg_save (msg, file); -assert (rc == \-1); -fclose (file); -zmsg_destroy (&msg); - -file = fopen ("zmsg\&.test", "r"); -msg = zmsg_load (file); -assert (msg); -fclose (file); -remove ("zmsg\&.test"); -assert (zmsg_size (msg) == 10); -assert (zmsg_content_size (msg) == 60); - -// Remove all frames except first and last -int frame_nbr; -for (frame_nbr = 0; frame_nbr < 8; frame_nbr++) { - zmsg_first (msg); - frame = zmsg_next (msg); - zmsg_remove (msg, frame); - zframe_destroy (&frame); -} -// Test message frame manipulation -assert (zmsg_size (msg) == 2); -frame = zmsg_last (msg); -assert (zframe_streq (frame, "Frame9")); -assert (zmsg_content_size (msg) == 12); -frame = zframe_new ("Address", 7); -assert (frame); -zmsg_prepend (msg, &frame); -assert (zmsg_size (msg) == 3); -rc = zmsg_addstr (msg, "Body"); -assert (rc == 0); -assert (zmsg_size (msg) == 4); -frame = zmsg_pop (msg); -zframe_destroy (&frame); -assert (zmsg_size (msg) == 3); -char *body = zmsg_popstr (msg); -assert (streq (body, "Frame0")); -free (body); -zmsg_destroy (&msg); - -// Test encoding/decoding -msg = zmsg_new (); -assert (msg); -byte *blank = (byte *) zmalloc (100000); -assert (blank); -rc = zmsg_addmem (msg, blank, 0); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 1); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 253); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 254); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 255); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 256); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65535); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65536); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65537); -assert (rc == 0); -free (blank); -assert (zmsg_size (msg) == 9); -frame = zmsg_encode (msg); -zmsg_destroy (&msg); -msg = zmsg_decode (frame); -assert (msg); -zmsg_destroy (&msg); -zframe_destroy (&frame); - -// Test submessages -msg = zmsg_new (); -assert (msg); -zmsg_t *submsg = zmsg_new (); -zmsg_pushstr (msg, "matr"); -zmsg_pushstr (submsg, "joska"); -rc = zmsg_addmsg (msg, &submsg); -assert (rc == 0); -assert (submsg == NULL); -submsg = zmsg_popmsg (msg); -assert (submsg == NULL); // string "matr" is not encoded zmsg_t, so was discarded -submsg = zmsg_popmsg (msg); -assert (submsg); -body = zmsg_popstr (submsg); -assert (streq (body, "joska")); -free (body); -zmsg_destroy (&submsg); -frame = zmsg_pop (msg); -assert (frame == NULL); -zmsg_destroy (&msg); - -// Test comparison of two messages -msg = zmsg_new (); -zmsg_addstr (msg, "One"); -zmsg_addstr (msg, "Two"); -zmsg_addstr (msg, "Three"); -zmsg_t *msg_other = zmsg_new (); -zmsg_addstr (msg_other, "One"); -zmsg_addstr (msg_other, "Two"); -zmsg_addstr (msg_other, "One\-Hundred"); -zmsg_t *msg_dup = zmsg_dup (msg); -zmsg_t *empty_msg = zmsg_new (); -zmsg_t *empty_msg_2 = zmsg_new (); -assert (zmsg_eq (msg, msg_dup)); -assert (!zmsg_eq (msg, msg_other)); -assert (zmsg_eq (empty_msg, empty_msg_2)); -assert (!zmsg_eq (msg, NULL)); -assert (!zmsg_eq (NULL, empty_msg)); -assert (!zmsg_eq (NULL, NULL)); -zmsg_destroy (&msg); -zmsg_destroy (&msg_other); -zmsg_destroy (&msg_dup); -zmsg_destroy (&empty_msg); -zmsg_destroy (&empty_msg_2); - -// Test signal messages -msg = zmsg_new_signal (0); -assert (zmsg_signal (msg) == 0); -zmsg_destroy (&msg); -msg = zmsg_new_signal (\-1); -assert (zmsg_signal (msg) == 255); -zmsg_destroy (&msg); - -// Now try methods on an empty message -msg = zmsg_new (); -assert (msg); -assert (zmsg_size (msg) == 0); -assert (zmsg_unwrap (msg) == NULL); -assert (zmsg_first (msg) == NULL); -assert (zmsg_last (msg) == NULL); -assert (zmsg_next (msg) == NULL); -assert (zmsg_pop (msg) == NULL); -// Sending an empty message is valid and destroys the message -assert (zmsg_send (&msg, output) == 0); -assert (!msg); - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Create server and client sockets and connect over inproc -zsock_t *server = zsock_new_server ("inproc://zmsg\-test\-routing"); -assert (server); -zsock_t *client = zsock_new_client ("inproc://zmsg\-test\-routing"); -assert (client); - -// Send request from client to server -zmsg_t *request = zmsg_new (); -assert (request); -zmsg_addstr (request, "Hello"); -rc = zmsg_send (&request, client); -assert (rc == 0); -assert (!request); - -// Read request and send reply -request = zmsg_recv (server); -assert (request); -char *string = zmsg_popstr (request); -assert (streq (string, "Hello")); -assert (zmsg_routing_id (request)); -zstr_free (&string); - -zmsg_t *reply = zmsg_new (); -assert (reply); -zmsg_addstr (reply, "World"); -zmsg_set_routing_id (reply, zmsg_routing_id (request)); -rc = zmsg_send (&reply, server); -assert (rc == 0); -zmsg_destroy (&request); - -// Read reply -reply = zmsg_recv (client); -string = zmsg_popstr (reply); -assert (streq (string, "World")); -assert (zmsg_routing_id (reply) == 0); -zmsg_destroy (&reply); -zstr_free (&string); - -// Client and server disallow multipart -msg = zmsg_new (); -zmsg_addstr (msg, "One"); -zmsg_addstr (msg, "Two"); -rc = zmsg_send (&msg, client); -assert (rc == \-1); -assert (zmsg_size (msg) == 2); -rc = zmsg_send (&msg, server); -assert (rc == \-1); -assert (zmsg_size (msg) == 2); -zmsg_destroy (&msg); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zmutex.3 b/external/zmq/share/man/man3/zmutex.3 deleted file mode 100644 index a377710976..0000000000 --- a/external/zmq/share/man/man3/zmutex.3 +++ /dev/null @@ -1,98 +0,0 @@ -'\" t -.\" Title: zmutex -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZMUTEX" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmutex \- working with mutexes (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// Create a new mutex container -CZMQ_EXPORT zmutex_t * - zmutex_new (void); - -// Destroy a mutex container -CZMQ_EXPORT void - zmutex_destroy (zmutex_t **self_p); - -// Lock mutex -CZMQ_EXPORT void - zmutex_lock (zmutex_t *self); - -// Unlock mutex -CZMQ_EXPORT void - zmutex_unlock (zmutex_t *self); - -// Try to lock mutex -CZMQ_EXPORT int - zmutex_try_lock (zmutex_t *self); - -// Self test of this class -CZMQ_EXPORT void - zmutex_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zmutex class provides a portable wrapper for mutexes\&. Please do not use this class to do multi\-threading\&. It is for the rare case where you absolutely need thread\-safe global state\&. This should happen in system code only\&. DO NOT USE THIS TO SHARE SOCKETS BETWEEN THREADS, OR DARK THINGS WILL HAPPEN TO YOUR CODE\&. -.sp -Please add @discuss section in \&.\&./src/zmutex\&.c\&. -.SH "EXAMPLE" -.PP -\fBFrom zmutex_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmutex_t *mutex = zmutex_new (); -assert (mutex); -zmutex_lock (mutex); -zmutex_unlock (mutex); -zmutex_destroy (&mutex); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zpoller.3 b/external/zmq/share/man/man3/zpoller.3 deleted file mode 100644 index 33e0170d5e..0000000000 --- a/external/zmq/share/man/man3/zpoller.3 +++ /dev/null @@ -1,216 +0,0 @@ -'\" t -.\" Title: zpoller -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPOLLER" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zpoller \- trivial socket poller class -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create new poller, specifying zero or more readers\&. The list of -// readers ends in a NULL\&. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle\&. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, \&.\&.\&.); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled\&. Returns 0 if OK, \-1 on failure\&. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance\&. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, \-1 on failure\&. The reader -// must have been passed during construction, or in an zpoller_add () call\&. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal\&. This makes it impossible to shut\-down message based architectures -// like zactors\&. This method lets you switch off break handling\&. The default -// nonstop setting is off (false)\&. -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input\&. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add\&. The timeout should be -// zero or greater, or \-1 to wait indefinitely\&. Socket priority is defined -// by their order in the poll list\&. If you need a balanced poll, use the low -// level zmq_poll method directly\&. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL\&. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated ()\&. The timeout is in msec\&. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error\&. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed\&. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zpoller\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zpoller class provides a minimalist interface to ZeroMQ\(cqs zmq_poll API, for the very common case of reading from a number of sockets\&. It does not provide polling for output, nor polling on file handles\&. If you need either of these, use the zmq_poll API directly\&. -.sp -The class implements the poller using the zmq_poller API if that exists, else does the work itself\&. -.SH "EXAMPLE" -.PP -\fBFrom zpoller_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create a few sockets -zsock_t *vent = zsock_new (ZMQ_PUSH); -assert (vent); -int port_nbr = zsock_bind (vent, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -zsock_t *sink = zsock_new (ZMQ_PULL); -assert (sink); -int rc = zsock_connect (sink, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); -zsock_t *bowl = zsock_new (ZMQ_PULL); -assert (bowl); -zsock_t *dish = zsock_new (ZMQ_PULL); -assert (dish); - -// Set up poller -zpoller_t *poller = zpoller_new (bowl, dish, NULL); -assert (poller); - -// Add a reader to the existing poller -rc = zpoller_add (poller, sink); -assert (rc == 0); - -zstr_send (vent, "Hello, World"); - -// We expect a message only on the sink -zsock_t *which = (zsock_t *) zpoller_wait (poller, \-1); -assert (which == sink); -assert (zpoller_expired (poller) == false); -assert (zpoller_terminated (poller) == false); -char *message = zstr_recv (which); -assert (streq (message, "Hello, World")); -zstr_free (&message); - -// Stop polling reader -rc = zpoller_remove (poller, sink); -assert (rc == 0); - -// Check we can poll an FD -rc = zsock_connect (bowl, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); -SOCKET fd = zsock_fd (bowl); -rc = zpoller_add (poller, (void *) &fd); -assert (rc != \-1); -zstr_send (vent, "Hello again, world"); -assert (zpoller_wait (poller, 500) == &fd); - -// Check zpoller_set_nonstop () -zsys_interrupted = 1; -zpoller_wait (poller, 0); -assert (zpoller_terminated (poller)); -zpoller_set_nonstop (poller, true); -zpoller_wait (poller, 0); -assert (!zpoller_terminated (poller)); -zsys_interrupted = 0; - -zpoller_destroy (&poller); -zsock_destroy (&vent); -zsock_destroy (&sink); -zsock_destroy (&bowl); -zsock_destroy (&dish); - -#ifdef ZMQ_SERVER -// Check thread safe sockets -zpoller_destroy (&poller); -zsock_t *client = zsock_new (ZMQ_CLIENT); -assert (client); -zsock_t *server = zsock_new (ZMQ_SERVER); -assert (server); -poller = zpoller_new (client, server, NULL); -assert (poller); -port_nbr = zsock_bind (server, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -rc = zsock_connect (client, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); - -zstr_send (client, "Hello, World"); - -// We expect a message only on the server -which = (zsock_t *) zpoller_wait (poller, \-1); -assert (which == server); -assert (zpoller_expired (poller) == false); -assert (zpoller_terminated (poller) == false); -message = zstr_recv (which); -assert (streq (message, "Hello, World")); -zstr_free (&message); - -zpoller_destroy (&poller); -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zproc.3 b/external/zmq/share/man/man3/zproc.3 deleted file mode 100644 index 9bfcfa9c84..0000000000 --- a/external/zmq/share/man/man3/zproc.3 +++ /dev/null @@ -1,208 +0,0 @@ -'\" t -.\" Title: zproc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPROC" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zproc \- process configuration and status -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6\-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch\&. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal\&. -// It is good practice to use this method to exit any infinite loop -// processing messages\&. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security\&. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints\&. -// If the host name is not resolvable, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background\&. The precise effect -// depends on the operating system\&. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP\&. On Windows, does nothing\&. Returns 0 if OK, \-1 if there -// was an error\&. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user\&. Any of the -// arguments may be null, indicating a no\-op\&. Returns 0 on success, -// \-1 on failure\&. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID\&. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use\&. A good -// rule of thumb is one thread per gigabit of traffic in or out\&. The -// default is 1, sufficient for most applications\&. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow\&. The default -// is 1024\&. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon\&. -// This lets the interface be configured for test environments where required\&. -// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is -// the default when there is no specified interface\&. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name\&. -// Setting the interface to "*" means "use all available interfaces"\&. -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set\&. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process\&. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set\&. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint\&. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint\&. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout\&. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints\&. To disable the sender, call -// this method with a null argument\&. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows)\&. By default this is disabled\&. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition \- highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition \- high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition \- normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log informational message \- low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log debug\-level message \- lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zproc \- process configuration and status -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zproc\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zproc_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zproxy.3 b/external/zmq/share/man/man3/zproxy.3 deleted file mode 100644 index 037d3da6bb..0000000000 --- a/external/zmq/share/man/man3/zproxy.3 +++ /dev/null @@ -1,402 +0,0 @@ -'\" t -.\" Title: zproxy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPROXY" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zproxy \- run a steerable proxy in the background -.SH "SYNOPSIS" -.sp -.nf -// Create new zproxy actor instance\&. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance\&. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command\&. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type \-\- see zsock_type_str () \-\- and attach to -// endpoints, see zsock_attach ()\&. Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type \-\- see zsock_type_str () \-\- and attach to -// endpoints, see zsock_attach ()\&. Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy\&. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high\-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy\&. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_zap_domain ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_plain_server ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_curve_server () \-\- specifying both the public and -// secret keys of a certificate as Z85 armored strings \-\- see -// zcert_public_txt () and zcert_secret_txt ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproxy\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -A zproxy actor switches messages between a frontend and a backend socket\&. It acts much like the zmq_proxy_steerable method, though it makes benefit of CZMQ\(cqs facilities, to be somewhat simpler to set\-up\&. -.sp -This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zproxy_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create and configure our proxy -zactor_t *proxy = zactor_new (zproxy, NULL); -assert (proxy); -if (verbose) { - zstr_sendx (proxy, "VERBOSE", NULL); - zsock_wait (proxy); -} -zstr_sendx (proxy, "FRONTEND", "PULL", "inproc://frontend", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "BACKEND", "PUSH", "inproc://backend", NULL); -zsock_wait (proxy); - -// Connect application sockets to proxy -zsock_t *faucet = zsock_new_push (">inproc://frontend"); -assert (faucet); -zsock_t *sink = zsock_new_pull (">inproc://backend"); -assert (sink); - -// Send some messages and check they arrived -char *hello, *world; -zstr_sendx (faucet, "Hello", "World", NULL); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -// Test pause/resume functionality -zstr_sendx (proxy, "PAUSE", NULL); -zsock_wait (proxy); -zstr_sendx (faucet, "Hello", "World", NULL); -zsock_set_rcvtimeo (sink, 100); -zstr_recvx (sink, &hello, &world, NULL); -assert (!hello && !world); - -zstr_sendx (proxy, "RESUME", NULL); -zsock_wait (proxy); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -// Test capture functionality -zsock_t *capture = zsock_new_pull ("inproc://capture"); -assert (capture); - -// Switch on capturing, check that it works -zstr_sendx (proxy, "CAPTURE", "inproc://capture", NULL); -zsock_wait (proxy); -zstr_sendx (faucet, "Hello", "World", NULL); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -zstr_recvx (capture, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -zsock_destroy (&faucet); -zsock_destroy (&sink); -zsock_destroy (&capture); -zactor_destroy (&proxy); - -// Test socket creation dependency -proxy = zactor_new (zproxy, NULL); -assert (proxy); - -sink = zsock_new_sub (">ipc://backend", "whatever"); -assert (sink); - -zstr_sendx (proxy, "BACKEND", "XPUB", "ipc://backend", NULL); -zsock_wait (proxy); - -zsock_destroy(&sink); -zactor_destroy(&proxy); - -#if (ZMQ_VERSION_MAJOR == 4) -// Test authentication functionality -# define TESTDIR "\&.test_zproxy" - -// Create temporary directory for test files -zsys_dir_create (TESTDIR); - -char *frontend = NULL; -char *backend = NULL; - -// Check there\*(Aqs no authentication -s_create_test_sockets (&proxy, &faucet, &sink, verbose); -s_bind_test_sockets (proxy, &frontend, &backend); -bool success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Install the authenticator -zactor_t *auth = zactor_new (zauth, NULL); -assert (auth); -if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); -} - -// Check there\*(Aqs no authentication on a default NULL server -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// When we set a domain on the server, we switch on authentication -// for NULL sockets, but with no policies, the client connection -// will be allowed\&. -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Blacklist 127\&.0\&.0\&.1, connection should fail -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -// Whitelist our address, which overrides the blacklist -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "DOMAIN", "BACKEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Try PLAIN authentication - -// Test negative case (no server\-side passwords defined) -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Password"); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -// Test positive case (server\-side passwords defined) -FILE *password = fopen (TESTDIR "/password\-file", "w"); -assert (password); -fprintf (password, "admin=Password\en"); -fclose (password); -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Password"); -zsock_set_plain_username (sink, "admin"); -zsock_set_plain_password (sink, "Password"); -zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Test negative case (bad client password) -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Bogus"); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -if (zsys_has_curve ()) { - // We\*(Aqll create two new certificates and save the client public - // certificate on disk - zcert_t *server_cert = zcert_new (); - assert (server_cert); - zcert_t *client_cert = zcert_new (); - assert (client_cert); - const char *public_key = zcert_public_txt (server_cert); - const char *secret_key = zcert_secret_txt (server_cert); - - // Try CURVE authentication - - // Test without setting\-up any authentication - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (!success); - - // Test CURVE_ALLOW_ANY - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); - zsock_wait (auth); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (success); - - // Test with client certificate file in authentication folder - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - zstr_sendx (proxy, "CURVE", "BACKEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - zcert_apply (client_cert, sink); - zsock_set_curve_serverkey (sink, public_key); - zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); - zstr_sendx (auth, "CURVE", TESTDIR, NULL); - zsock_wait (auth); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (success); - - zcert_destroy (&server_cert); - zcert_destroy (&client_cert); -} - -// Remove the authenticator and check a normal connection works -zactor_destroy (&auth); -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Cleanup -zsock_destroy (&faucet); -zsock_destroy (&sink); -zactor_destroy (&proxy); -zstr_free (&frontend); -zstr_free (&backend); - -// Delete temporary directory and test files -zsys_file_delete (TESTDIR "/password\-file"); -zsys_file_delete (TESTDIR "/mycert\&.txt"); -zsys_dir_delete (TESTDIR); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zproxy_v2.3 b/external/zmq/share/man/man3/zproxy_v2.3 deleted file mode 100644 index b1f382457f..0000000000 --- a/external/zmq/share/man/man3/zproxy_v2.3 +++ /dev/null @@ -1,160 +0,0 @@ -'\" t -.\" Title: zproxy_v2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZPROXY_V2" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zproxy_v2 \- run a steerable proxy in the background (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// Constructor -// Create a new zproxy object\&. You must create the frontend and backend -// sockets, configure them, and connect or bind them, before you pass them -// to the constructor\&. Do NOT use the sockets again, after passing them to -// this method\&. -CZMQ_EXPORT zproxy_t * - zproxy_new (zctx_t *ctx, void *frontend, void *backend); - -// Destructor -// Destroy a zproxy object; note this first stops the proxy\&. -CZMQ_EXPORT void - zproxy_destroy (zproxy_t **self_p); - -// Copy all proxied messages to specified endpoint; if this is NULL, any -// in\-progress capturing will be stopped\&. You must already have bound the -// endpoint to a PULL socket\&. -CZMQ_EXPORT void - zproxy_capture (zproxy_t *self, const char *endpoint); - -// Pauses a zproxy object; a paused proxy will cease processing messages, -// causing them to be queued up and potentially hit the high\-water mark on -// the frontend socket, causing messages to be dropped, or writing -// applications to block\&. -CZMQ_EXPORT void - zproxy_pause (zproxy_t *self); - -// Resume a zproxy object -CZMQ_EXPORT void - zproxy_resume (zproxy_t *self); - -// Self test of this class -CZMQ_EXPORT void - zproxy_v2_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zproxy class provides an equivalent to the ZMQ steerable proxy, on all versions of ZeroMQ\&. -.sp -This class is deprecated in CZMQ v3; it works together with zctx, zsocket, and other deprecated V2 classes\&. New applications should use the V3 zproxy interface, based on zactor, together with the zsock class for sockets\&. -.SH "EXAMPLE" -.PP -\fBFrom zproxy_v2_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zctx_t *ctx = zctx_new (); -assert (ctx); -void *frontend = zsocket_new (ctx, ZMQ_PULL); -assert (frontend); -int rc = zsocket_bind (frontend, "inproc://frontend"); -assert (rc == 0); -void *backend = zsocket_new (ctx, ZMQ_PUSH); -assert (backend); -rc = zsocket_bind (backend, "inproc://backend"); -assert (rc == 0); -zproxy_t *proxy = zproxy_new (ctx, frontend, backend); -assert (proxy); - -// Connect application sockets to proxy -void *faucet = zsocket_new (ctx, ZMQ_PUSH); -assert (faucet); -rc = zsocket_connect (faucet, "inproc://frontend"); -assert (rc == 0); -void *sink = zsocket_new (ctx, ZMQ_PULL); -assert (sink); -rc = zsocket_connect (sink, "inproc://backend"); -assert (rc == 0); - -// Send some messages and check they arrived -zstr_send (faucet, "Hello"); -char *string = zstr_recv (sink); -assert (streq (string, "Hello")); -zstr_free (&string); - -// Check pause/resume functionality -zproxy_pause (proxy); -zstr_send (faucet, "World"); - -zproxy_resume (proxy); -string = zstr_recv (sink); -assert (streq (string, "World")); -zstr_free (&string); - -// Create capture socket, must be a PULL socket -void *capture = zsocket_new (ctx, ZMQ_PULL); -assert (capture); -rc = zsocket_bind (capture, "inproc://capture"); -assert (rc == 0); - -// Switch on capturing, check that it works -zproxy_capture (proxy, "inproc://capture"); -zstr_send (faucet, "Hello"); - -string = zstr_recv (sink); -assert (streq (string, "Hello")); -zstr_free (&string); - -string = zstr_recv (capture); -assert (streq (string, "Hello")); -zstr_free (&string); -zproxy_destroy (&proxy); -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zrex.3 b/external/zmq/share/man/man3/zrex.3 deleted file mode 100644 index 99c7337d40..0000000000 --- a/external/zmq/share/man/man3/zrex.3 +++ /dev/null @@ -1,199 +0,0 @@ -'\" t -.\" Title: zrex -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZREX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zrex \- work with regular expressions -.SH "SYNOPSIS" -.sp -.nf -// Constructor\&. Optionally, sets an expression against which we can match -// text and capture hits\&. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror()\&. If you -// set a pattern, you can call zrex_matches() to test it against text\&. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors\&. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression\&. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression\&. -// Use this method to compare one expression against many strings\&. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression\&. Use this -// method to compare one string against several expressions\&. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq\&. If the text -// matched, returns 1 plus the number of capture groups\&. If the text did -// not match, returns zero\&. To retrieve individual capture groups, call -// zrex_hit ()\&. -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits()\&. Capture group 0 is the -// whole matching string\&. Sequence 1 is the first capture group, if any, -// and so on\&. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index\&. Caller should not modify nor -// free the returned values\&. Returns number of strings returned\&. This -// method starts at hit 1, i\&.e\&. first capture group, as hit 0 is always -// the original matched string\&. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, \&.\&.\&.); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zrex\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Wraps a very simple regular expression library (SLRE) as a CZMQ class\&. Supports this syntax: -.sp -.if n \{\ -.RS 4 -.\} -.nf -^ Match beginning of a buffer -$ Match end of a buffer -() Grouping and substring capturing -[\&.\&.\&.] Match any character from set -[^\&.\&.\&.] Match any character but ones from set -\&. Match any character -\es Match whitespace -\eS Match non\-whitespace -\ed Match decimal digit -\eD Match non decimal digit -\ea Match alphabetic character -\eA Match non\-alphabetic character -\ew Match alphanumeric character -\eW Match non\-alphanumeric character -\er Match carriage return -\en Match newline -+ Match one or more times (greedy) -+? Match one or more times (non\-greedy) -* Match zero or more times (greedy) -*? Match zero or more times (non\-greedy) -? Match zero or once -\exDD Match byte with hex value 0xDD -\emeta Match one of the meta character: ^$()\&.[*+?\e -.fi -.if n \{\ -.RE -.\} -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zrex\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zrex_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// This shows the pattern of matching many lines to a single pattern -zrex_t *rex = zrex_new ("\e\ed+\-\e\ed+\-\e\ed+"); -assert (rex); -assert (zrex_valid (rex)); -bool matches = zrex_matches (rex, "123\-456\-789"); -assert (matches); -assert (zrex_hits (rex) == 1); -assert (streq (zrex_hit (rex, 0), "123\-456\-789")); -assert (zrex_hit (rex, 1) == NULL); -zrex_destroy (&rex); - -// Here we pick out hits using capture groups -rex = zrex_new ("(\e\ed+)\-(\e\ed+)\-(\e\ed+)"); -assert (rex); -assert (zrex_valid (rex)); -matches = zrex_matches (rex, "123\-456\-ABC"); -assert (!matches); -matches = zrex_matches (rex, "123\-456\-789"); -assert (matches); -assert (zrex_hits (rex) == 4); -assert (streq (zrex_hit (rex, 0), "123\-456\-789")); -assert (streq (zrex_hit (rex, 1), "123")); -assert (streq (zrex_hit (rex, 2), "456")); -assert (streq (zrex_hit (rex, 3), "789")); -zrex_destroy (&rex); - -// This shows the pattern of matching one line against many -// patterns and then handling the case when it hits -rex = zrex_new (NULL); // No initial pattern -assert (rex); -char *input = "Mechanism: CURVE"; -matches = zrex_eq (rex, input, "Version: (\&.+)"); -assert (!matches); -assert (zrex_hits (rex) == 0); -matches = zrex_eq (rex, input, "Mechanism: (\&.+)"); -assert (matches); -assert (zrex_hits (rex) == 2); -const char *mechanism; -zrex_fetch (rex, &mechanism, NULL); -assert (streq (zrex_hit (rex, 1), "CURVE")); -assert (streq (mechanism, "CURVE")); -zrex_destroy (&rex); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zsock.3 b/external/zmq/share/man/man3/zsock.3 deleted file mode 100644 index fc4a7e8b44..0000000000 --- a/external/zmq/share/man/man3/zsock.3 +++ /dev/null @@ -1,1469 +0,0 @@ -'\" t -.\" Title: zsock -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsock \- high\-level socket API that hides libzmq contexts and sockets -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new socket\&. Returns the new socket, or NULL if the new socket -// could not be created\&. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection\&. This can have -// performance implications if you use a LOT of sockets\&. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK\&. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string\&. Default -// action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket\&. You must use this for any socket created via the -// zsock_new method\&. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint\&. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*"\&. By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535)\&. -// To override this range, follow the "*" with "[first\-last]"\&. Either or -// both first and last may be empty\&. To bind to a random port within the -// range, use "!" in place of "*"\&. -// -// Examples: -// tcp://127\&.0\&.0\&.1:* bind to first free port from C000 up -// tcp://127\&.0\&.0\&.1:! bind to random port from C000 to FFFF -// tcp://127\&.0\&.0\&.1:*[60000\-] bind to first free port from 60000 up -// tcp://127\&.0\&.0\&.1:![\-60000] bind to random port from C000 to 60000 -// tcp://127\&.0\&.0\&.1:![55000\-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports\&. On failure, returns \-1\&. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware\&. Protocols that run on ephemeral ports should take -// this into account\&. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any\&. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint\&. -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid\&. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints\&. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// \*(Aq@\*(Aq (to bind the socket) or \*(Aq>\*(Aq (to connect the socket)\&. Returns 0 if all -// endpoints were valid, or \-1 if there was a syntax error\&. If the endpoint -// does not start with \*(Aq@\*(Aq or \*(Aq>\*(Aq, the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false)\&. -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string\&. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. The picture is a -// string that defines the type of each frame\&. This makes it easy to send -// a complex multiframe message in one call\&. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero\-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe\&. Does not change or take ownership of -// any arguments\&. Returns 0 if successful, \-1 if sending failed for any -// reason\&. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, \&.\&.\&.); - -// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details\&. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a \*(Aqpicture\*(Aq message to the socket (or actor)\&. See zsock_send for -// the format and meaning of the picture\&. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32\-bit unsigned integer) -// 8 = uint64_t * (stores 64\-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them\&. The supplied pointers do not need -// to be initialized\&. Returns 0 if successful, or \-1 if it failed to recv -// a message, in which case the pointers are not modified\&. When message -// frames are truncated (a short message), sets return values to zero/null\&. -// If an argument pointer is NULL, does not store any value (skips it)\&. -// An \*(Aqn\*(Aq picture matches an empty frame; if the message does not match, -// the method will return \-1\&. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, \&.\&.\&.); - -// Receive a \*(Aqpicture\*(Aq message from the socket (or actor)\&. This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details\&. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded \*(Aqpicture\*(Aq message to the socket (or actor)\&. This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations\&. The pattern argument is a string that defines the -// type of each argument\&. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0\-255 chars type = "string" -// S char *, 0\-2^32\-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments\&. Returns 0 if -// successful, \-1 if sending failed for any reason\&. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, \&.\&.\&.); - -// Receive a binary encoded \*(Aqpicture\*(Aq message from the socket (or actor)\&. -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations\&. The pattern argument is a string that defines -// the type of each argument\&. See zsock_bsend for the supported argument -// types\&. All arguments must be pointers; this call sets them to point to -// values held on a per\-socket basis\&. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them\&. The supplied pointers do not need -// to be initialized\&. Returns 0 if successful, or \-1 if it failed to read -// a message\&. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, \&.\&.\&.); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory\&. This method works -// across all versions of ZeroMQ\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket\&. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK)\&. Signals are encoded -// to be distinguishable from "normal" messages\&. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, \-1 if the signal could -// not be sent\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal\&. Use this to coordinate between threads, over pipe -// pairs\&. Blocks until the signal is received\&. Returns \-1 on error, 0 or -// greater on success\&. Accepts a zsock_t or a zactor_t as argument\&. -// Takes a polymorphic socket reference\&. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it\&. This is useful when reading partial messages, to get specific -// message types\&. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t\&. -// Takes a polymorphic socket reference\&. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference\&. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32\-octet binary -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class\&. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any\&. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it\&. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket\&. The socket MUST be of type ZMQ_SERVER\&. -// This will be used when sending messages on the socket via the zsock API\&. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. -// Returns 0 if OK, \-1 if failed\&. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. -// Returns 0 if OK, \-1 if failed\&. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsock\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zsock class wraps the libzmq socket handle (a void *) with a proper structure that follows the CLASS rules for construction and destruction\&. Some zsock methods take a void * "polymorphic" reference, which can be either a zsock_t or a zactor_t reference, or a libzmq void *\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsock\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zsock_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsock_t *writer = zsock_new_push ("@tcp://127\&.0\&.0\&.1:5560"); -assert (writer); -assert (zsock_resolve (writer) != writer); -assert (streq (zsock_type_str (writer), "PUSH")); - -int rc; -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) -// Check unbind -rc = zsock_unbind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); -assert (rc == 0); - -// In some cases and especially when running under Valgrind, doing -// a bind immediately after an unbind causes an EADDRINUSE error\&. -// Even a short sleep allows the OS to release the port for reuse\&. -zclock_sleep (100); - -// Bind again -rc = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); -assert (rc == 5560); -assert (streq (zsock_endpoint (writer), "tcp://127\&.0\&.0\&.1:5560")); -#endif - -zsock_t *reader = zsock_new_pull (">tcp://127\&.0\&.0\&.1:5560"); -assert (reader); -assert (zsock_resolve (reader) != reader); -assert (streq (zsock_type_str (reader), "PULL")); - -// Basic Hello, World -zstr_send (writer, "Hello, World"); -zmsg_t *msg = zmsg_recv (reader); -assert (msg); -char *string = zmsg_popstr (msg); -assert (streq (string, "Hello, World")); -free (string); -zmsg_destroy (&msg); - -// Test resolve libzmq socket -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) -void *zmq_ctx = zmq_ctx_new (); -#else -void *zmq_ctx = zmq_ctx_new (1); -#endif -assert (zmq_ctx); -void *zmq_sock = zmq_socket (zmq_ctx, ZMQ_PUB); -assert (zmq_sock); -assert (zsock_resolve (zmq_sock) == zmq_sock); -zmq_close (zmq_sock); -zmq_ctx_term (zmq_ctx); - -// Test resolve zsock -zsock_t *resolve = zsock_new_pub("@tcp://127\&.0\&.0\&.1:5561"); -assert (resolve); -assert (zsock_resolve (resolve) == resolve\->handle); -zsock_destroy (&resolve); - -// Test resolve FD -SOCKET fd = zsock_fd (reader); -assert (zsock_resolve ((void *) &fd) == NULL); - -// Test binding to ephemeral ports, sequential and random -int port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*"); -assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[50000\-]"); -assert (port >= 50000 && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[\-50001]"); -assert (port >= DYNAMIC_FIRST && port <= 50001); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[60000\-60050]"); -assert (port >= 60000 && port <= 60050); - -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:!"); -assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![50000\-]"); -assert (port >= 50000 && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![\-50001]"); -assert (port >= DYNAMIC_FIRST && port <= 50001); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![60000\-60050]"); -assert (port >= 60000 && port <= 60050); - -// Test zsock_attach method -zsock_t *server = zsock_new (ZMQ_DEALER); -assert (server); -rc = zsock_attach (server, "@inproc://myendpoint,tcp://127\&.0\&.0\&.1:5556,inproc://others", true); -assert (rc == 0); -rc = zsock_attach (server, "", false); -assert (rc == 0); -rc = zsock_attach (server, NULL, true); -assert (rc == 0); -rc = zsock_attach (server, ">a,@b, c,, ", false); -assert (rc == \-1); -zsock_destroy (&server); - -// Test zsock_endpoint method -rc = zsock_bind (writer, "inproc://test\&.%s", "writer"); -assert (rc == 0); -assert (streq (zsock_endpoint (writer), "inproc://test\&.writer")); - -// Test error state when connecting to an invalid socket type -// (\*(Aqtxp://\*(Aq instead of \*(Aqtcp://\*(Aq, typo intentional) -rc = zsock_connect (reader, "txp://127\&.0\&.0\&.1:5560"); -assert (rc == \-1); - -// Test signal/wait methods -rc = zsock_signal (writer, 123); -assert (rc == 0); -rc = zsock_wait (reader); -assert (rc == 123); - -// Test zsock_send/recv pictures -uint8_t number1 = 123; -uint16_t number2 = 123 * 123; -uint32_t number4 = 123 * 123; -number4 *= 123; -uint32_t number4_MAX = UINT32_MAX; -uint64_t number8 = 123 * 123; -number8 *= 123; -number8 *= 123; -uint64_t number8_MAX = UINT64_MAX; - -zchunk_t *chunk = zchunk_new ("HELLO", 5); -assert (chunk); -zframe_t *frame = zframe_new ("WORLD", 5); -assert (frame); -zhashx_t *hash = zhashx_new (); -assert (hash); -zuuid_t *uuid = zuuid_new (); -assert (uuid); -zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); -zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); -zhashx_insert (hash, "1", "value A"); -zhashx_insert (hash, "2", "value B"); -char *original = "pointer"; - -// Test zsock_recv into each supported type -zsock_send (writer, "i124488zsbcfUhp", - \-12345, number1, number2, number4, number4_MAX, - number8, number8_MAX, - "This is a string", "ABCDE", 5, - chunk, frame, uuid, hash, original); -char *uuid_str = strdup (zuuid_str (uuid)); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zuuid_destroy (&uuid); -zhashx_destroy (&hash); - -int integer; -byte *data; -size_t size; -char *pointer; -number8_MAX = number8 = number4_MAX = number4 = number2 = number1 = 0ULL; -rc = zsock_recv (reader, "i124488zsbcfUhp", - &integer, &number1, &number2, &number4, &number4_MAX, - &number8, &number8_MAX, &string, &data, &size, &chunk, - &frame, &uuid, &hash, &pointer); -assert (rc == 0); -assert (integer == \-12345); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number4_MAX == UINT32_MAX); -assert (number8 == 123 * 123 * 123 * 123); -assert (number8_MAX == UINT64_MAX); -assert (streq (string, "This is a string")); -assert (memcmp (data, "ABCDE", 5) == 0); -assert (size == 5); -assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); -assert (zchunk_size (chunk) == 5); -assert (streq (uuid_str, zuuid_str (uuid))); -assert (memcmp (zframe_data (frame), "WORLD", 5) == 0); -assert (zframe_size (frame) == 5); -char *value = (char *) zhashx_lookup (hash, "1"); -assert (streq (value, "value A")); -value = (char *) zhashx_lookup (hash, "2"); -assert (streq (value, "value B")); -assert (original == pointer); -free (string); -free (data); -free (uuid_str); -zframe_destroy (&frame); -zchunk_destroy (&chunk); -zhashx_destroy (&hash); -zuuid_destroy (&uuid); - -// Test zsock_recv of short message; this lets us return a failure -// with a status code and then nothing else; the receiver will get -// the status code and NULL/zero for all other values -zsock_send (writer, "i", \-1); -zsock_recv (reader, "izsbcfp", - &integer, &string, &data, &size, &chunk, &frame, &pointer); -assert (integer == \-1); -assert (string == NULL); -assert (data == NULL); -assert (size == 0); -assert (chunk == NULL); -assert (frame == NULL); -assert (pointer == NULL); - -msg = zmsg_new (); -zmsg_addstr (msg, "frame 1"); -zmsg_addstr (msg, "frame 2"); -zsock_send (writer, "szm", "header", msg); -zmsg_destroy (&msg); - -zsock_recv (reader, "szm", &string, &msg); - -assert (streq ("header", string)); -assert (zmsg_size (msg) == 2); -assert (zframe_streq (zmsg_first (msg), "frame 1")); -assert (zframe_streq (zmsg_next (msg), "frame 2")); -zstr_free (&string); -zmsg_destroy (&msg); - -// Test zsock_recv with null arguments -chunk = zchunk_new ("HELLO", 5); -assert (chunk); -frame = zframe_new ("WORLD", 5); -assert (frame); -zsock_send (writer, "izsbcfp", - \-12345, "This is a string", "ABCDE", 5, chunk, frame, original); -zframe_destroy (&frame); -zchunk_destroy (&chunk); -zsock_recv (reader, "izsbcfp", &integer, NULL, NULL, NULL, &chunk, NULL, NULL); -assert (integer == \-12345); -assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); -assert (zchunk_size (chunk) == 5); -zchunk_destroy (&chunk); - -// Test zsock_bsend/brecv pictures with binary encoding -frame = zframe_new ("Hello", 5); -chunk = zchunk_new ("World", 5); - -msg = zmsg_new (); -zmsg_addstr (msg, "Hello"); -zmsg_addstr (msg, "World"); - -zsock_bsend (writer, "1248sSpcfm", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk, frame, msg); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zmsg_destroy (&msg); - -number8 = number4 = number2 = number1 = 0; -char *longstr; -zsock_brecv (reader, "1248sSpcfm", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk, &frame, &msg); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -zstr_free (&longstr); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zmsg_destroy (&msg); - -#ifdef ZMQ_SERVER - -// Test zsock_bsend/brecv pictures with binary encoding on SERVER and CLIENT sockets -server = zsock_new_server ("tcp://127\&.0\&.0\&.1:5561"); -assert (server); -zsock_t* client = zsock_new_client ("tcp://127\&.0\&.0\&.1:5561"); -assert (client); - -// From client to server -chunk = zchunk_new ("World", 5); -zsock_bsend (client, "1248sSpc", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk); -zchunk_destroy (&chunk); - -number8 = number4 = number2 = number1 = 0; -zsock_brecv (server, "1248sSpc", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -assert (zsock_routing_id (server)); -zstr_free (&longstr); -zchunk_destroy (&chunk); - -// From server to client -chunk = zchunk_new ("World", 5); -zsock_bsend (server, "1248sSpc", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk); -zchunk_destroy (&chunk); - -number8 = number4 = number2 = number1 = 0; -zsock_brecv (client, "1248sSpc", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -assert (zsock_routing_id (client) == 0); -zstr_free (&longstr); -zchunk_destroy (&chunk); - -zsock_destroy (&client); -zsock_destroy (&server); - -#endif - -#ifdef ZMQ_SCATTER - -zsock_t* gather = zsock_new_gather ("inproc://test\-gather\-scatter"); -assert (gather); -zsock_t* scatter = zsock_new_scatter ("inproc://test\-gather\-scatter"); -assert (scatter); - -rc = zstr_send (scatter, "HELLO"); -assert (rc == 0); - -char* message; -message = zstr_recv (gather); -assert (streq(message, "HELLO")); -zstr_free (&message); - -zsock_destroy (&gather); -zsock_destroy (&scatter); - -#endif - -// Check that we can send a zproto format message -zsock_bsend (writer, "1111sS4", 0xAA, 0xA0, 0x02, 0x01, "key", "value", 1234); -zgossip_msg_t *gossip = zgossip_msg_new (); -zgossip_msg_recv (gossip, reader); -assert (zgossip_msg_id (gossip) == ZGOSSIP_MSG_PUBLISH); -zgossip_msg_destroy (&gossip); - -zsock_destroy (&reader); -zsock_destroy (&writer); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zsock_option.3 b/external/zmq/share/man/man3/zsock_option.3 deleted file mode 100644 index ea5d7e89be..0000000000 --- a/external/zmq/share/man/man3/zsock_option.3 +++ /dev/null @@ -1,1043 +0,0 @@ -'\" t -.\" Title: zsock_option -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZSOCK_OPTION" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsock_option \- get/set 0MQ socket options -.SH "SYNOPSIS" -.sp -.nf -#if (ZMQ_VERSION_MAJOR == 4) -// Get socket options -CZMQ_EXPORT int zsock_tos (void *self); -CZMQ_EXPORT char * zsock_zap_domain (void *self); -CZMQ_EXPORT int zsock_mechanism (void *self); -CZMQ_EXPORT int zsock_plain_server (void *self); -CZMQ_EXPORT char * zsock_plain_username (void *self); -CZMQ_EXPORT char * zsock_plain_password (void *self); -CZMQ_EXPORT int zsock_curve_server (void *self); -CZMQ_EXPORT char * zsock_curve_publickey (void *self); -CZMQ_EXPORT char * zsock_curve_secretkey (void *self); -CZMQ_EXPORT char * zsock_curve_serverkey (void *self); -CZMQ_EXPORT int zsock_gssapi_server (void *self); -CZMQ_EXPORT int zsock_gssapi_plaintext (void *self); -CZMQ_EXPORT char * zsock_gssapi_principal (void *self); -CZMQ_EXPORT char * zsock_gssapi_service_principal (void *self); -CZMQ_EXPORT int zsock_ipv6 (void *self); -CZMQ_EXPORT int zsock_immediate (void *self); -CZMQ_EXPORT int zsock_ipv4only (void *self); -CZMQ_EXPORT int zsock_type (void *self); -CZMQ_EXPORT int zsock_sndhwm (void *self); -CZMQ_EXPORT int zsock_rcvhwm (void *self); -CZMQ_EXPORT int zsock_affinity (void *self); -CZMQ_EXPORT char * zsock_identity (void *self); -CZMQ_EXPORT int zsock_rate (void *self); -CZMQ_EXPORT int zsock_recovery_ivl (void *self); -CZMQ_EXPORT int zsock_sndbuf (void *self); -CZMQ_EXPORT int zsock_rcvbuf (void *self); -CZMQ_EXPORT int zsock_linger (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl_max (void *self); -CZMQ_EXPORT int zsock_backlog (void *self); -CZMQ_EXPORT int zsock_maxmsgsize (void *self); -CZMQ_EXPORT int zsock_multicast_hops (void *self); -CZMQ_EXPORT int zsock_rcvtimeo (void *self); -CZMQ_EXPORT int zsock_sndtimeo (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_idle (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_cnt (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_intvl (void *self); -CZMQ_EXPORT char * zsock_tcp_accept_filter (void *self); -CZMQ_EXPORT int zsock_rcvmore (void *self); -CZMQ_EXPORT SOCKET zsock_fd (void *self); -CZMQ_EXPORT int zsock_events (void *self); -CZMQ_EXPORT char * zsock_last_endpoint (void *self); - -// Set socket options -CZMQ_EXPORT void zsock_set_tos (void *self, int tos); -CZMQ_EXPORT void zsock_set_router_handover (void *self, int router_handover); -CZMQ_EXPORT void zsock_set_router_mandatory (void *self, int router_mandatory); -CZMQ_EXPORT void zsock_set_probe_router (void *self, int probe_router); -CZMQ_EXPORT void zsock_set_req_relaxed (void *self, int req_relaxed); -CZMQ_EXPORT void zsock_set_req_correlate (void *self, int req_correlate); -CZMQ_EXPORT void zsock_set_conflate (void *self, int conflate); -CZMQ_EXPORT void zsock_set_zap_domain (void *self, const char * zap_domain); -CZMQ_EXPORT void zsock_set_plain_server (void *self, int plain_server); -CZMQ_EXPORT void zsock_set_plain_username (void *self, const char * plain_username); -CZMQ_EXPORT void zsock_set_plain_password (void *self, const char * plain_password); -CZMQ_EXPORT void zsock_set_curve_server (void *self, int curve_server); -CZMQ_EXPORT void zsock_set_curve_publickey (void *self, const char * curve_publickey); -CZMQ_EXPORT void zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); -CZMQ_EXPORT void zsock_set_curve_secretkey (void *self, const char * curve_secretkey); -CZMQ_EXPORT void zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); -CZMQ_EXPORT void zsock_set_curve_serverkey (void *self, const char * curve_serverkey); -CZMQ_EXPORT void zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); -CZMQ_EXPORT void zsock_set_gssapi_server (void *self, int gssapi_server); -CZMQ_EXPORT void zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); -CZMQ_EXPORT void zsock_set_gssapi_principal (void *self, const char * gssapi_principal); -CZMQ_EXPORT void zsock_set_gssapi_service_principal (void *self, const char * gssapi_service_principal); -CZMQ_EXPORT void zsock_set_ipv6 (void *self, int ipv6); -CZMQ_EXPORT void zsock_set_immediate (void *self, int immediate); -CZMQ_EXPORT void zsock_set_router_raw (void *self, int router_raw); -CZMQ_EXPORT void zsock_set_ipv4only (void *self, int ipv4only); -CZMQ_EXPORT void zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); -CZMQ_EXPORT void zsock_set_sndhwm (void *self, int sndhwm); -CZMQ_EXPORT void zsock_set_rcvhwm (void *self, int rcvhwm); -CZMQ_EXPORT void zsock_set_affinity (void *self, int affinity); -CZMQ_EXPORT void zsock_set_subscribe (void *self, const char * subscribe); -CZMQ_EXPORT void zsock_set_unsubscribe (void *self, const char * unsubscribe); -CZMQ_EXPORT void zsock_set_identity (void *self, const char * identity); -CZMQ_EXPORT void zsock_set_rate (void *self, int rate); -CZMQ_EXPORT void zsock_set_recovery_ivl (void *self, int recovery_ivl); -CZMQ_EXPORT void zsock_set_sndbuf (void *self, int sndbuf); -CZMQ_EXPORT void zsock_set_rcvbuf (void *self, int rcvbuf); -CZMQ_EXPORT void zsock_set_linger (void *self, int linger); -CZMQ_EXPORT void zsock_set_reconnect_ivl (void *self, int reconnect_ivl); -CZMQ_EXPORT void zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); -CZMQ_EXPORT void zsock_set_backlog (void *self, int backlog); -CZMQ_EXPORT void zsock_set_maxmsgsize (void *self, int maxmsgsize); -CZMQ_EXPORT void zsock_set_multicast_hops (void *self, int multicast_hops); -CZMQ_EXPORT void zsock_set_rcvtimeo (void *self, int rcvtimeo); -CZMQ_EXPORT void zsock_set_sndtimeo (void *self, int sndtimeo); -CZMQ_EXPORT void zsock_set_xpub_verbose (void *self, int xpub_verbose); -CZMQ_EXPORT void zsock_set_tcp_keepalive (void *self, int tcp_keepalive); -CZMQ_EXPORT void zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); -CZMQ_EXPORT void zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -// Get socket options -CZMQ_EXPORT int zsock_ipv4only (void *self); -CZMQ_EXPORT int zsock_type (void *self); -CZMQ_EXPORT int zsock_sndhwm (void *self); -CZMQ_EXPORT int zsock_rcvhwm (void *self); -CZMQ_EXPORT int zsock_affinity (void *self); -CZMQ_EXPORT char * zsock_identity (void *self); -CZMQ_EXPORT int zsock_rate (void *self); -CZMQ_EXPORT int zsock_recovery_ivl (void *self); -CZMQ_EXPORT int zsock_sndbuf (void *self); -CZMQ_EXPORT int zsock_rcvbuf (void *self); -CZMQ_EXPORT int zsock_linger (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl_max (void *self); -CZMQ_EXPORT int zsock_backlog (void *self); -CZMQ_EXPORT int zsock_maxmsgsize (void *self); -CZMQ_EXPORT int zsock_multicast_hops (void *self); -CZMQ_EXPORT int zsock_rcvtimeo (void *self); -CZMQ_EXPORT int zsock_sndtimeo (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_idle (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_cnt (void *self); -CZMQ_EXPORT int zsock_tcp_keepalive_intvl (void *self); -CZMQ_EXPORT char * zsock_tcp_accept_filter (void *self); -CZMQ_EXPORT int zsock_rcvmore (void *self); -CZMQ_EXPORT SOCKET zsock_fd (void *self); -CZMQ_EXPORT int zsock_events (void *self); -CZMQ_EXPORT char * zsock_last_endpoint (void *self); - -// Set socket options -CZMQ_EXPORT void zsock_set_router_raw (void *self, int router_raw); -CZMQ_EXPORT void zsock_set_ipv4only (void *self, int ipv4only); -CZMQ_EXPORT void zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); -CZMQ_EXPORT void zsock_set_sndhwm (void *self, int sndhwm); -CZMQ_EXPORT void zsock_set_rcvhwm (void *self, int rcvhwm); -CZMQ_EXPORT void zsock_set_affinity (void *self, int affinity); -CZMQ_EXPORT void zsock_set_subscribe (void *self, const char * subscribe); -CZMQ_EXPORT void zsock_set_unsubscribe (void *self, const char * unsubscribe); -CZMQ_EXPORT void zsock_set_identity (void *self, const char * identity); -CZMQ_EXPORT void zsock_set_rate (void *self, int rate); -CZMQ_EXPORT void zsock_set_recovery_ivl (void *self, int recovery_ivl); -CZMQ_EXPORT void zsock_set_sndbuf (void *self, int sndbuf); -CZMQ_EXPORT void zsock_set_rcvbuf (void *self, int rcvbuf); -CZMQ_EXPORT void zsock_set_linger (void *self, int linger); -CZMQ_EXPORT void zsock_set_reconnect_ivl (void *self, int reconnect_ivl); -CZMQ_EXPORT void zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); -CZMQ_EXPORT void zsock_set_backlog (void *self, int backlog); -CZMQ_EXPORT void zsock_set_maxmsgsize (void *self, int maxmsgsize); -CZMQ_EXPORT void zsock_set_multicast_hops (void *self, int multicast_hops); -CZMQ_EXPORT void zsock_set_rcvtimeo (void *self, int rcvtimeo); -CZMQ_EXPORT void zsock_set_sndtimeo (void *self, int sndtimeo); -CZMQ_EXPORT void zsock_set_xpub_verbose (void *self, int xpub_verbose); -CZMQ_EXPORT void zsock_set_tcp_keepalive (void *self, int tcp_keepalive); -CZMQ_EXPORT void zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); -CZMQ_EXPORT void zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -// Get socket options -CZMQ_EXPORT int zsock_hwm (void *self); -CZMQ_EXPORT int zsock_swap (void *self); -CZMQ_EXPORT int zsock_affinity (void *self); -CZMQ_EXPORT char * zsock_identity (void *self); -CZMQ_EXPORT int zsock_rate (void *self); -CZMQ_EXPORT int zsock_recovery_ivl (void *self); -CZMQ_EXPORT int zsock_recovery_ivl_msec (void *self); -CZMQ_EXPORT int zsock_mcast_loop (void *self); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsock_rcvtimeo (void *self); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsock_sndtimeo (void *self); -# endif -CZMQ_EXPORT int zsock_sndbuf (void *self); -CZMQ_EXPORT int zsock_rcvbuf (void *self); -CZMQ_EXPORT int zsock_linger (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl (void *self); -CZMQ_EXPORT int zsock_reconnect_ivl_max (void *self); -CZMQ_EXPORT int zsock_backlog (void *self); -CZMQ_EXPORT int zsock_type (void *self); -CZMQ_EXPORT int zsock_rcvmore (void *self); -CZMQ_EXPORT SOCKET zsock_fd (void *self); -CZMQ_EXPORT int zsock_events (void *self); - -// Set socket options -CZMQ_EXPORT void zsock_set_hwm (void *self, int hwm); -CZMQ_EXPORT void zsock_set_swap (void *self, int swap); -CZMQ_EXPORT void zsock_set_affinity (void *self, int affinity); -CZMQ_EXPORT void zsock_set_identity (void *self, const char * identity); -CZMQ_EXPORT void zsock_set_rate (void *self, int rate); -CZMQ_EXPORT void zsock_set_recovery_ivl (void *self, int recovery_ivl); -CZMQ_EXPORT void zsock_set_recovery_ivl_msec (void *self, int recovery_ivl_msec); -CZMQ_EXPORT void zsock_set_mcast_loop (void *self, int mcast_loop); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsock_set_rcvtimeo (void *self, int rcvtimeo); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsock_set_sndtimeo (void *self, int sndtimeo); -# endif -CZMQ_EXPORT void zsock_set_sndbuf (void *self, int sndbuf); -CZMQ_EXPORT void zsock_set_rcvbuf (void *self, int rcvbuf); -CZMQ_EXPORT void zsock_set_linger (void *self, int linger); -CZMQ_EXPORT void zsock_set_reconnect_ivl (void *self, int reconnect_ivl); -CZMQ_EXPORT void zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); -CZMQ_EXPORT void zsock_set_backlog (void *self, int backlog); -CZMQ_EXPORT void zsock_set_subscribe (void *self, const char * subscribe); -CZMQ_EXPORT void zsock_set_unsubscribe (void *self, const char * unsubscribe); -#endif - -// Self test of this class -CZMQ_EXPORT void zsock_option_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zsock_option class provides access to the 0MQ getsockopt/setsockopt API\&. All methods in this class take a void * "polymorphic" reference, which can be either a zsock_t or a zactor_r reference, or a libzmq void *\&. -.sp -This class is generated, using the GSL code generator\&. See the sockopts XML file, which provides the metadata, and the sock_option\&.gsl template, which does the work\&. -.SH "EXAMPLE" -.PP -\fBFrom zsock_option_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsock_t *self; -#if (ZMQ_VERSION_MAJOR == 4) -# if defined (ZMQ_TOS) -self = zsock_new (ZMQ_DEALER); -assert (self); -zsock_set_tos (self, 1); -assert (zsock_tos (self) == 1); -zsock_tos (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_ROUTER_HANDOVER) -self = zsock_new (ZMQ_ROUTER); -assert (self); -zsock_set_router_handover (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_ROUTER_MANDATORY) -self = zsock_new (ZMQ_ROUTER); -assert (self); -zsock_set_router_mandatory (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_PROBE_ROUTER) -self = zsock_new (ZMQ_DEALER); -assert (self); -zsock_set_probe_router (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_REQ_RELAXED) -self = zsock_new (ZMQ_REQ); -assert (self); -zsock_set_req_relaxed (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_REQ_CORRELATE) -self = zsock_new (ZMQ_REQ); -assert (self); -zsock_set_req_correlate (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_CONFLATE) -self = zsock_new (ZMQ_PUSH); -assert (self); -zsock_set_conflate (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_ZAP_DOMAIN) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_zap_domain (self, "test"); -char *zap_domain = zsock_zap_domain (self); -assert (zap_domain); -free (zap_domain); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MECHANISM) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_mechanism (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_PLAIN_SERVER) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_plain_server (self, 1); -assert (zsock_plain_server (self) == 1); -zsock_plain_server (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_PLAIN_USERNAME) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_plain_username (self, "test"); -char *plain_username = zsock_plain_username (self); -assert (plain_username); -free (plain_username); -zsock_destroy (&self); -# endif -# if defined (ZMQ_PLAIN_PASSWORD) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_plain_password (self, "test"); -char *plain_password = zsock_plain_password (self); -assert (plain_password); -free (plain_password); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IPV6) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_ipv6 (self, 1); -assert (zsock_ipv6 (self) == 1); -zsock_ipv6 (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IMMEDIATE) -self = zsock_new (ZMQ_DEALER); -assert (self); -zsock_set_immediate (self, 1); -assert (zsock_immediate (self) == 1); -zsock_immediate (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_ROUTER_RAW) -self = zsock_new (ZMQ_ROUTER); -assert (self); -zsock_set_router_raw (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IPV4ONLY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_ipv4only (self, 1); -assert (zsock_ipv4only (self) == 1); -zsock_ipv4only (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_DELAY_ATTACH_ON_CONNECT) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_delay_attach_on_connect (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TYPE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_type (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDHWM) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_sndhwm (self, 1); -assert (zsock_sndhwm (self) == 1); -zsock_sndhwm (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVHWM) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvhwm (self, 1); -assert (zsock_rcvhwm (self) == 1); -zsock_rcvhwm (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_AFFINITY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_affinity (self, 1); -assert (zsock_affinity (self) == 1); -zsock_affinity (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_subscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_unsubscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IDENTITY) -self = zsock_new (ZMQ_DEALER); -assert (self); -zsock_set_identity (self, "test"); -char *identity = zsock_identity (self); -assert (identity); -free (identity); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RATE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rate (self, 1); -assert (zsock_rate (self) == 1); -zsock_rate (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECOVERY_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_recovery_ivl (self, 1); -assert (zsock_recovery_ivl (self) == 1); -zsock_recovery_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDBUF) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_sndbuf (self, 1); -assert (zsock_sndbuf (self) == 1); -zsock_sndbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVBUF) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvbuf (self, 1); -assert (zsock_rcvbuf (self) == 1); -zsock_rcvbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_LINGER) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_linger (self, 1); -assert (zsock_linger (self) == 1); -zsock_linger (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl (self, 1); -assert (zsock_reconnect_ivl (self) == 1); -zsock_reconnect_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl_max (self, 1); -assert (zsock_reconnect_ivl_max (self) == 1); -zsock_reconnect_ivl_max (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_BACKLOG) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_backlog (self, 1); -assert (zsock_backlog (self) == 1); -zsock_backlog (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MAXMSGSIZE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_maxmsgsize (self, 1); -assert (zsock_maxmsgsize (self) == 1); -zsock_maxmsgsize (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MULTICAST_HOPS) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_multicast_hops (self, 1); -assert (zsock_multicast_hops (self) == 1); -zsock_multicast_hops (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvtimeo (self, 1); -assert (zsock_rcvtimeo (self) == 1); -zsock_rcvtimeo (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_sndtimeo (self, 1); -assert (zsock_sndtimeo (self) == 1); -zsock_sndtimeo (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_XPUB_VERBOSE) -self = zsock_new (ZMQ_XPUB); -assert (self); -zsock_set_xpub_verbose (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive (self, 1); -assert (zsock_tcp_keepalive (self) == 1); -zsock_tcp_keepalive (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_IDLE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_idle (self, 1); -assert (zsock_tcp_keepalive_idle (self) == 1); -zsock_tcp_keepalive_idle (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_CNT) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_cnt (self, 1); -assert (zsock_tcp_keepalive_cnt (self) == 1); -zsock_tcp_keepalive_cnt (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_INTVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_intvl (self, 1); -assert (zsock_tcp_keepalive_intvl (self) == 1); -zsock_tcp_keepalive_intvl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_ACCEPT_FILTER) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_accept_filter (self, "127\&.0\&.0\&.1"); -char *tcp_accept_filter = zsock_tcp_accept_filter (self); -assert (tcp_accept_filter); -free (tcp_accept_filter); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVMORE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_rcvmore (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_FD) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_fd (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_EVENTS) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_events (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_LAST_ENDPOINT) -self = zsock_new (ZMQ_SUB); -assert (self); -char *last_endpoint = zsock_last_endpoint (self); -assert (last_endpoint); -free (last_endpoint); -zsock_destroy (&self); -# endif -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -# if defined (ZMQ_ROUTER_RAW) -self = zsock_new (ZMQ_ROUTER); -assert (self); -zsock_set_router_raw (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IPV4ONLY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_ipv4only (self, 1); -assert (zsock_ipv4only (self) == 1); -zsock_ipv4only (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_DELAY_ATTACH_ON_CONNECT) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_delay_attach_on_connect (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TYPE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_type (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDHWM) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_sndhwm (self, 1); -assert (zsock_sndhwm (self) == 1); -zsock_sndhwm (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVHWM) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvhwm (self, 1); -assert (zsock_rcvhwm (self) == 1); -zsock_rcvhwm (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_AFFINITY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_affinity (self, 1); -assert (zsock_affinity (self) == 1); -zsock_affinity (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_subscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_unsubscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IDENTITY) -self = zsock_new (ZMQ_DEALER); -assert (self); -zsock_set_identity (self, "test"); -char *identity = zsock_identity (self); -assert (identity); -free (identity); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RATE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rate (self, 1); -assert (zsock_rate (self) == 1); -zsock_rate (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECOVERY_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_recovery_ivl (self, 1); -assert (zsock_recovery_ivl (self) == 1); -zsock_recovery_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDBUF) -self = zsock_new (ZMQ_PUB); -assert (self); -zsock_set_sndbuf (self, 1); -assert (zsock_sndbuf (self) == 1); -zsock_sndbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVBUF) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvbuf (self, 1); -assert (zsock_rcvbuf (self) == 1); -zsock_rcvbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_LINGER) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_linger (self, 1); -assert (zsock_linger (self) == 1); -zsock_linger (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl (self, 1); -assert (zsock_reconnect_ivl (self) == 1); -zsock_reconnect_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl_max (self, 1); -assert (zsock_reconnect_ivl_max (self) == 1); -zsock_reconnect_ivl_max (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_BACKLOG) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_backlog (self, 1); -assert (zsock_backlog (self) == 1); -zsock_backlog (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MAXMSGSIZE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_maxmsgsize (self, 1); -assert (zsock_maxmsgsize (self) == 1); -zsock_maxmsgsize (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MULTICAST_HOPS) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_multicast_hops (self, 1); -assert (zsock_multicast_hops (self) == 1); -zsock_multicast_hops (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvtimeo (self, 1); -assert (zsock_rcvtimeo (self) == 1); -zsock_rcvtimeo (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SNDTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_sndtimeo (self, 1); -assert (zsock_sndtimeo (self) == 1); -zsock_sndtimeo (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_XPUB_VERBOSE) -self = zsock_new (ZMQ_XPUB); -assert (self); -zsock_set_xpub_verbose (self, 1); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive (self, 1); -assert (zsock_tcp_keepalive (self) == 1); -zsock_tcp_keepalive (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_IDLE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_idle (self, 1); -assert (zsock_tcp_keepalive_idle (self) == 1); -zsock_tcp_keepalive_idle (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_CNT) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_cnt (self, 1); -assert (zsock_tcp_keepalive_cnt (self) == 1); -zsock_tcp_keepalive_cnt (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_INTVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_keepalive_intvl (self, 1); -assert (zsock_tcp_keepalive_intvl (self) == 1); -zsock_tcp_keepalive_intvl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TCP_ACCEPT_FILTER) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_tcp_accept_filter (self, "127\&.0\&.0\&.1"); -char *tcp_accept_filter = zsock_tcp_accept_filter (self); -assert (tcp_accept_filter); -free (tcp_accept_filter); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVMORE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_rcvmore (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_FD) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_fd (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_EVENTS) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_events (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_LAST_ENDPOINT) -self = zsock_new (ZMQ_SUB); -assert (self); -char *last_endpoint = zsock_last_endpoint (self); -assert (last_endpoint); -free (last_endpoint); -zsock_destroy (&self); -# endif -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -# if defined (ZMQ_HWM) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_hwm (self, 1); -assert (zsock_hwm (self) == 1); -zsock_hwm (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SWAP) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_swap (self, 1); -assert (zsock_swap (self) == 1); -zsock_swap (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_AFFINITY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_affinity (self, 1); -assert (zsock_affinity (self) == 1); -zsock_affinity (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_IDENTITY) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_identity (self, "test"); -char *identity = zsock_identity (self); -assert (identity); -free (identity); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RATE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rate (self, 1); -assert (zsock_rate (self) == 1); -zsock_rate (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECOVERY_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_recovery_ivl (self, 1); -assert (zsock_recovery_ivl (self) == 1); -zsock_recovery_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECOVERY_IVL_MSEC) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_recovery_ivl_msec (self, 1); -assert (zsock_recovery_ivl_msec (self) == 1); -zsock_recovery_ivl_msec (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_MCAST_LOOP) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_mcast_loop (self, 1); -assert (zsock_mcast_loop (self) == 1); -zsock_mcast_loop (self); -zsock_destroy (&self); -# endif -# if (ZMQ_VERSION_MINOR == 2) -# if defined (ZMQ_RCVTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvtimeo (self, 1); -assert (zsock_rcvtimeo (self) == 1); -zsock_rcvtimeo (self); -zsock_destroy (&self); -# endif -# endif -# if (ZMQ_VERSION_MINOR == 2) -# if defined (ZMQ_SNDTIMEO) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_sndtimeo (self, 1); -assert (zsock_sndtimeo (self) == 1); -zsock_sndtimeo (self); -zsock_destroy (&self); -# endif -# endif -# if defined (ZMQ_SNDBUF) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_sndbuf (self, 1); -assert (zsock_sndbuf (self) == 1); -zsock_sndbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVBUF) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_rcvbuf (self, 1); -assert (zsock_rcvbuf (self) == 1); -zsock_rcvbuf (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_LINGER) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_linger (self, 1); -assert (zsock_linger (self) == 1); -zsock_linger (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl (self, 1); -assert (zsock_reconnect_ivl (self) == 1); -zsock_reconnect_ivl (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_reconnect_ivl_max (self, 1); -assert (zsock_reconnect_ivl_max (self) == 1); -zsock_reconnect_ivl_max (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_BACKLOG) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_backlog (self, 1); -assert (zsock_backlog (self) == 1); -zsock_backlog (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_SUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_subscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_set_unsubscribe (self, "test"); -zsock_destroy (&self); -# endif -# if defined (ZMQ_TYPE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_type (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_RCVMORE) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_rcvmore (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_FD) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_fd (self); -zsock_destroy (&self); -# endif -# if defined (ZMQ_EVENTS) -self = zsock_new (ZMQ_SUB); -assert (self); -zsock_events (self); -zsock_destroy (&self); -# endif -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zsocket.3 b/external/zmq/share/man/man3/zsocket.3 deleted file mode 100644 index 2efa64fd89..0000000000 --- a/external/zmq/share/man/man3/zsocket.3 +++ /dev/null @@ -1,220 +0,0 @@ -'\" t -.\" Title: zsocket -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZSOCKET" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsocket \- working with 0MQ sockets (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// This port range is defined by IANA for dynamic or private ports -// We use this when choosing a port for dynamic binding\&. -#define ZSOCKET_DYNFROM 0xc000 -#define ZSOCKET_DYNTO 0xffff - -// Callback function for zero\-copy methods -typedef void (zsocket_free_fn) (void *data, void *arg); - -// Create a new socket within our CZMQ context, replaces zmq_socket\&. -// Use this to get automatic management of the socket at shutdown\&. -// Note: SUB sockets do not automatically subscribe to everything; you -// must set filters explicitly\&. -CZMQ_EXPORT void * - zsocket_new (zctx_t *self, int type); - -// Destroy a socket within our CZMQ context, replaces zmq_close\&. -CZMQ_EXPORT void - zsocket_destroy (zctx_t *ctx, void *self); - -// Bind a socket to a formatted endpoint\&. If the port is specified as -// \*(Aq*\*(Aq, binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO -// and returns the actual port number used\&. Otherwise asserts that the -// bind succeeded with the specified port number\&. Always returns the -// port number if successful\&. -CZMQ_EXPORT int - zsocket_bind (void *self, const char *format, \&.\&.\&.); - -// Unbind a socket from a formatted endpoint\&. -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsocket_unbind (void *self, const char *format, \&.\&.\&.); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid\&. -CZMQ_EXPORT int - zsocket_connect (void *self, const char *format, \&.\&.\&.); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsocket_disconnect (void *self, const char *format, \&.\&.\&.); - -// Poll for input events on the socket\&. Returns TRUE if there is input -// ready on the socket, else FALSE\&. -CZMQ_EXPORT bool - zsocket_poll (void *self, int msecs); - -// Returns socket type as printable constant string -CZMQ_EXPORT const char * - zsocket_type_str (void *self); - -// Send data over a socket as a single message frame\&. -// Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT\&. -// Returns \-1 on error, 0 on success -CZMQ_EXPORT int - zsocket_sendmem (void *self, const void *data, size_t size, int flags); - -// Send a signal over a socket\&. A signal is a zero\-byte message\&. -// Signals are used primarily between threads, over pipe sockets\&. -// Returns \-1 if there was an error sending the signal\&. -CZMQ_EXPORT int - zsocket_signal (void *self); - -// Wait on a signal\&. Use this to coordinate between threads, over -// pipe pairs\&. Returns \-1 on error, 0 on success\&. -CZMQ_EXPORT int - zsocket_wait (void *self); - -// Self test of this class -CZMQ_EXPORT void - zsocket_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zsocket class provides helper functions for 0MQ sockets\&. It doesn\(cqt wrap the 0MQ socket type, to avoid breaking all libzmq socket\-related calls\&. -.sp -Please add @discuss section in \&.\&./src/zsocket\&.c\&. -.SH "EXAMPLE" -.PP -\fBFrom zsocket_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zctx_t *ctx = zctx_new (); -assert (ctx); - -// Create a detached thread, let it run -char *interf = "127\&.0\&.0\&.1"; -char *domain = "localhost"; -int service = 5560; - -void *writer = zsocket_new (ctx, ZMQ_PUSH); -assert (writer); -void *reader = zsocket_new (ctx, ZMQ_PULL); -assert (reader); -assert (streq (zsocket_type_str (writer), "PUSH")); -assert (streq (zsocket_type_str (reader), "PULL")); -int rc = zsocket_bind (writer, "tcp://%s:%d", interf, service); -assert (rc == service); - -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) -// Check unbind -rc = zsocket_unbind (writer, "tcp://%s:%d", interf, service); -assert (rc == 0); - -// In some cases and especially when running under Valgrind, doing -// a bind immediately after an unbind causes an EADDRINUSE error\&. -// Even a short sleep allows the OS to release the port for reuse\&. -zclock_sleep (100); - -// Bind again -rc = zsocket_bind (writer, "tcp://%s:%d", interf, service); -assert (rc == service); -#endif - -rc = zsocket_connect (reader, "tcp://%s:%d", domain, service); -assert (rc == 0); -zstr_send (writer, "HELLO"); -char *message = zstr_recv (reader); -assert (message); -assert (streq (message, "HELLO")); -free (message); - -// Test binding to ports -int port = zsocket_bind (writer, "tcp://%s:*", interf); -assert (port >= ZSOCKET_DYNFROM && port <= ZSOCKET_DYNTO); - -assert (zsocket_poll (writer, 100) == false); - -// Test error state when connecting to an invalid socket type -// (\*(Aqtxp://\*(Aq instead of \*(Aqtcp://\*(Aq, typo intentional) -rc = zsocket_connect (reader, "txp://%s:%d", domain, service); -assert (rc == \-1); - -// Test sending frames to socket -rc = zsocket_sendmem (writer, "ABC", 3, ZFRAME_MORE); -assert (rc == 0); -rc = zsocket_sendmem (writer, "DEFG", 4, 0); -assert (rc == 0); - -zframe_t *frame = zframe_recv (reader); -assert (frame); -assert (zframe_streq (frame, "ABC")); -assert (zframe_more (frame)); -zframe_destroy (&frame); - -frame = zframe_recv (reader); -assert (frame); -assert (zframe_streq (frame, "DEFG")); -assert (!zframe_more (frame)); -zframe_destroy (&frame); - -rc = zsocket_signal (writer); -assert (rc == 0); -rc = zsocket_wait (reader); -assert (rc == 0); - -zsocket_destroy (ctx, reader); -zsocket_destroy (ctx, writer); -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zsockopt.3 b/external/zmq/share/man/man3/zsockopt.3 deleted file mode 100644 index 0e9f9cb1ac..0000000000 --- a/external/zmq/share/man/man3/zsockopt.3 +++ /dev/null @@ -1,1047 +0,0 @@ -'\" t -.\" Title: zsockopt -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZSOCKOPT" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsockopt \- get/set 0MQ socket options (deprecated) -.SH "SYNOPSIS" -.sp -.nf -#if (ZMQ_VERSION_MAJOR == 4) -// Get socket options -CZMQ_EXPORT int zsocket_tos (void *zocket); -CZMQ_EXPORT char * zsocket_zap_domain (void *zocket); -CZMQ_EXPORT int zsocket_mechanism (void *zocket); -CZMQ_EXPORT int zsocket_plain_server (void *zocket); -CZMQ_EXPORT char * zsocket_plain_username (void *zocket); -CZMQ_EXPORT char * zsocket_plain_password (void *zocket); -CZMQ_EXPORT int zsocket_curve_server (void *zocket); -CZMQ_EXPORT char * zsocket_curve_publickey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_secretkey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_serverkey (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_server (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_plaintext (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_principal (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_service_principal (void *zocket); -CZMQ_EXPORT int zsocket_ipv6 (void *zocket); -CZMQ_EXPORT int zsocket_immediate (void *zocket); -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_tos (void *zocket, int tos); -CZMQ_EXPORT void zsocket_set_router_handover (void *zocket, int router_handover); -CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory); -CZMQ_EXPORT void zsocket_set_probe_router (void *zocket, int probe_router); -CZMQ_EXPORT void zsocket_set_req_relaxed (void *zocket, int req_relaxed); -CZMQ_EXPORT void zsocket_set_req_correlate (void *zocket, int req_correlate); -CZMQ_EXPORT void zsocket_set_conflate (void *zocket, int conflate); -CZMQ_EXPORT void zsocket_set_zap_domain (void *zocket, const char * zap_domain); -CZMQ_EXPORT void zsocket_set_plain_server (void *zocket, int plain_server); -CZMQ_EXPORT void zsocket_set_plain_username (void *zocket, const char * plain_username); -CZMQ_EXPORT void zsocket_set_plain_password (void *zocket, const char * plain_password); -CZMQ_EXPORT void zsocket_set_curve_server (void *zocket, int curve_server); -CZMQ_EXPORT void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey); -CZMQ_EXPORT void zsocket_set_gssapi_server (void *zocket, int gssapi_server); -CZMQ_EXPORT void zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext); -CZMQ_EXPORT void zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal); -CZMQ_EXPORT void zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal); -CZMQ_EXPORT void zsocket_set_ipv6 (void *zocket, int ipv6); -CZMQ_EXPORT void zsocket_set_immediate (void *zocket, int immediate); -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -// Get socket options -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -// Get socket options -CZMQ_EXPORT int zsocket_hwm (void *zocket); -CZMQ_EXPORT int zsocket_swap (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl_msec (void *zocket); -CZMQ_EXPORT int zsocket_mcast_loop (void *zocket); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -# endif -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_hwm (void *zocket, int hwm); -CZMQ_EXPORT void zsocket_set_swap (void *zocket, int swap); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec); -CZMQ_EXPORT void zsocket_set_mcast_loop (void *zocket, int mcast_loop); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -# endif -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -#endif - -// Self test of this class -CZMQ_EXPORT void zsockopt_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zsockopt class provides access to the 0MQ getsockopt/setsockopt API\&. -.sp -This class is generated, using the GSL code generator\&. See the sockopts XML file, which provides the metadata, and the zsockopt\&.gsl template, which does the work\&. -.SH "EXAMPLE" -.PP -\fBFrom zsockopt_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zctx_t *ctx = zctx_new (); -assert (ctx); -void *zocket; -#if (ZMQ_VERSION_MAJOR == 4) -# if defined (ZMQ_TOS) -zocket = zsocket_new (ctx, ZMQ_DEALER); -assert (zocket); -zsocket_set_tos (zocket, 1); -assert (zsocket_tos (zocket) == 1); -zsocket_tos (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_ROUTER_HANDOVER) -zocket = zsocket_new (ctx, ZMQ_ROUTER); -assert (zocket); -zsocket_set_router_handover (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_ROUTER_MANDATORY) -zocket = zsocket_new (ctx, ZMQ_ROUTER); -assert (zocket); -zsocket_set_router_mandatory (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_PROBE_ROUTER) -zocket = zsocket_new (ctx, ZMQ_DEALER); -assert (zocket); -zsocket_set_probe_router (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_REQ_RELAXED) -zocket = zsocket_new (ctx, ZMQ_REQ); -assert (zocket); -zsocket_set_req_relaxed (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_REQ_CORRELATE) -zocket = zsocket_new (ctx, ZMQ_REQ); -assert (zocket); -zsocket_set_req_correlate (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_CONFLATE) -zocket = zsocket_new (ctx, ZMQ_PUSH); -assert (zocket); -zsocket_set_conflate (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_ZAP_DOMAIN) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_zap_domain (zocket, "test"); -char *zap_domain = zsocket_zap_domain (zocket); -assert (zap_domain); -free (zap_domain); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MECHANISM) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_mechanism (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_PLAIN_SERVER) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_plain_server (zocket, 1); -assert (zsocket_plain_server (zocket) == 1); -zsocket_plain_server (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_PLAIN_USERNAME) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_plain_username (zocket, "test"); -char *plain_username = zsocket_plain_username (zocket); -assert (plain_username); -free (plain_username); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_PLAIN_PASSWORD) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_plain_password (zocket, "test"); -char *plain_password = zsocket_plain_password (zocket); -assert (plain_password); -free (plain_password); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IPV6) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_ipv6 (zocket, 1); -assert (zsocket_ipv6 (zocket) == 1); -zsocket_ipv6 (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IMMEDIATE) -zocket = zsocket_new (ctx, ZMQ_DEALER); -assert (zocket); -zsocket_set_immediate (zocket, 1); -assert (zsocket_immediate (zocket) == 1); -zsocket_immediate (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_ROUTER_RAW) -zocket = zsocket_new (ctx, ZMQ_ROUTER); -assert (zocket); -zsocket_set_router_raw (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IPV4ONLY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_ipv4only (zocket, 1); -assert (zsocket_ipv4only (zocket) == 1); -zsocket_ipv4only (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_DELAY_ATTACH_ON_CONNECT) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_delay_attach_on_connect (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TYPE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_type (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDHWM) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_sndhwm (zocket, 1); -assert (zsocket_sndhwm (zocket) == 1); -zsocket_sndhwm (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVHWM) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvhwm (zocket, 1); -assert (zsocket_rcvhwm (zocket) == 1); -zsocket_rcvhwm (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_AFFINITY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_affinity (zocket, 1); -assert (zsocket_affinity (zocket) == 1); -zsocket_affinity (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_subscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_unsubscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IDENTITY) -zocket = zsocket_new (ctx, ZMQ_DEALER); -assert (zocket); -zsocket_set_identity (zocket, "test"); -char *identity = zsocket_identity (zocket); -assert (identity); -free (identity); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RATE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rate (zocket, 1); -assert (zsocket_rate (zocket) == 1); -zsocket_rate (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECOVERY_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_recovery_ivl (zocket, 1); -assert (zsocket_recovery_ivl (zocket) == 1); -zsocket_recovery_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDBUF) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_sndbuf (zocket, 1); -assert (zsocket_sndbuf (zocket) == 1); -zsocket_sndbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVBUF) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvbuf (zocket, 1); -assert (zsocket_rcvbuf (zocket) == 1); -zsocket_rcvbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_LINGER) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_linger (zocket, 1); -assert (zsocket_linger (zocket) == 1); -zsocket_linger (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl (zocket, 1); -assert (zsocket_reconnect_ivl (zocket) == 1); -zsocket_reconnect_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl_max (zocket, 1); -assert (zsocket_reconnect_ivl_max (zocket) == 1); -zsocket_reconnect_ivl_max (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_BACKLOG) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_backlog (zocket, 1); -assert (zsocket_backlog (zocket) == 1); -zsocket_backlog (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MAXMSGSIZE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_maxmsgsize (zocket, 1); -assert (zsocket_maxmsgsize (zocket) == 1); -zsocket_maxmsgsize (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MULTICAST_HOPS) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_multicast_hops (zocket, 1); -assert (zsocket_multicast_hops (zocket) == 1); -zsocket_multicast_hops (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvtimeo (zocket, 1); -assert (zsocket_rcvtimeo (zocket) == 1); -zsocket_rcvtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_sndtimeo (zocket, 1); -assert (zsocket_sndtimeo (zocket) == 1); -zsocket_sndtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_XPUB_VERBOSE) -zocket = zsocket_new (ctx, ZMQ_XPUB); -assert (zocket); -zsocket_set_xpub_verbose (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive (zocket, 1); -assert (zsocket_tcp_keepalive (zocket) == 1); -zsocket_tcp_keepalive (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_IDLE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_idle (zocket, 1); -assert (zsocket_tcp_keepalive_idle (zocket) == 1); -zsocket_tcp_keepalive_idle (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_CNT) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_cnt (zocket, 1); -assert (zsocket_tcp_keepalive_cnt (zocket) == 1); -zsocket_tcp_keepalive_cnt (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_INTVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_intvl (zocket, 1); -assert (zsocket_tcp_keepalive_intvl (zocket) == 1); -zsocket_tcp_keepalive_intvl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_ACCEPT_FILTER) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_accept_filter (zocket, "127\&.0\&.0\&.1"); -char *tcp_accept_filter = zsocket_tcp_accept_filter (zocket); -assert (tcp_accept_filter); -free (tcp_accept_filter); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVMORE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_rcvmore (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_FD) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_fd (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_EVENTS) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_events (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_LAST_ENDPOINT) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -char *last_endpoint = zsocket_last_endpoint (zocket); -assert (last_endpoint); -free (last_endpoint); -zsocket_destroy (ctx, zocket); -# endif -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -# if defined (ZMQ_ROUTER_RAW) -zocket = zsocket_new (ctx, ZMQ_ROUTER); -assert (zocket); -zsocket_set_router_raw (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IPV4ONLY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_ipv4only (zocket, 1); -assert (zsocket_ipv4only (zocket) == 1); -zsocket_ipv4only (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_DELAY_ATTACH_ON_CONNECT) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_delay_attach_on_connect (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TYPE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_type (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDHWM) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_sndhwm (zocket, 1); -assert (zsocket_sndhwm (zocket) == 1); -zsocket_sndhwm (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVHWM) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvhwm (zocket, 1); -assert (zsocket_rcvhwm (zocket) == 1); -zsocket_rcvhwm (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_AFFINITY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_affinity (zocket, 1); -assert (zsocket_affinity (zocket) == 1); -zsocket_affinity (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_subscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_unsubscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IDENTITY) -zocket = zsocket_new (ctx, ZMQ_DEALER); -assert (zocket); -zsocket_set_identity (zocket, "test"); -char *identity = zsocket_identity (zocket); -assert (identity); -free (identity); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RATE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rate (zocket, 1); -assert (zsocket_rate (zocket) == 1); -zsocket_rate (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECOVERY_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_recovery_ivl (zocket, 1); -assert (zsocket_recovery_ivl (zocket) == 1); -zsocket_recovery_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDBUF) -zocket = zsocket_new (ctx, ZMQ_PUB); -assert (zocket); -zsocket_set_sndbuf (zocket, 1); -assert (zsocket_sndbuf (zocket) == 1); -zsocket_sndbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVBUF) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvbuf (zocket, 1); -assert (zsocket_rcvbuf (zocket) == 1); -zsocket_rcvbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_LINGER) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_linger (zocket, 1); -assert (zsocket_linger (zocket) == 1); -zsocket_linger (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl (zocket, 1); -assert (zsocket_reconnect_ivl (zocket) == 1); -zsocket_reconnect_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl_max (zocket, 1); -assert (zsocket_reconnect_ivl_max (zocket) == 1); -zsocket_reconnect_ivl_max (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_BACKLOG) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_backlog (zocket, 1); -assert (zsocket_backlog (zocket) == 1); -zsocket_backlog (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MAXMSGSIZE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_maxmsgsize (zocket, 1); -assert (zsocket_maxmsgsize (zocket) == 1); -zsocket_maxmsgsize (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MULTICAST_HOPS) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_multicast_hops (zocket, 1); -assert (zsocket_multicast_hops (zocket) == 1); -zsocket_multicast_hops (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvtimeo (zocket, 1); -assert (zsocket_rcvtimeo (zocket) == 1); -zsocket_rcvtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SNDTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_sndtimeo (zocket, 1); -assert (zsocket_sndtimeo (zocket) == 1); -zsocket_sndtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_XPUB_VERBOSE) -zocket = zsocket_new (ctx, ZMQ_XPUB); -assert (zocket); -zsocket_set_xpub_verbose (zocket, 1); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive (zocket, 1); -assert (zsocket_tcp_keepalive (zocket) == 1); -zsocket_tcp_keepalive (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_IDLE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_idle (zocket, 1); -assert (zsocket_tcp_keepalive_idle (zocket) == 1); -zsocket_tcp_keepalive_idle (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_CNT) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_cnt (zocket, 1); -assert (zsocket_tcp_keepalive_cnt (zocket) == 1); -zsocket_tcp_keepalive_cnt (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_KEEPALIVE_INTVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_keepalive_intvl (zocket, 1); -assert (zsocket_tcp_keepalive_intvl (zocket) == 1); -zsocket_tcp_keepalive_intvl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TCP_ACCEPT_FILTER) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_tcp_accept_filter (zocket, "127\&.0\&.0\&.1"); -char *tcp_accept_filter = zsocket_tcp_accept_filter (zocket); -assert (tcp_accept_filter); -free (tcp_accept_filter); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVMORE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_rcvmore (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_FD) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_fd (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_EVENTS) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_events (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_LAST_ENDPOINT) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -char *last_endpoint = zsocket_last_endpoint (zocket); -assert (last_endpoint); -free (last_endpoint); -zsocket_destroy (ctx, zocket); -# endif -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -# if defined (ZMQ_HWM) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_hwm (zocket, 1); -assert (zsocket_hwm (zocket) == 1); -zsocket_hwm (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SWAP) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_swap (zocket, 1); -assert (zsocket_swap (zocket) == 1); -zsocket_swap (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_AFFINITY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_affinity (zocket, 1); -assert (zsocket_affinity (zocket) == 1); -zsocket_affinity (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_IDENTITY) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_identity (zocket, "test"); -char *identity = zsocket_identity (zocket); -assert (identity); -free (identity); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RATE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rate (zocket, 1); -assert (zsocket_rate (zocket) == 1); -zsocket_rate (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECOVERY_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_recovery_ivl (zocket, 1); -assert (zsocket_recovery_ivl (zocket) == 1); -zsocket_recovery_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECOVERY_IVL_MSEC) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_recovery_ivl_msec (zocket, 1); -assert (zsocket_recovery_ivl_msec (zocket) == 1); -zsocket_recovery_ivl_msec (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_MCAST_LOOP) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_mcast_loop (zocket, 1); -assert (zsocket_mcast_loop (zocket) == 1); -zsocket_mcast_loop (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if (ZMQ_VERSION_MINOR == 2) -# if defined (ZMQ_RCVTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvtimeo (zocket, 1); -assert (zsocket_rcvtimeo (zocket) == 1); -zsocket_rcvtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# endif -# if (ZMQ_VERSION_MINOR == 2) -# if defined (ZMQ_SNDTIMEO) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_sndtimeo (zocket, 1); -assert (zsocket_sndtimeo (zocket) == 1); -zsocket_sndtimeo (zocket); -zsocket_destroy (ctx, zocket); -# endif -# endif -# if defined (ZMQ_SNDBUF) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_sndbuf (zocket, 1); -assert (zsocket_sndbuf (zocket) == 1); -zsocket_sndbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVBUF) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_rcvbuf (zocket, 1); -assert (zsocket_rcvbuf (zocket) == 1); -zsocket_rcvbuf (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_LINGER) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_linger (zocket, 1); -assert (zsocket_linger (zocket) == 1); -zsocket_linger (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl (zocket, 1); -assert (zsocket_reconnect_ivl (zocket) == 1); -zsocket_reconnect_ivl (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RECONNECT_IVL_MAX) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_reconnect_ivl_max (zocket, 1); -assert (zsocket_reconnect_ivl_max (zocket) == 1); -zsocket_reconnect_ivl_max (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_BACKLOG) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_backlog (zocket, 1); -assert (zsocket_backlog (zocket) == 1); -zsocket_backlog (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_SUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_subscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_UNSUBSCRIBE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_set_unsubscribe (zocket, "test"); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_TYPE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_type (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_RCVMORE) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_rcvmore (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_FD) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_fd (zocket); -zsocket_destroy (ctx, zocket); -# endif -# if defined (ZMQ_EVENTS) -zocket = zsocket_new (ctx, ZMQ_SUB); -assert (zocket); -zsocket_events (zocket); -zsocket_destroy (ctx, zocket); -# endif -#endif - -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zstr.3 b/external/zmq/share/man/man3/zstr.3 deleted file mode 100644 index c4ea427545..0000000000 --- a/external/zmq/share/man/man3/zstr.3 +++ /dev/null @@ -1,242 +0,0 @@ -'\" t -.\" Title: zstr -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSTR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zstr \- sending and receiving strings -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Receive C string from socket\&. Caller must free returned string using -// zstr_free()\&. Returns NULL if the context is being terminated or the -// process was interrupted\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data\&. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL\&. -// Returns \-1 if the message could not be read, else returns the -// number of strings filled, zero or more\&. Free each returned string -// using zstr_free()\&. If not enough strings are provided, remaining -// multipart frames in the message are dropped\&. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, \&.\&.\&.); - -// Send a C string to a socket, as a frame\&. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string\&. String -// may be NULL, which is sent as ""\&. -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi\-part message\&. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket\&. Note that you should NOT use -// user\-supplied strings in the format (they may contain \*(Aq%\*(Aq which -// will create security holes)\&. -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi\-part -// message\&. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or \-1 on error\&. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, \&.\&.\&.); - -// Free a provided string, and nullify the parent pointer\&. Safe to call on -// a null pointer\&. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class\&. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string\&. If source -// is null, returns an empty string\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zstr\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zstr class provides utility functions for sending and receiving C strings across 0MQ sockets\&. It sends strings without a terminating null, and appends a null byte on received strings\&. This class is for simple message sending\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf - Memory Wire - +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -Send | S t r i n g | 0 | \-\-\-\-> | 6 | S t r i n g | - +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.sp -.if n \{\ -.RS 4 -.\} -.nf - Wire Heap - +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ -Recv | 6 | S t r i n g | \-\-\-\-> | S t r i n g | 0 | - +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBFrom zstr_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@inproc://zstr\&.test"); -assert (output); -zsock_t *input = zsock_new_pair (">inproc://zstr\&.test"); -assert (input); - -// Send ten strings, five strings with MORE flag and then END -int string_nbr; -for (string_nbr = 0; string_nbr < 10; string_nbr++) - zstr_sendf (output, "this is string %d", string_nbr); -zstr_sendx (output, "This", "is", "almost", "the", "very", "END", NULL); - -// Read and count until we receive END -string_nbr = 0; -for (string_nbr = 0;; string_nbr++) { - char *string = zstr_recv (input); - assert (string); - if (streq (string, "END")) { - zstr_free (&string); - break; - } - zstr_free (&string); -} -assert (string_nbr == 15); - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Test SERVER/CLIENT over zstr -zsock_t *server = zsock_new_server ("inproc://zstr\-test\-routing"); -zsock_t *client = zsock_new_client ("inproc://zstr\-test\-routing");; -assert (server); -assert (client); - -// Try normal ping\-pong to check reply routing ID -int rc = zstr_send (client, "Hello"); -assert (rc == 0); -char *request = zstr_recv (server); -assert (streq (request, "Hello")); -assert (zsock_routing_id (server)); -free (request); - -rc = zstr_send (server, "World"); -assert (rc == 0); -char *reply = zstr_recv (client); -assert (streq (reply, "World")); -free (reply); - -rc = zstr_sendf (server, "%s", "World"); -assert (rc == 0); -reply = zstr_recv (client); -assert (streq (reply, "World")); -free (reply); - -// Try ping\-pong using sendx and recx -rc = zstr_sendx (client, "Hello", NULL); -assert (rc == 0); -rc = zstr_recvx (server, &request, NULL); -assert (rc >= 0); -assert (streq (request, "Hello")); -free (request); - -rc = zstr_sendx (server, "World", NULL); -assert (rc == 0); -rc = zstr_recvx (client, &reply, NULL); -assert (rc >= 0); -assert (streq (reply, "World")); -free (reply); - -// Client and server disallow multipart -rc = zstr_sendm (client, "Hello"); -assert (rc == \-1); -rc = zstr_sendm (server, "World"); -assert (rc == \-1); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zsys.3 b/external/zmq/share/man/man3/zsys.3 deleted file mode 100644 index 2d4f5c2e45..0000000000 --- a/external/zmq/share/man/man3/zsys.3 +++ /dev/null @@ -1,539 +0,0 @@ -'\" t -.\" Title: zsys -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSYS" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsys \- system\-level methods -.SH "SYNOPSIS" -.sp -.nf -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e\&.g\&. logging is properly set\-up before you start working\&. -// Not threadsafe, so call only from main thread\&. Safe to call multiple -// times\&. Returns global CZMQ context\&. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls\&. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time\&. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock\&. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket\&. You should call this for every socket you -// create using zsys_socket()\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc\&. -// The pipe is configured to use the zsys_pipehwm setting\&. Returns the -// frontend socket successful, NULL if failed\&. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them\&. If you call this multiple times -// then the last handler will take affect\&. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ\&. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl\-C or SIGTERM will set -// zsys_interrupted\&. Idempotent; safe to call multiple times\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or \-1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time\&. Returns 0 if the file does not exist\&. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes\&. -// Returns a mode_t cast to int, or \-1 in case of error\&. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file\&. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is \*(Aqstable\*(Aq -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn\*(Aqt exist\&. The file path is treated as a -// printf format\&. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, \&.\&.\&.); - -// Remove a file path if empty; the pathname is treated as printf format\&. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, \&.\&.\&.); - -// Move to a specified working directory\&. Returns 0 if OK, \-1 if this failed\&. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only\&. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults\&. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run\-time API detection; returns version -// number into provided fields, providing reference isn\*(Aqt null in each case\&. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned -// string using zstr_free()\&. -CZMQ_EXPORT char * - zsys_sprintf (const char *format, \&.\&.\&.); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned -// string using zstr_free()\&. -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast\&. This method -// and related ones might _eventually_ be moved to a zudp class\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return \-1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints\&. Caller gets -// a freshly allocated string, should free it using zstr_free()\&. If the host -// name is not resolvable, returns NULL\&. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background\&. The precise effect depends -// on the operating system\&. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP\&. On -// Windows, does nothing\&. Returns 0 if OK, \-1 if there was an error\&. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user\&. Any of the arguments -// may be null, indicating a no\-op\&. Returns 0 on success, \-1 on failure\&. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID\&. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security\&. -// Uses a heuristic probe according to the version of libzmq being used\&. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use\&. A good -// rule of thumb is one thread per gigabit of traffic in or out\&. The -// default is 1, sufficient for most applications\&. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow\&. The default -// is 1024\&. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support\&. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent\&. -// The default is INT_MAX\&. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size\&. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// linger time is zero, i\&.e\&. any pending messages will be dropped\&. If the -// environment variable ZSYS_LINGER is defined, that provides the default\&. -// Note that process exit will typically be delayed by the linger time\&. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default\&. Note that a value of -// zero means no limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default\&. Note that a value of -// zero means no limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm)\&. The default HWM is -// 1,000, on all versions of ZeroMQ\&. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default\&. Note that a value of zero means no -// limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes\&. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances\&. By default sockets accept -// and make only IPv4 connections\&. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers\&. You can override the setting on -// each zsock_t instance\&. The default is IPv4 only (ipv6 set to 0)\&. If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default\&. Note: has no effect on ZMQ v2\&. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances\&. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon\&. -// This lets the interface be configured for test environments where required\&. -// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is -// the default when there is no specified interface\&. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name\&. -// Setting the interface to "*" means "use all available interfaces"\&. -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set\&. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon\&. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface\&. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address\&. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set\&. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages\&. This needs -// to be set if IPv6 is enabled\&. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address\&. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set\&. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre\-allocated FDs when creating new sockets\&. -// If 0 (default), nothing will happen\&. Else, when a new socket is bound, the -// system API will be used to check if an existing pre\-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket\&. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre\-allocated FDs for zsock instances\&. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process\&. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set\&. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic\&. By default, log traffic is sent to -// stdout\&. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility)\&. -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint\&. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint\&. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout\&. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints\&. To disable the sender, call -// this method with a null argument\&. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows)\&. By default this is disabled\&. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition \- highest priority -CZMQ_EXPORT void - zsys_error (const char *format, \&.\&.\&.); - -// Log warning condition \- high priority -CZMQ_EXPORT void - zsys_warning (const char *format, \&.\&.\&.); - -// Log normal, but significant, condition \- normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, \&.\&.\&.); - -// Log informational message \- low priority -CZMQ_EXPORT void - zsys_info (const char *format, \&.\&.\&.); - -// Log debug\-level message \- lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, \&.\&.\&.); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl\-C or the process -// gets a SIGTERM signal\&. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsys\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zsys class provides a portable wrapper for system calls\&. We collect them here to reduce the number of weird #ifdefs in other classes\&. As far as possible, the bulk of CZMQ classes are fully portable\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsys\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zsys_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsys_catch_interrupts (); - -// Check capabilities without using the return value -int rc = zsys_has_curve (); - -if (verbose) { - char *hostname = zsys_hostname (); - zsys_info ("host name is %s", hostname); - free (hostname); - zsys_info ("system limit is %zu ZeroMQ sockets", zsys_socket_limit ()); -} -zsys_set_linger (0); -zsys_set_sndhwm (1000); -zsys_set_rcvhwm (1000); -zsys_set_pipehwm (2500); -assert (zsys_pipehwm () == 2500); -zsys_set_ipv6 (0); - -// Test pipe creation -zsock_t *pipe_back; -zsock_t *pipe_front = zsys_create_pipe (&pipe_back); -zstr_send (pipe_front, "Hello"); -char *string = zstr_recv (pipe_back); -assert (streq (string, "Hello")); -free (string); -zsock_destroy (&pipe_back); -zsock_destroy (&pipe_front); - -// Test file manipulation -rc = zsys_file_delete ("nosuchfile"); -assert (rc == \-1); - -bool rc_bool = zsys_file_exists ("nosuchfile"); -assert (rc_bool != true); - -rc = (int) zsys_file_size ("nosuchfile"); -assert (rc == \-1); - -time_t when = zsys_file_modified ("\&."); -assert (when > 0); - -int mode = zsys_file_mode ("\&."); -assert (S_ISDIR (mode)); -assert (mode & S_IRUSR); -assert (mode & S_IWUSR); - -zsys_file_mode_private (); -rc = zsys_dir_create ("%s/%s", "\&.", "\&.testsys/subdir"); -assert (rc == 0); -when = zsys_file_modified ("\&./\&.testsys/subdir"); -assert (when > 0); -assert (!zsys_file_stable ("\&./\&.testsys/subdir")); -rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys/subdir"); -assert (rc == 0); -rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys"); -assert (rc == 0); -zsys_file_mode_default (); -assert (zsys_dir_change ("\&.") == 0); - -int major, minor, patch; -zsys_version (&major, &minor, &patch); -assert (major == CZMQ_VERSION_MAJOR); -assert (minor == CZMQ_VERSION_MINOR); -assert (patch == CZMQ_VERSION_PATCH); - -string = zsys_sprintf ("%s %02x", "Hello", 16); -assert (streq (string, "Hello 10")); -free (string); - -char *str64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,\&."; -int num10 = 1234567890; -string = zsys_sprintf ("%s%s%s%s%d", str64, str64, str64, str64, num10); -assert (strlen (string) == (4 * 64 + 10)); -free (string); - -// Test logging system -zsys_set_logident ("czmq_selftest"); -zsys_set_logsender ("inproc://logging"); -void *logger = zsys_socket (ZMQ_SUB, NULL, 0); -assert (logger); -rc = zmq_connect (logger, "inproc://logging"); -assert (rc == 0); -rc = zmq_setsockopt (logger, ZMQ_SUBSCRIBE, "", 0); -assert (rc == 0); - -if (verbose) { - zsys_error ("This is an %s message", "error"); - zsys_warning ("This is a %s message", "warning"); - zsys_notice ("This is a %s message", "notice"); - zsys_info ("This is a %s message", "info"); - zsys_debug ("This is a %s message", "debug"); - zsys_set_logident ("hello, world"); - zsys_info ("This is a %s message", "info"); - zsys_debug ("This is a %s message", "debug"); - - // Check that logsender functionality is working - char *received = zstr_recv (logger); - assert (received); - zstr_free (&received); -} -zsys_close (logger, NULL, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zthread.3 b/external/zmq/share/man/man3/zthread.3 deleted file mode 100644 index 9a6d2eb18b..0000000000 --- a/external/zmq/share/man/man3/zthread.3 +++ /dev/null @@ -1,148 +0,0 @@ -'\" t -.\" Title: zthread -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 3.0.2 -.\" Language: English -.\" -.TH "ZTHREAD" "3" "09/14/2016" "CZMQ 3\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zthread \- working with system threads (deprecated) -.SH "SYNOPSIS" -.sp -.nf -// Detached threads follow POSIX pthreads API -typedef void *(zthread_detached_fn) (void *args); - -// Attached threads get context and pipe from parent -typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe); - -// Create a detached thread\&. A detached thread operates autonomously -// and is used to simulate a separate process\&. It gets no ctx, and no -// pipe\&. -CZMQ_EXPORT int - zthread_new (zthread_detached_fn *thread_fn, void *args); - -// Create an attached thread\&. An attached thread gets a ctx and a PAIR -// pipe back to its parent\&. It must monitor its pipe, and exit if the -// pipe becomes unreadable\&. Do not destroy the ctx, the thread does this -// automatically when it ends\&. -CZMQ_EXPORT void * - zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args); - -// Self test of this class -CZMQ_EXPORT void - zthread_test (bool verbose); -.fi -.SH "DESCRIPTION" -.sp -The zthread class wraps OS thread creation\&. It creates detached threads that look like normal OS threads, or attached threads that share the caller\(cqs 0MQ context, and get an inproc pipe to talk back to the parent thread\&. Detached threads create their own 0MQ contexts as needed\&. NOTE: this class is deprecated in favor of zactor\&. -.sp -We have several use cases for multiple threads\&. One is to simulate many processes, so we can test 0MQ designs and flows more easily\&. Another is to create APIs that can send and receive 0MQ messages in the background\&. -.sp -zthread solves these two use cases separately, using the zthread_new and zthead_fork methods respectively\&. These methods wrap the native system calls needed to start threads, so your code can remain fully portable\&. -.sp -Detached threads follow the POSIX pthreads API; they accept a void * argument and return a void * result (always NULL in our case)\&. -.sp -Attached thread receive a void * argument, a zctx_t context, and a pipe socket\&. The pipe socket is a PAIR socket that is connected back to the caller\&. When you call zthread_fork, it returns you a PAIR socket that is the other end of this pipe\&. Thus attached threads can talk back to their parent threads over the pipe\&. We use this very heavily when making so\-called "asynchronous" APIs, which you can see in the Guide examples like \fIclone\fR\&. -.sp -To recap some rules about threading: do not share sockets between threads or your code will crash\&. You can migrate a socket from one thread to a child thread, if you stop using it in the parent thread immediately after creating the child thread\&. If you want to connect sockets over inproc:// they must share the same 0MQ context, i\&.e\&. be attached threads\&. You should always use zthread_fork to create an attached thread; it is not sufficient to pass a zctx_t structure to a detached thread (this will crash)\&. -.sp -If you want to communicate over ipc:// or tcp:// you may be sharing the same context, or use separate contexts\&. Thus, every detached thread usually starts by creating its own zctx_t instance\&. -.SH "EXAMPLE" -.PP -\fBFrom zthread_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -static void * -s_test_detached (void *args) -{ -// Create a socket to check it\*(Aqll be automatically deleted -zctx_t *ctx = zctx_new (); -assert (ctx); - -void *push = zsocket_new (ctx, ZMQ_PUSH); -assert (push); -zctx_destroy (&ctx); -return NULL; -} - -static void -s_test_attached (void *args, zctx_t *ctx, void *pipe) -{ -// Create a socket to check it\*(Aqll be automatically deleted -zsocket_new (ctx, ZMQ_PUSH); -assert (ctx); -// Wait for our parent to ping us, and pong back -char *ping = zstr_recv (pipe); -assert (ping); -zstr_free (&ping); -zstr_send (pipe, "pong"); -} - -zctx_t *ctx = zctx_new (); -assert (ctx); -int rc = 0; - -// Create a detached thread, let it run -rc = zthread_new (s_test_detached, NULL); -assert (rc == 0); -zclock_sleep (100); - -// Create an attached thread, check it\*(Aqs safely alive -void *pipe = zthread_fork (ctx, s_test_attached, NULL); -assert (pipe); -zstr_send (pipe, "ping"); -char *pong = zstr_recv (pipe); -assert (pong); -assert (streq (pong, "pong")); -zstr_free (&pong); - -// Everything should be cleanly closed now -zctx_destroy (&ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) 1991\-2012 iMatix Corporation \-\- http://www\&.imatix\&.com Copyright other contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/ztimerset.3 b/external/zmq/share/man/man3/ztimerset.3 deleted file mode 100644 index 1eaa5ab949..0000000000 --- a/external/zmq/share/man/man3/ztimerset.3 +++ /dev/null @@ -1,180 +0,0 @@ -'\" t -.\" Title: ztimerset -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZTIMERSET" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ztimerset \- timer set -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event\&. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set\&. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set\&. Returns timer id if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer\&. Returns 0 if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval\&. Returns 0 if OK, \-1 on failure\&. -// This method is slow, canceling the timer and adding a new one yield better performance\&. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time\&. Returns 0 if OK, \-1 on failure\&. -// This method is slow, canceling the timer and adding a new one yield better performance\&. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval\&. -// Should be used as timeout parameter for the zpoller wait method\&. -// The timeout is in msec\&. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed\&. -// Should be call after zpoller wait method\&. -// Returns 0 if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztimerset\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -ztimerset \- timer set -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ztimerset\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom ztimerset_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Simple create/destroy test -ztimerset_t *self = ztimerset_new (); -assert (self); - -// Adding timer -bool timer_invoked = false; -int timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -int rc = ztimerset_execute (self); -assert (rc == 0); -assert (!timer_invoked); -int timeout = ztimerset_timeout (self); -assert (timeout > 0); -zclock_sleep (timeout); -rc = ztimerset_execute (self); -assert (rc == 0); -assert (timer_invoked); - -// Cancel timer -timeout = ztimerset_timeout (self); -assert (timeout > 0); -rc = ztimerset_cancel (self, timer_id); -assert (rc == 0); -timeout = ztimerset_timeout (self); -assert(timeout == \-1); - -// Reset a timer -timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -timeout = ztimerset_timeout (self); -assert (timeout > 0); -zclock_sleep (timeout / 2); -timeout = ztimerset_timeout (self); -rc = ztimerset_reset(self, timer_id); -assert (rc == 0); -int timeout2 = ztimerset_timeout (self); -assert (timeout2 > timeout); -rc = ztimerset_cancel (self, timer_id); -assert (rc == 0); - -// Set interval -timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -timeout = ztimerset_timeout (self); -rc = ztimerset_set_interval(self, timer_id, 200); -timeout2 = ztimerset_timeout (self); -assert (timeout2 > timeout); - -ztimerset_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/ztrie.3 b/external/zmq/share/man/man3/ztrie.3 deleted file mode 100644 index 6cfb401a34..0000000000 --- a/external/zmq/share/man/man3/ztrie.3 +++ /dev/null @@ -1,292 +0,0 @@ -'\" t -.\" Title: ztrie -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZTRIE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ztrie \- simple trie for tokenizable strings -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data\&. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie\&. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie\&. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data\&. Returns \-1 -// if the route already exists, otherwise 0\&. This method takes ownership of -// the provided data if a destroy_data_fn is provided\&. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data\&. Returns \-1 if the -// route does not exists, otherwise 0\&. -// the start of the list call zlist_first ()\&. Advances the cursor\&. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false\&. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches\&. If the path -// did not match, returns NULL\&. Do not delete the data as it\*(Aqs owned by -// ztrie\&. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has\&. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches\&. If the path did not match or the route did not contain any -// named regexes, returns NULL\&. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL\&. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztrie\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -This is a variant of a trie or prefix tree where all the descendants of a node have a common prefix of the string associated with that node\&. This implementation is specialized for strings that can be tokenized by a delimiter like a URL, URI or URN\&. Routes in the tree can be matched by regular expressions and by using capturing groups parts of a matched route can be easily obtained\&. -.sp -Note that the performance for pure string based matching is okay but on short strings zhash and zhashx are 3\-4 times faster\&. -.SH "EXAMPLE" -.PP -\fBFrom ztrie_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create a new trie for matching strings that can be tokenized by a slash -// (e\&.g\&. URLs minus the protocol, address and port)\&. -ztrie_t *self = ztrie_new (\*(Aq/\*(Aq); -assert (self); - -int ret = 0; - -// Let\*(Aqs start by inserting a couple of routes into the trie\&. -// This one is for the route \*(Aq/foo/bar\*(Aq the slash at the beginning of the -// route is important because everything before the first delimiter will be -// discarded\&. A slash at the end of a route is optional though\&. The data -// associated with this node is passed without destroy function which means -// it must be destroyed by the caller\&. -int foo_bar_data = 10; -ret = ztrie_insert_route (self, "/foo/bar", &foo_bar_data, NULL); -assert (ret == 0); - -// Now suppose we like to match all routes with two tokens that start with -// \*(Aq/foo/\*(Aq but aren\*(Aqt \*(Aq/foo/bar\*(Aq\&. This is possible by using regular -// expressions which are enclosed in an opening and closing curly bracket\&. -// Tokens that contain regular expressions are always match after string -// based tokens\&. -// Note: There is no order in which regular expressions are sorted thus -// if you enter multiple expressions for a route you will have to make -// sure they don\*(Aqt have overlapping results\&. For example \*(Aq/foo/{[^/]+}\*(Aq -// and \*(Aq/foo/{\ed+} having could turn out badly\&. -int foo_other_data = 100; -ret = ztrie_insert_route (self, "/foo/{[^/]+}", &foo_other_data, NULL); -assert (ret == 0); - -// Regular expression are only matched against tokens of the same level\&. -// This allows us to append to are route with a regular expression as if -// it were a string\&. -ret = ztrie_insert_route (self, "/foo/{[^/]+}/gulp", NULL, NULL); -assert (ret == 0); - -// Routes are identified by their endpoint, which is the last token of the route\&. -// It is possible to insert routes for a node that already exists but isn\*(Aqt an -// endpoint yet\&. The delimiter at the end of a route is optional and has no effect\&. -ret = ztrie_insert_route (self, "/foo/", NULL, NULL); -assert (ret == 0); - -// If you try to insert a route which already exists the method will return \-1\&. -ret = ztrie_insert_route (self, "/foo", NULL, NULL); -assert (ret == \-1); - -// It is not allowed to insert routes with empty tokens\&. -ret = ztrie_insert_route (self, "//foo", NULL, NULL); -assert (ret == \-1); - -// Everything before the first delimiter is ignored so \*(Aqfoo/bar/baz\*(Aq is equivalent -// to \*(Aq/bar/baz\*(Aq\&. -ret = ztrie_insert_route (self, "foo/bar/baz", NULL, NULL); -assert (ret == 0); -ret = ztrie_insert_route (self, "/bar/baz", NULL, NULL); -assert (ret == \-1); - -// Of course you are allowed to remove routes, in case there is data associated with a -// route and a destroy data function has been supplied that data will be destroyed\&. -ret = ztrie_remove_route (self, "/foo"); -assert (ret == 0); - -// Removing a non existent route will as well return \-1\&. -ret = ztrie_remove_route (self, "/foo"); -assert (ret == \-1); - -// Removing a route with a regular expression must exactly match the entered one\&. -ret = ztrie_remove_route (self, "/foo/{[^/]+}"); -assert (ret == 0); - -// Next we like to match a path by regular expressions and also extract matched -// parts of a route\&. This can be done by naming the regular expression\&. The name of a -// regular expression is entered at the beginning of the curly brackets and separated -// by a colon from the regular expression\&. The first one in this examples is named -// \*(Aqname\*(Aq and names the expression \*(Aq[^/]\*(Aq\&. If there is no capturing group defined in -// the expression the whole matched string will be associated with this parameter\&. In -// case you don\*(Aqt like the get the whole matched string use a capturing group, like -// it has been done for the \*(Aqid\*(Aq parameter\&. This is nice but you can even match as -// many parameter for a token as you like\&. Therefore simply put the parameter names -// separated by colons in front of the regular expression and make sure to add a -// capturing group for each parameter\&. The first parameter will be associated with -// the first capturing and so on\&. -char *data = (char *) malloc (80); -sprintf (data, "%s", "Hello World!"); -ret = ztrie_insert_route (self, "/baz/{name:[^/]+}/{id:\-\-(\e\ed+)}/{street:nr:(\e\ea+)(\e\ed+)}", data, NULL); -assert (ret == 0); - -// There is a lot you can do with regular expression but matching routes -// of arbitrary length wont work\&. Therefore we make use of the asterisk -// operator\&. Just place it at the end of your route, e\&.g\&. \*(Aq/config/bar/*\*(Aq\&. -ret = ztrie_insert_route (self, "/config/bar/*", NULL, NULL); -assert (ret == 0); - -// Appending to an asterisk as you would to with a regular expression -// isn\*(Aqt valid\&. -ret = ztrie_insert_route (self, "/config/bar/*/bar", NULL, NULL); -assert (ret == \-1); - -// The asterisk operator will only work as a leaf in the tree\&. If you -// enter an asterisk in the middle of your route it will simply be -// interpreted as a string\&. -ret = ztrie_insert_route (self, "/test/*/bar", NULL, NULL); -assert (ret == 0); - -// If a parent has an asterisk as child it is not allowed to have -// other siblings\&. -ret = ztrie_insert_route (self, "/config/bar/foo/glup", NULL, NULL); -assert (ret != 0); - -// Test matches -bool hasMatch = false; - -// The route \*(Aq/bar/foo\*(Aq will fail to match as this route has never been inserted\&. -hasMatch = ztrie_matches (self, "/bar/foo"); -assert (!hasMatch); - -// The route \*(Aq/foo/bar\*(Aq will match and we can obtain the data associated with it\&. -hasMatch = ztrie_matches (self, "/foo/bar"); -assert (hasMatch); -int foo_bar_hit_data = *((int *) ztrie_hit_data (self)); -assert (foo_bar_data == foo_bar_hit_data); - -// This route is part of another but is no endpoint itself thus the matches will fail\&. -hasMatch = ztrie_matches (self, "/baz/blub"); -assert (!hasMatch); - -// This route will match our named regular expressions route\&. Thus we can extract data -// from the route by their names\&. -hasMatch = ztrie_matches (self, "/baz/blub/\-\-11/abc23"); -assert (hasMatch); -char *match_data = (char *) ztrie_hit_data (self); -assert (streq ("Hello World!", match_data)); -zhashx_t *parameters = ztrie_hit_parameters (self); -assert (zhashx_size (parameters) == 4); -assert (streq ("blub", (char *) zhashx_lookup (parameters, "name"))); -assert (streq ("11", (char *) zhashx_lookup (parameters, "id"))); -assert (streq ("abc", (char *) zhashx_lookup (parameters, "street"))); -assert (streq ("23", (char *) zhashx_lookup (parameters, "nr"))); -zhashx_destroy (¶meters); - -// This will match our asterisk route \*(Aq/config/bar/*\*(Aq\&. As the result we -// can obtain the asterisk matched part of the route\&. -hasMatch = ztrie_matches (self, "/config/bar/foo/bar"); -assert (hasMatch); -assert (streq (ztrie_hit_asterisk_match (self), "foo/bar")); - -zstr_free (&data); -ztrie_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man3/zuuid.3 b/external/zmq/share/man/man3/zuuid.3 deleted file mode 100644 index c5431245eb..0000000000 --- a/external/zmq/share/man/man3/zuuid.3 +++ /dev/null @@ -1,171 +0,0 @@ -'\" t -.\" Title: zuuid -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZUUID" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zuuid \- UUID support class -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new UUID object\&. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN\-octet value\&. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object\&. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN\-octet value\&. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping \*(Aq\-\*(Aq and \*(Aq{\*(Aq \*(Aq}\*(Aq -// optional delimiters\&. Return 0 if OK, else returns \-1\&. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data\&. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8\-4\-4\-4\-12, in lower -// case\&. Caller does not modify or free returned value\&. See -// http://en\&.wikipedia\&.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null\&. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zuuid\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zuuid class generates UUIDs and provides methods for working with them\&. If you build CZMQ with libuuid, on Unix/Linux, it will use that library\&. On Windows it will use UuidCreate()\&. Otherwise it will use a random number generator to produce convincing imitations of UUIDs\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zuuid\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zuuid_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Simple create/destroy test -assert (ZUUID_LEN == 16); -assert (ZUUID_STR_LEN == 32); - -zuuid_t *uuid = zuuid_new (); -assert (uuid); -assert (zuuid_size (uuid) == ZUUID_LEN); -assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN); -zuuid_t *copy = zuuid_dup (uuid); -assert (streq (zuuid_str (uuid), zuuid_str (copy))); - -// Check set/set_str/export methods -const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38"; -const char *myuuid2 = "8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38"; -const char *myuuid3 = "{8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38}"; -const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838"; -int rc = zuuid_set_str (uuid, myuuid); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid2); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid3); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid4); -assert (rc == \-1); -byte copy_uuid [ZUUID_LEN]; -zuuid_export (uuid, copy_uuid); -zuuid_set (uuid, copy_uuid); -assert (streq (zuuid_str (uuid), myuuid)); - -// Check the canonical string format -assert (streq (zuuid_str_canonical (uuid), - "8cb3e9a9\-649b\-4bef\-8de2\-25e9c2cebb38")); - -zuuid_destroy (&uuid); -zuuid_destroy (©); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man7/czmq.7 b/external/zmq/share/man/man7/czmq.7 deleted file mode 100644 index 6de419cb00..0000000000 --- a/external/zmq/share/man/man7/czmq.7 +++ /dev/null @@ -1,1358 +0,0 @@ -'\" t -.\" Title: czmq -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "CZMQ" "7" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -czmq \- high\-level C binding for ZeroMQ -.SH "SYNOPSIS" -.sp -.nf -#include - -cc [\*(Aqflags\*(Aq] \*(Aqfiles\*(Aq \-lzmq \-lczmq [\*(Aqlibraries\*(Aq] -.fi -.SH "DESCRIPTION" -.SS "Classes" -.sp -These classes provide the main socket and message API: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsock\fR(3) -\- working with ZeroMQ sockets (high\-level) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzstr\fR(3) -\- sending and receiving strings -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmsg\fR(3) -\- working with multipart messages -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzframe\fR(3) -\- working with single message frames -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzactor\fR(3) -\- Actor class (socket + thread) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzloop\fR(3) -\- event\-driven reactor -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzpoller\fR(3) -\- trivial socket poller class -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzproxy\fR(3) -\- proxy actor (like zmq_proxy_steerable) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmonitor\fR(3) -\- monitor events on ZeroMQ sockets -.RE -.sp -These classes support authentication and encryption: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzauth\fR(3) -\- authentication actor for ZeroMQ servers -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzcert\fR(3) -\- work with CURVE security certificates -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzcertstore\fR(3) -\- work with CURVE security certificate stores -.RE -.sp -These classes provide generic containers: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzhash\fR(3) -\- simple generic hash container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzhashx\fR(3) -\- extended generic hash container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzlist\fR(3) -\- simple generic list container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzlistx\fR(3) -\- extended generic list container -.RE -.sp -These classes wrap\-up non\-portable functionality: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzbeacon\fR(3) -\- LAN discovery and presence -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzclock\fR(3) -\- millisecond clocks and delays -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzdir\fR(3) -\- work with file\-system directories -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzdir_patch\fR(3) -\- work with directory differences -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzfile\fR(3) -\- work with file\-system files -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsys\fR(3) -\- system\-level methods -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzuuid\fR(3) -\- UUID support class -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBziflist\fR(3) -\- list available network interfaces -.RE -.sp -And these utility classes add value: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzchunk\fR(3) -\- work with memory chunks -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzconfig\fR(3) -\- work with textual config files -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzrex\fR(3) -\- work with regular expressions -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzgossip\fR(3) -\- decentralized configuration management -.RE -.sp -These classes are deprecated: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzctx\fR(3) -\- working with ZeroMQ contexts -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsocket\fR(3) -\- working with ZeroMQ sockets (low\-level) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsockopt\fR(3) -\- get/set ZeroMQ socket options -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzthread\fR(3) -\- working with system threads -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzauth_v2\fR(3) -\- authentication for ZeroMQ servers -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzbeacon_v2\fR(3) -\- LAN discovery and presence -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmonitor_v2\fR(3) -\- socket event monitor -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzproxy_v2\fR(3) -\- zmq_proxy wrapper -.RE -.SS "Scope and Goals" -.sp -CZMQ has these goals: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To wrap the \(/OMQ core API in semantics that are natural and lead to shorter, more readable applications\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To hide the differences between versions of \(/OMQ\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To provide a space for development of more sophisticated API semantics\&. -.RE -.SS "Ownership and License" -.sp -CZMQ is maintained by the ZeroMQ community at github\&.com/zeromq\&. Its other authors and contributors are listed in the AUTHORS file\&. -.sp -The contributors are listed in AUTHORS\&. This project uses the MPL v2 license, see LICENSE\&. -.SS "Contributing" -.sp -To submit an issue use the issue tracker at \m[blue]\fBhttp://github\&.com/zeromq/czmq/issues\fR\m[]\&. All discussion happens on the zeromq\-dev list or #zeromq IRC channel at irc\&.freenode\&.net\&. -.sp -The proper way to submit patches is to clone this repository, make your changes, and use git to create a patch or a pull request\&. See \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. All contributors are listed in AUTHORS\&. -.sp -All classes are maintained by a single person, who is the responsible editor for that class and who is named in the header as such\&. This is usually the originator of the class\&. When several people collaborate on a class, one single person is always the lead maintainer and the one to blame when it breaks\&. -.sp -The general rule is, if you contribute code to CZMQ you must be willing to maintain it as long as there are users of it\&. Code with no active maintainer will in general be deprecated and/or removed\&. -.SH "USING CZMQ" -.SS "Building and Installing" -.sp -CZMQ uses autotools for packaging\&. To build from git (all example commands are for Linux): -.sp -.if n \{\ -.RS 4 -.\} -.nf - git clone git://github\&.com/zeromq/czmq\&.git - cd czmq - sh autogen\&.sh - \&./configure - make all - sudo make install - sudo ldconfig -.fi -.if n \{\ -.RE -.\} -.sp -You will need the pkg\-config, libtool, and autoreconf packages\&. Set the LD_LIBRARY_PATH to /usr/local/libs unless you install elsewhere\&. -.sp -After building, you can run the CZMQ selftests: -.sp -.if n \{\ -.RS 4 -.\} -.nf - cd src - \&./czmq_selftest -.fi -.if n \{\ -.RE -.\} -.SS "Linking with an Application" -.sp -Include czmq\&.h in your application and link with CZMQ\&. Here is a typical gcc link command: -.sp -.if n \{\ -.RS 4 -.\} -.nf - gcc \-lczmq \-lzmq myapp\&.c \-o myapp -.fi -.if n \{\ -.RE -.\} -.sp -You should read czmq\&.h\&. This file includes zmq\&.h and the system header files that typical \(/OMQ applications will need\&. The provided \fIc\fR shell script lets you write simple portable build scripts: -.sp -.if n \{\ -.RS 4 -.\} -.nf - c \-lczmq \-lzmq \-l myapp -.fi -.if n \{\ -.RE -.\} -.SS "The Class Model" -.sp -CZMQ consists of classes, each class consisting of a \&.h and a \&.c\&. Classes may depend on other classes\&. -.sp -czmq\&.h includes all classes header files, all the time\&. For the user, CZMQ forms one single package\&. All classes start by including czmq\&.h\&. All applications that use CZMQ start by including czmq\&.h\&. czmq\&.h also defines a limited number of small, useful macros and typedefs that have proven useful for writing clearer C code\&. -.sp -All classes (with some exceptions) are based on a flat C class system and follow these rules (where \fIzclass\fR is the class name): -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Class typedef: -zclass_t -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Constructor: -zclass_new -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Destructor: -zclass_destroy -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Property methods: -zclass_property_set, -zclass_property -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Class structures are private (defined in the \&.c source but not the \&.h) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Properties are accessed only via methods named as described above\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -In the class source code the object is always called -self\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The constructor may take arbitrary arguments, and returns NULL on failure, or a new object\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The destructor takes a pointer to an object reference and nullifies it\&. -.RE -.sp -Return values for methods are: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For methods that return an object reference, either the reference, or NULL on failure\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For methods that signal success/failure, a return value of 0 means success, \-1 failure\&. -.RE -.sp -Private/static functions in a class are named s_functionname and are not exported via the header file\&. -.sp -All classes (with some exceptions) have a test method called zclass_test\&. -.SH "DESIGN IDEOLOGY" -.SS "The Problem with C" -.sp -C has the significant advantage of being a small language that, if we take a little care with formatting and naming, can be easily interchanged between developers\&. Every C developer will use much the same 90% of the language\&. Larger languages like C++ provide powerful abstractions like STL containers but at the cost of interchange\&. -.sp -The huge problem with C is that any realistic application needs packages of functionality to bring the language up to the levels we expect for the 21st century\&. Much can be done by using external libraries but every additional library is a dependency that makes the resulting applications harder to build and port\&. While C itself is a highly portable language (and can be made more so by careful use of the preprocessor), most C libraries consider themselves part of the operating system, and as such do not attempt to be portable\&. -.sp -The answer to this, as we learned from building enterprise\-level C applications at iMatix from 1995\-2005, is to create our own fully portable, high\-quality libraries of pre\-packaged functionality, in C\&. Doing this right solves both the requirements of richness of the language, and of portability of the final applications\&. -.SS "A Simple Class Model" -.sp -C has no standard API style\&. It is one thing to write a useful component, but something else to provide an API that is consistent and obvious across many components\&. We learned from building OpenAMQ (\m[blue]\fBhttp://www\&.openamq\&.org\fR\m[]), a messaging client and server of 0\&.5M LoC, that a consistent model for extending C makes life for the application developer much easier\&. -.sp -The general model is that of a class (the source package) that provides objects (in fact C structures)\&. The application creates objects and then works with them\&. When done, the application destroys the object\&. In C, we tend to use the same name for the object as the class, when we can, and it looks like this (to take a fictitious CZMQ class): -.sp -.if n \{\ -.RS 4 -.\} -.nf - zregexp_t *regexp = zregexp_new (regexp_string); - if (!regexp) - printf ("E: invalid regular expression: %s\en", regexp_string); - else - if (zregexp_match (regexp, input_buffer)) - printf ("I: successful match for %s\en", input buffer); - zregexp_destroy (&regexp); -.fi -.if n \{\ -.RE -.\} -.sp -As far as the C program is concerned, the object is a reference to a structure (not a void pointer)\&. We pass the object reference to all methods, since this is still C\&. We could do weird stuff like put method addresses into the structure so that we can emulate a C++ syntax but it\(cqs not worthwhile\&. The goal is not to emulate an OO system, it\(cqs simply to gain consistency\&. The constructor returns an object reference, or NULL if it fails\&. The destructor nullifies the class pointer, and is idempotent\&. -.sp -What we aim at here is the simplest possible consistent syntax\&. -.sp -No model is fully consistent, and classes can define their own rules if it helps make a better result\&. For example: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Some classes may not be opaque\&. For example, we have cases of generated serialization classes that encode and decode structures to/from binary buffers\&. It feels clumsy to have to use methods to access the properties of these classes\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -While every class has a new method that is the formal constructor, some methods may also act as constructors\&. For example, a "dup" method might take one object and return a second object\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -While every class has a destroy method that is the formal destructor, some methods may also act as destructors\&. For example, a method that sends an object may also destroy the object (so that ownership of any buffers can passed to background threads)\&. Such methods take the same "pointer to a reference" argument as the destroy method\&. -.RE -.SS "Naming Style" -.sp -CZMQ aims for short, consistent names, following the theory that names we use most often should be shortest\&. Classes get one\-word names, unless they are part of a family of classes in which case they may be two words, the first being the family name\&. Methods, similarly, get one\-word names and we aim for consistency across classes (so a method that does something semantically similar in two classes will get the same name in both)\&. So the canonical name for any method is: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zclassname_methodname -.fi -.if n \{\ -.RE -.\} -.sp -And the reader can easily parse this without needing special syntax to separate the class name from the method name\&. -.SS "Containers" -.sp -After a long experiment with containers, we\(cqve decided that we need exactly two containers: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A singly\-linked list\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A hash table using text keys\&. -.RE -.sp -These are zlist and zhash, respectively\&. Both store void pointers, with no attempt to manage the details of contained objects\&. You can use these containers to create lists of lists, hashes of lists, hashes of hashes, etc\&. -.sp -We assume that at some point we\(cqll need to switch to a doubly\-linked list\&. -.SS "Portability" -.sp -Creating a portable C application can be rewarding in terms of maintaining a single code base across many platforms, and keeping (expensive) system\-specific knowledge separate from application developers\&. In most projects (like \(/OMQ core), there is no portability layer and application code does conditional compilation for all mixes of platforms\&. This leads to quite messy code\&. -.sp -czmq acts as a portability layer, similar to but thinner than libraries like the [Apache Portable Runtime](\m[blue]\fBhttp://apr\&.apache\&.org\fR\m[]) (APR)\&. -.sp -These are the places a C application is subject to arbitrary system differences: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Different compilers may offer slightly different variants of the C language, often lacking specific types or using neat non\-portable names\&. Windows is a big culprit here\&. We solve this by -\fIpatching\fR -the language in czmq_prelude\&.h, e\&.g\&. defining int64_t on Windows\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System header files are inconsistent, i\&.e\&. you need to include different files depending on the OS type and version\&. We solve this by pulling in all necessary header files in czmq_prelude\&.h\&. This is a proven brute\-force approach that increases recompilation times but eliminates a major source of pain\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System libraries are inconsistent, i\&.e\&. you need to link with different libraries depending on the OS type and version\&. We solve this with an external compilation tool, -\fIC\fR, which detects the OS type and version (at runtime) and builds the necessary link commands\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System functions are inconsistent, i\&.e\&. you need to call different functions depending, again, on OS type and version\&. We solve this by building small abstract classes that handle specific areas of functionality, and doing conditional compilation in these\&. -.RE -.sp -An example of the last: -.sp -.if n \{\ -.RS 4 -.\} -.nf - #if (defined (__UNIX__)) - pid = GetCurrentProcessId(); - #elif (defined (__WINDOWS__)) - pid = getpid (); - #else - pid = 0; - #endif -.fi -.if n \{\ -.RE -.\} -.sp -CZMQ uses the GNU autotools system, so non\-portable code can use the macros this defines\&. It can also use macros defined by the czmq_prelude\&.h header file\&. -.SS "Technical Aspects" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBThread safety\fR: the use of opaque structures is thread safe, though \(/OMQ applications should not share state between threads in any case\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBName spaces\fR: we prefix class names with -z, which ensures that all exported functions are globally safe\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBLibrary versioning\fR: we don\(cqt make any attempt to version the library at this stage\&. Classes are in our experience highly stable once they are built and tested, the only changes typically being added methods\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBPerformance\fR: for critical path processing, you may want to avoid creating and destroying classes\&. However on modern Linux systems the heap allocator is very fast\&. Individual classes can choose whether or not to nullify their data on allocation\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBSelf\-testing\fR: every class has a -selftest -method that runs through the methods of the class\&. In theory, calling all selftest functions of all classes does a full unit test of the library\&. The -czmq_selftest -application does this\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBMemory management\fR: CZMQ classes do not use any special memory management techiques to detect leaks\&. We\(cqve done this in the past but it makes the code relatively complex\&. Instead, we do memory leak testing using tools like valgrind\&. -.RE -.SH "UNDER THE HOOD" -.SS "Adding a New Class" -.sp -If you define a new CZMQ class myclass you need to: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Write the -zmyclass\&.c -and -zmyclass\&.h -source files, in -src -and -include -respectively\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add`#include ` to -include/czmq\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add the myclass header and test call to -src/czmq_selftest\&.c\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add a reference documentation to -\fIdoc/zmyclass\&.txt\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add myclass to \*(Aqsrc/Makefile\&.am` and -doc/Makefile\&.am\&. -.RE -.sp -The bin/newclass\&.sh shell script will automate these steps for you\&. -.SS "Coding Style" -.sp -In general the zctx class defines the style for the whole library\&. The overriding rules for coding style are consistency, clarity, and ease of maintenance\&. We use the C99 standard for syntax including principally: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The // comment style\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Variables definitions placed in or before the code that uses them\&. -.RE -.sp -So while ANSI C code might say: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zblob_t *file_buffer; /* Buffer for our file */ - \&.\&.\&. (100 lines of code) - file_buffer = zblob_new (); - \&.\&.\&. -.fi -.if n \{\ -.RE -.\} -.sp -The style in CZMQ would be: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zblob_t *file_buffer = zblob_new (); -.fi -.if n \{\ -.RE -.\} -.SS "Assertions" -.sp -We use assertions heavily to catch bad argument values\&. The CZMQ classes do not attempt to validate arguments and report errors; bad arguments are treated as fatal application programming errors\&. -.sp -We also use assertions heavily on calls to system functions that are never supposed to fail, where failure is to be treated as a fatal non\-recoverable error (e\&.g\&. running out of memory)\&. -.sp -Assertion code should always take this form: -.sp -.if n \{\ -.RS 4 -.\} -.nf - int rc = some_function (arguments); - assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -Rather than the side\-effect form: -.sp -.if n \{\ -.RS 4 -.\} -.nf - assert (some_function (arguments) == 0); -.fi -.if n \{\ -.RE -.\} -.sp -Since assertions may be removed by an optimizing compiler\&. -.SS "Documentation" -.sp -Man pages are generated from the class header and source files via the doc/mkman tool, and similar functionality in the gitdown tool (\m[blue]\fBhttp://github\&.com/imatix/gitdown\fR\m[])\&. The header file for a class must wrap its interface as follows (example is from include/zclock\&.h): -.sp -.if n \{\ -.RS 4 -.\} -.nf - // @interface - // Sleep for a number of milliseconds - void - zclock_sleep (int msecs); - - // Return current system clock as milliseconds - int64_t - zclock_time (void); - - // Self test of this class - int - zclock_test (Bool verbose); - // @end -.fi -.if n \{\ -.RE -.\} -.sp -The source file for a class must provide documentation as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf - /* - @header - \&.\&.\&.short explanation of class\&.\&.\&. - @discuss - \&.\&.\&.longer discussion of how it works\&.\&.\&. - @end - */ -.fi -.if n \{\ -.RE -.\} -.sp -The source file for a class then provides the self test example as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf - // @selftest - int64_t start = zclock_time (); - zclock_sleep (10); - assert ((zclock_time () \- start) >= 10); - // @end -.fi -.if n \{\ -.RE -.\} -.sp -The template for man pages is in doc/mkman\&. -.SS "Development" -.sp -CZMQ is developed through a test\-driven process that guarantees no memory violations or leaks in the code: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Modify a class or method\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Update the test method for that class\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Run the -\fIselftest\fR -script, which uses the Valgrind memcheck tool\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Repeat until perfect\&. -.RE -.SS "Porting CZMQ" -.sp -When you try CZMQ on an OS that it\(cqs not been used on (ever, or for a while), you will hit code that does not compile\&. In some cases the patches are trivial, in other cases (usually when porting to Windows), the work needed to build equivalent functionality may be quite heavy\&. In any case, the benefit is that once ported, the functionality is available to all applications\&. -.sp -Before attempting to patch code for portability, please read the czmq_prelude\&.h header file\&. There are several typical types of changes you may need to make to get functionality working on a specific operating system: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Defining typedefs which are missing on that specific compiler: do this in czmq_prelude\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Defining macros that rename exotic library functions to more conventional names: do this in czmq_prelude\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Reimplementing specific methods to use a non\-standard API: this is typically needed on Windows\&. Do this in the relevant class, using #ifdefs to properly differentiate code for different platforms\&. -.RE -.sp -The canonical \fIstandard operating system\fR for all CZMQ code is Linux, gcc, POSIX\&. -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man7/zmq.7 b/external/zmq/share/man/man7/zmq.7 deleted file mode 100644 index a4e404aa57..0000000000 --- a/external/zmq/share/man/man7/zmq.7 +++ /dev/null @@ -1,246 +0,0 @@ -'\" t -.\" Title: zmq -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq \- 0MQ lightweight messaging kernel -.SH "SYNOPSIS" -.sp -\fB#include \fR -.sp -\fBcc\fR [\fIflags\fR] \fIfiles\fR \fB\-lzmq\fR [\fIlibraries\fR] -.SH "DESCRIPTION" -.sp -The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised \fImessaging middleware\fR products\&. 0MQ sockets provide an abstraction of asynchronous \fImessage queues\fR, multiple \fImessaging patterns\fR, message filtering (\fIsubscriptions\fR), seamless access to multiple \fItransport protocols\fR and more\&. -.sp -This documentation presents an overview of 0MQ concepts, describes how 0MQ abstracts standard sockets and provides a reference manual for the functions provided by the 0MQ library\&. -.SS "Context" -.sp -Before using any 0MQ library functions you must create a 0MQ \fIcontext\fR\&. When you exit your application you must destroy the \fIcontext\fR\&. These functions let you work with \fIcontexts\fR: -.PP -Create a new 0MQ context -.RS 4 -\fBzmq_ctx_new\fR(3) -.RE -.PP -Work with context properties -.RS 4 -\fBzmq_ctx_set\fR(3)\fBzmq_ctx_get\fR(3) -.RE -.PP -Destroy a 0MQ context -.RS 4 -\fBzmq_ctx_shutdown\fR(3)\fBzmq_ctx_term\fR(3) -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBThread safety\fR -.RS 4 -.sp -A 0MQ \fIcontext\fR is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. -.sp -Individual 0MQ \fIsockets\fR are \fInot\fR thread safe except in the case where full memory barriers are issued when migrating a socket from one thread to another\&. In practice this means applications can create a socket in one thread with \fIzmq_socket()\fR and then pass it to a \fInewly created\fR thread as part of thread initialization, for example via a structure passed as an argument to \fIpthread_create()\fR\&. -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBMultiple contexts\fR -.RS 4 -.sp -Multiple \fIcontexts\fR may coexist within a single application\&. Thus, an application can use 0MQ directly and at the same time make use of any number of additional libraries or components which themselves make use of 0MQ as long as the above guidelines regarding thread safety are adhered to\&. -.RE -.SS "Messages" -.sp -A 0MQ message is a discrete unit of data passed between applications or components of the same application\&. 0MQ messages have no internal structure and from the point of view of 0MQ itself they are considered to be opaque binary data\&. -.sp -The following functions are provided to work with messages: -.PP -Initialise a message -.RS 4 -\fBzmq_msg_init\fR(3)\fBzmq_msg_init_size\fR(3)\fBzmq_msg_init_data\fR(3) -.RE -.PP -Sending and receiving a message -.RS 4 -\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3) -.RE -.PP -Release a message -.RS 4 -\fBzmq_msg_close\fR(3) -.RE -.PP -Access message content -.RS 4 -\fBzmq_msg_data\fR(3)\fBzmq_msg_size\fR(3)\fBzmq_msg_more\fR(3) -.RE -.PP -Work with message properties -.RS 4 -\fBzmq_msg_gets\fR(3)\fBzmq_msg_get\fR(3)\fBzmq_msg_set\fR(3) -.RE -.PP -Message manipulation -.RS 4 -\fBzmq_msg_copy\fR(3)\fBzmq_msg_move\fR(3) -.RE -.SS "Sockets" -.sp -0MQ sockets present an abstraction of a asynchronous \fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. See \fBzmq_socket\fR(3) for the socket types provided\&. -.sp -The following functions are provided to work with sockets: -.PP -Creating a socket -.RS 4 -\fBzmq_socket\fR(3) -.RE -.PP -Closing a socket -.RS 4 -\fBzmq_close\fR(3) -.RE -.PP -Manipulating socket options -.RS 4 -\fBzmq_getsockopt\fR(3)\fBzmq_setsockopt\fR(3) -.RE -.PP -Establishing a message flow -.RS 4 -\fBzmq_bind\fR(3)\fBzmq_connect\fR(3) -.RE -.PP -Sending and receiving messages -.RS 4 -\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3)\fBzmq_send\fR(3)\fBzmq_recv\fR(3)\fBzmq_send_const\fR(3) -.RE -.sp -Monitoring socket events: \fBzmq_socket_monitor\fR(3) -.PP -\fBInput/output multiplexing\fR. 0MQ provides a mechanism for applications to multiplex input/output events over a set containing both 0MQ sockets and standard sockets\&. This mechanism mirrors the standard -\fIpoll()\fR -system call, and is described in detail in -\fBzmq_poll\fR(3)\&. -.SS "Transports" -.sp -A 0MQ socket can use multiple different underlying transport mechanisms\&. Each transport mechanism is suited to a particular purpose and has its own advantages and drawbacks\&. -.sp -The following transport mechanisms are provided: -.PP -Unicast transport using TCP -.RS 4 -\fBzmq_tcp\fR(7) -.RE -.PP -Reliable multicast transport using PGM -.RS 4 -\fBzmq_pgm\fR(7) -.RE -.PP -Local inter\-process communication transport -.RS 4 -\fBzmq_ipc\fR(7) -.RE -.PP -Local in\-process (inter\-thread) communication transport -.RS 4 -\fBzmq_inproc\fR(7) -.RE -.SS "Proxies" -.sp -0MQ provides \fIproxies\fR to create fanout and fan\-in topologies\&. A proxy connects a \fIfrontend\fR socket to a \fIbackend\fR socket and switches all messages between the two sockets, opaquely\&. A proxy may optionally capture all traffic to a third socket\&. To start a proxy in an application thread, use \fBzmq_proxy\fR(3)\&. -.SS "Security" -.sp -A 0MQ socket can select a security mechanism\&. Both peers must use the same security mechanism\&. -.sp -The following security mechanisms are provided for IPC and TCP connections: -.PP -Null security -.RS 4 -\fBzmq_null\fR(7) -.RE -.PP -Plain\-text authentication using username and password -.RS 4 -\fBzmq_plain\fR(7) -.RE -.PP -Elliptic curve authentication and encryption -.RS 4 -\fBzmq_curve\fR(7) -.RE -.sp -Generate a CURVE keypair in armored text format: \fBzmq_curve_keypair\fR(3) -.sp -Convert an armored key into a 32\-byte binary key: \fBzmq_z85_decode\fR(3) -.sp -Convert a 32\-byte binary CURVE key to an armored text string: \fBzmq_z85_encode\fR(3) -.SH "ERROR HANDLING" -.sp -The 0MQ library functions handle errors using the standard conventions found on POSIX systems\&. Generally, this means that upon failure a 0MQ library function shall return either a NULL value (if returning a pointer) or a negative value (if returning an integer), and the actual error code shall be stored in the \fIerrno\fR variable\&. -.sp -On non\-POSIX systems some users may experience issues with retrieving the correct value of the \fIerrno\fR variable\&. The \fIzmq_errno()\fR function is provided to assist in these cases; for details refer to \fBzmq_errno\fR(3)\&. -.sp -The \fIzmq_strerror()\fR function is provided to translate 0MQ\-specific error codes into error message strings; for details refer to \fBzmq_strerror\fR(3)\&. -.SH "MISCELLANEOUS" -.sp -The following miscellaneous functions are provided: -.PP -Report 0MQ library version -.RS 4 -\fBzmq_version\fR(3) -.RE -.SH "LANGUAGE BINDINGS" -.sp -The 0MQ library provides interfaces suitable for calling from programs in any language; this documentation documents those interfaces as they would be used by C programmers\&. The intent is that programmers using 0MQ from other languages shall refer to this documentation alongside any documentation provided by the vendor of their language binding\&. -.sp -Language bindings (C++, Python, PHP, Ruby, Java and more) are provided by members of the 0MQ community and pointers can be found on the 0MQ website\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fBhttp://www\&.zeromq\&.org/\fR\m[] -.sp -Report bugs to the 0MQ development mailing list: <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYING" -.sp -Free use of this software is granted under the terms of the GNU Lesser General Public License (LGPL)\&. For details see the files COPYING and COPYING\&.LESSER included with the 0MQ distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/external/zmq/share/man/man7/zmq_curve.7 b/external/zmq/share/man/man7/zmq_curve.7 deleted file mode 100644 index e767266c9f..0000000000 --- a/external/zmq/share/man/man7/zmq_curve.7 +++ /dev/null @@ -1,93 +0,0 @@ -'\" t -.\" Title: zmq_curve -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_CURVE" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_curve \- secure authentication and confidentiality -.SH "SYNOPSIS" -.sp -The CURVE mechanism defines a mechanism for secure authentication and confidentiality for communications between a client and a server\&. CURVE is intended for use on public networks\&. The CURVE mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:25\fR\m[]\&. -.SH "CLIENT AND SERVER ROLES" -.sp -A socket using CURVE can be either client or server, at any moment, but not both\&. The role is independent of bind/connect direction\&. -.sp -A socket can change roles at any point by setting new options\&. The role affects all zmq_connect and zmq_bind calls that follow it\&. -.sp -To become a CURVE server, the application sets the ZMQ_CURVE_SERVER option on the socket, and then sets the ZMQ_CURVE_SECRETKEY option to provide the socket with its long\-term secret key\&. The application does not provide the socket with its long\-term public key, which is used only by clients\&. -.sp -To become a CURVE client, the application sets the ZMQ_CURVE_SERVERKEY option with the long\-term public key of the server it intends to connect to, or accept connections from, next\&. The application then sets the ZMQ_CURVE_PUBLICKEY and ZMQ_CURVE_SECRETKEY options with its client long\-term key pair\&. -.sp -If the server does authentication it will be based on the client\(cqs long term public key\&. -.SH "KEY ENCODING" -.sp -The standard representation for keys in source code is either 32 bytes of base 256 (binary) data, or 40 characters of base 85 data encoded using the Z85 algorithm defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]\&. -.sp -The Z85 algorithm is designed to produce printable key strings for use in configuration files, the command line, and code\&. There is a reference implementation in C at \m[blue]\fBhttps://github\&.com/zeromq/rfc/tree/master/src\fR\m[]\&. -.SH "TEST KEY VALUES" -.sp -For test cases, the client shall use this long\-term key pair (specified as hexadecimal and in Z85): -.sp -.if n \{\ -.RS 4 -.\} -.nf -public: - BB88471D65E2659B30C55A5321CEBB5AAB2B70A398645C26DCA2B2FCB43FC518 - Yne@$w\-vo}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7 - -secret: - 8E0BDD697628B91D8F245587EE95C5B04D48963F79259877B49CD9063AEAD3B7 - JTKVSB%%)wK0E\&.X)V>+}o?pNmC{O&4W4b!Ni{Lh6 -.fi -.if n \{\ -.RE -.\} -.SH "SEE ALSO" -.sp -\fBzmq_z85_encode\fR(3) \fBzmq_z85_decode\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_plain\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_inproc.7 b/external/zmq/share/man/man7/zmq_inproc.7 deleted file mode 100644 index d7e68d5218..0000000000 --- a/external/zmq/share/man/man7/zmq_inproc.7 +++ /dev/null @@ -1,103 +0,0 @@ -'\" t -.\" Title: zmq_inproc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_INPROC" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_inproc \- 0MQ local in\-process (inter\-thread) communication transport -.SH "SYNOPSIS" -.sp -The in\-process transport passes messages via memory directly between threads sharing a single 0MQ \fIcontext\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -No I/O threads are involved in passing messages using the \fIinproc\fR transport\&. Therefore, if you are using a 0MQ \fIcontext\fR for in\-process messaging only you can initialise the \fIcontext\fR with zero I/O threads\&. See \fBzmq_init\fR(3) for details\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the in\-process transport, the transport is inproc, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Assigning a local address to a socket" -.sp -When assigning a local address to a \fIsocket\fR using \fIzmq_bind()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to create\&. The \fIname\fR must be unique within the 0MQ \fIcontext\fR associated with the \fIsocket\fR and may be up to 256 characters in length\&. No other restrictions are placed on the format of the \fIname\fR\&. -.SS "Connecting a socket" -.sp -When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to connect to\&. The \fIname\fR must have been previously created by assigning it to at least one \fIsocket\fR within the same 0MQ \fIcontext\fR as the \fIsocket\fR being connected\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Assign the in\-process name "#1" -rc = zmq_bind(socket, "inproc://#1"); -assert (rc == 0); -// Assign the in\-process name "my\-endpoint" -rc = zmq_bind(socket, "inproc://my\-endpoint"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to the in\-process name "#1" -rc = zmq_connect(socket, "inproc://#1"); -assert (rc == 0); -// Connect to the in\-process name "my\-endpoint" -rc = zmq_connect(socket, "inproc://my\-endpoint"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_ipc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_ipc.7 b/external/zmq/share/man/man7/zmq_ipc.7 deleted file mode 100644 index 19cd5412c2..0000000000 --- a/external/zmq/share/man/man7/zmq_ipc.7 +++ /dev/null @@ -1,166 +0,0 @@ -'\" t -.\" Title: zmq_ipc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_IPC" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ipc \- 0MQ local inter\-process communication transport -.SH "SYNOPSIS" -.sp -The inter\-process transport passes messages between local processes using a system\-dependent IPC mechanism\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The inter\-process transport is currently only implemented on operating systems that provide UNIX domain sockets\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the inter\-process transport, the transport is ipc, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Binding a socket" -.sp -When binding a \fIsocket\fR to a local address using \fIzmq_bind()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to create\&. The \fIpathname\fR must be unique within the operating system namespace used by the \fIipc\fR implementation, and must fulfill any restrictions placed by the operating system on the format and length of a \fIpathname\fR\&. -.sp -When the address is *, \fIzmq_bind()\fR shall generate a unique temporary pathname\&. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -any existing binding to the same endpoint shall be overridden\&. That is, if a second process binds to an endpoint already bound by a process, this will succeed and the first process will lose its binding\&. In this behavior, the \fIipc\fR transport is not consistent with the \fItcp\fR or \fIinproc\fR transports\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -the endpoint pathname must be writable by the process\&. When the endpoint starts with \fI/\fR, e\&.g\&., ipc:///pathname, this will be an \fIabsolute\fR pathname\&. If the endpoint specifies a directory that does not exist, the bind shall fail\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -on Linux only, when the endpoint pathname starts with @, the abstract namespace shall be used\&. The abstract namespace is independent of the filesystem and if a process attempts to bind an endpoint already bound by a process, it will fail\&. See unix(7) for details\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -IPC pathnames have a maximum size that depends on the operating system\&. On Linux, the maximum is 113 characters including the "ipc://" prefix (107 characters for the real path name)\&. -.sp .5v -.RE -.SS "Unbinding wild\-card address from a socket" -.sp -When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoind\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. -.SS "Connecting a socket" -.sp -When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to connect to\&. The \fIpathname\fR must have been previously created within the operating system namespace by assigning it to a \fIsocket\fR with \fIzmq_bind()\fR\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Assign the pathname "/tmp/feeds/0" -rc = zmq_bind(socket, "ipc:///tmp/feeds/0"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to the pathname "/tmp/feeds/0" -rc = zmq_connect(socket, "ipc:///tmp/feeds/0"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_inproc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_getsockopt\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_null.7 b/external/zmq/share/man/man7/zmq_null.7 deleted file mode 100644 index fc3f130a7b..0000000000 --- a/external/zmq/share/man/man7/zmq_null.7 +++ /dev/null @@ -1,40 +0,0 @@ -'\" t -.\" Title: zmq_null -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_NULL" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_null \- no security or confidentiality -.SH "SYNOPSIS" -.sp -The NULL mechanism is defined by the ZMTP 3\&.0 specification: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:23\fR\m[]\&. This is the default security mechanism for ZeroMQ sockets\&. -.SH "SEE ALSO" -.sp -\fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_pgm.7 b/external/zmq/share/man/man7/zmq_pgm.7 deleted file mode 100644 index a247530820..0000000000 --- a/external/zmq/share/man/man7/zmq_pgm.7 +++ /dev/null @@ -1,200 +0,0 @@ -'\" t -.\" Title: zmq_pgm -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_PGM" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_pgm \- 0MQ reliable multicast transport using PGM -.SH "SYNOPSIS" -.sp -PGM (Pragmatic General Multicast) is a protocol for reliable multicast transport of data over IP networks\&. -.SH "DESCRIPTION" -.sp -0MQ implements two variants of PGM, the standard protocol where PGM datagrams are layered directly on top of IP datagrams as defined by RFC 3208 (the \fIpgm\fR transport) and "Encapsulated PGM" or EPGM where PGM datagrams are encapsulated inside UDP datagrams (the \fIepgm\fR transport)\&. -.sp -The \fIpgm\fR and \fIepgm\fR transports can only be used with the \fIZMQ_PUB\fR and \fIZMQ_SUB\fR socket types\&. -.sp -Further, PGM sockets are rate limited by default\&. For details, refer to the \fIZMQ_RATE\fR, and \fIZMQ_RECOVERY_IVL\fR options documented in \fBzmq_setsockopt\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The \fIpgm\fR transport implementation requires access to raw IP sockets\&. Additional privileges may be required on some operating systems for this operation\&. Applications not requiring direct interoperability with other PGM implementations are encouraged to use the \fIepgm\fR transport instead which does not require any special privileges\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the PGM transport, the transport is pgm, and for the EPGM protocol the transport is epgm\&. The meaning of the \fIaddress\fR part is defined below\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIpgm\fR or \fIepgm\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a semicolon, followed by a \fImulticast address\fR, followed by a colon and a port number\&. -.sp -An \fIinterface\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The interface name as defined by the operating system\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The primary IPv4 address assigned to the interface, in its numeric representation\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Interface names are not standardised in any way and should be assumed to be arbitrary and platform dependent\&. On Win32 platforms no short interface names exist, thus only the primary IPv4 address may be used to specify an \fIinterface\fR\&. The \fIinterface\fR part can be omitted, in that case the default one will be selected\&. -.sp .5v -.RE -.sp -A \fImulticast address\fR is specified by an IPv4 multicast address in its numeric representation\&. -.SH "WIRE FORMAT" -.sp -Consecutive PGM datagrams are interpreted by 0MQ as a single continuous stream of data where 0MQ messages are not necessarily aligned with PGM datagram boundaries and a single 0MQ message may span several PGM datagrams\&. This stream of data consists of 0MQ messages encapsulated in \fIframes\fR as described in \fBzmq_tcp\fR(7)\&. -.SS "PGM datagram payload" -.sp -The following ABNF grammar represents the payload of a single PGM datagram as used by 0MQ: -.sp -.if n \{\ -.RS 4 -.\} -.nf -datagram = (offset data) -offset = 2OCTET -data = *OCTET -.fi -.if n \{\ -.RE -.\} -.sp -In order for late joining consumers to be able to identify message boundaries, each PGM datagram payload starts with a 16\-bit unsigned integer in network byte order specifying either the offset of the first message \fIframe\fR in the datagram or containing the value 0xFFFF if the datagram contains solely an intermediate part of a larger message\&. -.sp -Note that offset specifies where the first message begins rather than the first message part\&. Thus, if there are trailing message parts at the beginning of the packet the offset ignores them and points to first initial message part in the packet\&. -.sp -The following diagram illustrates the layout of a single PGM datagram payload: -.sp -.if n \{\ -.RS 4 -.\} -.nf -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| offset (16 bits) | data | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.sp -The following diagram further illustrates how three example 0MQ frames are laid out in consecutive PGM datagram payloads: -.sp -.if n \{\ -.RS 4 -.\} -.nf -First datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 1 | Frame 2, part 1 | -| 0x0000 | (Message 1) | (Message 2, part 1) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ - -Second datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 2, part 2 | -| 0xFFFF | (Message 2, part 2) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ - -Third datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 2, final 8 bytes | Frame 3 | -| 0x0008 | (Message 2, final 8 bytes) | (Message 3) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, -// using the first Ethernet network interface on Linux -// and the Encapsulated PGM protocol -rc = zmq_connect(socket, "epgm://eth0;239\&.192\&.1\&.1:5555"); -assert (rc == 0); -// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, -// using the network interface with the address 192\&.168\&.1\&.1 -// and the standard PGM protocol -rc = zmq_connect(socket, "pgm://192\&.168\&.1\&.1;239\&.192\&.1\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_plain.7 b/external/zmq/share/man/man7/zmq_plain.7 deleted file mode 100644 index 831551b574..0000000000 --- a/external/zmq/share/man/man7/zmq_plain.7 +++ /dev/null @@ -1,43 +0,0 @@ -'\" t -.\" Title: zmq_plain -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_PLAIN" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_plain \- clear\-text authentication -.SH "SYNOPSIS" -.sp -The PLAIN mechanism defines a simple username/password mechanism that lets a server authenticate a client\&. PLAIN makes no attempt at security or confidentiality\&. It is intended for use on internal networks where security requirements are low\&. The PLAIN mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:24\fR\m[]\&. -.SH "USAGE" -.sp -To use PLAIN, the server shall set the ZMQ_PLAIN_SERVER option, and the client shall set the ZMQ_PLAIN_USERNAME and ZMQ_PLAIN_PASSWORD socket options\&. Which peer binds, and which connects, is not relevant\&. -.SH "SEE ALSO" -.sp -\fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_tcp.7 b/external/zmq/share/man/man7/zmq_tcp.7 deleted file mode 100644 index 22a8288809..0000000000 --- a/external/zmq/share/man/man7/zmq_tcp.7 +++ /dev/null @@ -1,188 +0,0 @@ -'\" t -.\" Title: zmq_tcp -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_TCP" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_tcp \- 0MQ unicast transport using TCP -.SH "SYNOPSIS" -.sp -TCP is an ubiquitous, reliable, unicast transport\&. When connecting distributed applications over a network with 0MQ, using the TCP transport will likely be your first choice\&. -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the TCP transport, the transport is tcp, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Assigning a local address to a socket" -.sp -When assigning a local address to a socket using \fIzmq_bind()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the TCP port number to use\&. -.sp -An \fIinterface\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning all available interfaces\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The primary IPv4 or IPv6 address assigned to the interface, in its numeric representation\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The non\-portable interface name as defined by the operating system\&. -.RE -.sp -The TCP port number may be specified by: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A numeric value, usually above 1024 on POSIX systems\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning a system\-assigned ephemeral port\&. -.RE -.sp -When using ephemeral ports, the caller should retrieve the actual assigned port using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. -.SS "Unbinding wild\-card addres from a socket" -.sp -When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoind\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the TCP port number to use\&. You can optionally specify a \fIsource_endpoint\fR which will be used as the source address for your connection; tcp://\fIsource_endpoint\fR;\*(Aqendpoint\*(Aq, see the \fIinterface\fR description above for details\&. -.sp -A \fIpeer address\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The DNS name of the peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The IPv4 or IPv6 address of the peer, in its numeric representation\&. -.RE -.sp -Note: A description of the ZeroMQ Message Transport Protocol (ZMTP) which is used by the TCP transport can be found at \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:15\fR\m[] -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// TCP port 5555 on all available interfaces -rc = zmq_bind(socket, "tcp://*:5555"); -assert (rc == 0); -// TCP port 5555 on the local loop\-back interface on all platforms -rc = zmq_bind(socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -// TCP port 5555 on the first Ethernet network interface on Linux -rc = zmq_bind(socket, "tcp://eth0:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting using an IP address -rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.1:5555"); -assert (rc == 0); -// Connecting using a DNS name -rc = zmq_connect(socket, "tcp://server1:5555"); -assert (rc == 0); -// Connecting using a DNS name and bind to eth1 -rc = zmq_connect(socket, "tcp://eth1:0;server1:5555"); -assert (rc == 0); -// Connecting using a IP address and bind to an IP address -rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.17:5555;192\&.168\&.1\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/external/zmq/share/man/man7/zmq_tipc.7 b/external/zmq/share/man/man7/zmq_tipc.7 deleted file mode 100644 index dfcb62a271..0000000000 --- a/external/zmq/share/man/man7/zmq_tipc.7 +++ /dev/null @@ -1,106 +0,0 @@ -'\" t -.\" Title: zmq_tipc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 09/14/2016 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.1.5 -.\" Language: English -.\" -.TH "ZMQ_TIPC" "7" "09/14/2016" "0MQ 4\&.1\&.5" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_tipc \- 0MQ unicast transport using TIPC -.SH "SYNOPSIS" -.sp -TIPC is a cluster IPC protocol with a location transparent addressing scheme\&. -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the TIPC transport, the transport is tipc, and the meaning of the \fIaddress\fR part is defined below\&. -.sp -Assigning a port name to a socket -.sp -.if n \{\ -.RS 4 -.\} -.nf -When assigning a port name to a socket using _zmq_bind()_ with the \*(Aqtipc\*(Aq -transport, the \*(Aqendpoint\*(Aq is defined in the form: -{type, lower, upper} - -* Type is the numerical (u32) ID of your service\&. -* Lower and Upper specify a range for your service\&. - -Publishing the same service with overlapping lower/upper ID\*(Aqs will -cause connection requests to be distributed over these in a round\-robin -manner\&. - - -Connecting a socket -.fi -.if n \{\ -.RE -.\} -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItipc\fR transport, the \fIendpoint\fR shall be interpreted as a service ID, followed by a comma and the instance ID\&. -.sp -The instance ID must be within the lower/upper range of a published port name for the endpoint to be valid\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Publish TIPC service ID 5555 -rc = zmq_bind(socket, "tipc://{5555,0,0}"); -assert (rc == 0); -// Publish TIPC service ID 5555 with a service range of 0\-100 -rc = zmq_bind(socket, "tipc://{5555,0,100}"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to service 5555 instance id 50 -rc = zmq_connect(socket, "tipc://{5555,50}"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/lgtm.yml b/lgtm.yml index 5b6cbce54b..7401ae26e1 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -15,4 +15,3 @@ extraction: index: filters: - exclude: "*" - diff --git a/opendbc b/opendbc index f1e69a6cf9..e4d5dcfe7e 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit f1e69a6cf91cdaf1b8008d73f6fbb6634fbbeb42 +Subproject commit e4d5dcfe7e4275ab4dcf22f45eaf85b26dbf4a04 diff --git a/phonelibs/capnp-cpp/.DS_Store b/phonelibs/capnp-cpp/.DS_Store deleted file mode 100644 index 5008ddfcf5..0000000000 Binary files a/phonelibs/capnp-cpp/.DS_Store and /dev/null differ diff --git a/phonelibs/capnp-cpp/build.txt b/phonelibs/capnp-cpp/build.txt deleted file mode 100644 index 4741227647..0000000000 --- a/phonelibs/capnp-cpp/build.txt +++ /dev/null @@ -1,18 +0,0 @@ -# on phone - -curl -O https://capnproto.org/capnproto-c++-0.6.1.tar.gz -tar xvf capnproto-c++-0.6.1.tar.gz -cd capnproto-c++-0.6.1 -CC=clang CXX=clang++ ./configure --prefix=/usr -make -j4 -cp .libs/libcapnp.a .libs/libkj.a phonelibs/capnp-cpp/aarch64/lib - - -# manually build binaries statically - -clang++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -O2 -DNDEBUG -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a - -clang++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -O2 -DNDEBUG -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a - -clang++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -O2 -DNDEBUG -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a - diff --git a/phonelibs/capnp-cpp/build_arm.sh b/phonelibs/capnp-cpp/build_arm.sh deleted file mode 100644 index da8c71c15e..0000000000 --- a/phonelibs/capnp-cpp/build_arm.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -e - -NDK=/opt/android-ndk -SYSROOT=/opt/android-ndk/platforms/android-23/arch-arm - -LLVM_PATH=/opt/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin -TOOLS_PATH=/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin - -export CPP=/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-cpp -export AR=${TOOLS_PATH}/ar -export AS=${TOOLS_PATH}/as -export NM=${TOOLS_PATH}/nm -export CC=${LLVM_PATH}/clang -export CXX="${LLVM_PATH}/clang++ -target armv7-none-linux-androideabi -gcc-toolchain /opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64" -export LD=${TOOLS_PATH}/ld -export RANLIB=${TOOLS_PATH}/ranlib -export SED=gsed - -export CPPFLAGS="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include" - -export CFLAGS="-target armv7-none-linux-androideabi \ - -isystem ${SYSROOT}/usr/include \ - --sysroot=${SYSROOT} \ - -I${SYSROOT}/usr/include \ - -gcc-toolchain /opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 \ - -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" - -export CXXFLAGS="$CFLAGS -std=c++11 -stdlib=libstdc++ \ - -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include \ - -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include \ - -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/backward" - -export LDFLAGS="-target armv7-none-linux-androideabi \ - -gcc-toolchain /opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 \ - -L${SYSROOT}/usr/lib" - -# /opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a - -./configure --host=arm-linux-androideabi --disable-shared --with-external-capnp -make -j4 -# itll fail when it gets to libtool stuff... diff --git a/phonelibs/capnp-cpp/include/capnp/any.h b/phonelibs/capnp-cpp/include/capnp/any.h deleted file mode 100644 index 6df9dc8dc2..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/any.h +++ /dev/null @@ -1,1073 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ANY_H_ -#define CAPNP_ANY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "pointer-helpers.h" -#include "orphan.h" -#include "list.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -class InterfaceSchema; -class Orphanage; -class ClientHook; -class PipelineHook; -struct PipelineOp; -struct AnyPointer; - -struct AnyList { - AnyList() = delete; - - class Reader; - class Builder; -}; - -struct AnyStruct { - AnyStruct() = delete; - - class Reader; - class Builder; - class Pipeline; -}; - -template<> -struct List { - List() = delete; - - class Reader; - class Builder; -}; - -namespace _ { // private -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -} // namespace _ (private) - -// ======================================================================================= -// AnyPointer! - -enum class Equality { - NOT_EQUAL, - EQUAL, - UNKNOWN_CONTAINS_CAPS -}; - -kj::StringPtr KJ_STRINGIFY(Equality res); - -struct AnyPointer { - // Reader/Builder for the `AnyPointer` field type, i.e. a pointer that can point to an arbitrary - // object. - - AnyPointer() = delete; - - class Reader { - public: - typedef AnyPointer Reads; - - Reader() = default; - inline Reader(_::PointerReader reader): reader(reader) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType() const; - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() const { return getPointerType() == PointerType::STRUCT; } - inline bool isList() const { return getPointerType() == PointerType::LIST; } - inline bool isCapability() const { return getPointerType() == PointerType::CAPABILITY; } - - Equality equals(AnyPointer::Reader right); - bool operator==(AnyPointer::Reader right); - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - template - inline ReaderFor getAs() const; - // Valid for T = any generated struct type, interface type, List, Text, or Data. - - template - inline ReaderFor getAs(StructSchema schema) const; - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline ReaderFor getAs(ListSchema schema) const; - // Only valid for T = DynamicList. Requires `#include `. - - template - inline ReaderFor getAs(InterfaceSchema schema) const; - // Only valid for T = DynamicCapability. Requires `#include `. - -#if !CAPNP_LITE - kj::Own getPipelinedCap(kj::ArrayPtr ops) const; - // Used by RPC system to implement pipelining. Applications generally shouldn't use this - // directly. -#endif // !CAPNP_LITE - - private: - _::PointerReader reader; - friend struct AnyPointer; - friend class Orphanage; - friend class CapReaderContext; - friend struct _::PointerHelpers; - }; - - class Builder { - public: - typedef AnyPointer Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline Builder(_::PointerBuilder builder): builder(builder) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType(); - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() { return getPointerType() == PointerType::STRUCT; } - inline bool isList() { return getPointerType() == PointerType::LIST; } - inline bool isCapability() { return getPointerType() == PointerType::CAPABILITY; } - - inline Equality equals(AnyPointer::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyPointer::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - inline void clear(); - // Set to null. - - template - inline BuilderFor getAs(); - // Valid for T = any generated struct type, List, Text, or Data. - - template - inline BuilderFor getAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor getAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline BuilderFor getAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - template - inline BuilderFor initAs(); - // Valid for T = any generated struct type. - - template - inline BuilderFor initAs(uint elementCount); - // Valid for T = List, Text, or Data. - - template - inline BuilderFor initAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor initAs(ListSchema schema, uint elementCount); - // Only valid for T = DynamicList. Requires `#include `. - - inline AnyList::Builder initAsAnyList(ElementSize elementSize, uint elementCount); - // Note: Does not accept INLINE_COMPOSITE for elementSize. - - inline List::Builder initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount); - - inline AnyStruct::Builder initAsAnyStruct(uint16_t dataWordCount, uint16_t pointerCount); - - template - inline void setAs(ReaderFor value); - // Valid for ReaderType = T::Reader for T = any generated struct type, List, Text, Data, - // DynamicStruct, or DynamicList (the dynamic types require `#include `). - - template - inline void setAs(std::initializer_list>> list); - // Valid for T = List. - - template - inline void setCanonicalAs(ReaderFor value); - - inline void set(Reader value) { builder.copyFrom(value.reader); } - // Set to a copy of another AnyPointer. - - inline void setCanonical(Reader value) { builder.copyFrom(value.reader, true); } - - template - inline void adopt(Orphan&& orphan); - // Valid for T = any generated struct type, List, Text, Data, DynamicList, DynamicStruct, - // or DynamicValue (the dynamic types require `#include `). - - template - inline Orphan disownAs(); - // Valid for T = any generated struct type, List, Text, Data. - - template - inline Orphan disownAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline Orphan disownAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline Orphan disownAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - inline Orphan disown(); - // Disown without a type. - - inline Reader asReader() const { return Reader(builder.asReader()); } - inline operator Reader() const { return Reader(builder.asReader()); } - - private: - _::PointerBuilder builder; - friend class Orphanage; - friend class CapBuilderContext; - friend struct _::PointerHelpers; - }; - -#if !CAPNP_LITE - class Pipeline { - public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)) {} - inline explicit Pipeline(kj::Own&& hook): hook(kj::mv(hook)) {} - - Pipeline noop(); - // Just make a copy. - - Pipeline getPointerField(uint16_t pointerIndex); - // Deprecated. In the future, we should use .asAnyStruct.getPointerField. - - inline AnyStruct::Pipeline asAnyStruct(); - - kj::Own asCap(); - // Expect that the result is a capability and construct a pipelined version of it now. - - inline kj::Own releasePipelineHook() { return kj::mv(hook); } - // For use by RPC implementations. - - template ) == Kind::INTERFACE>> - inline operator T() { return T(asCap()); } - - private: - kj::Own hook; - kj::Array ops; - - inline Pipeline(kj::Own&& hook, kj::Array&& ops) - : hook(kj::mv(hook)), ops(kj::mv(ops)) {} - - friend class LocalClient; - friend class PipelineHook; - friend class AnyStruct::Pipeline; - }; -#endif // !CAPNP_LITE -}; - -template <> -class Orphan { - // An orphaned object of unknown type. - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder) - : builder(kj::mv(builder)) {} - - Orphan& operator=(Orphan&&) = default; - - template - inline Orphan(Orphan&& other): builder(kj::mv(other.builder)) {} - template - inline Orphan& operator=(Orphan&& other) { builder = kj::mv(other.builder); return *this; } - // Cast from typed orphan. - - // It's not possible to get an AnyPointer::{Reader,Builder} directly since there is no - // underlying pointer (the pointer would normally live in the parent, but this object is - // orphaned). It is possible, however, to request typed readers/builders. - - template - inline BuilderFor getAs(); - template - inline BuilderFor getAs(StructSchema schema); - template - inline BuilderFor getAs(ListSchema schema); - template - inline typename T::Client getAs(InterfaceSchema schema); - template - inline ReaderFor getAsReader() const; - template - inline ReaderFor getAsReader(StructSchema schema) const; - template - inline ReaderFor getAsReader(ListSchema schema) const; - template - inline typename T::Client getAsReader(InterfaceSchema schema) const; - - template - inline Orphan releaseAs(); - template - inline Orphan releaseAs(StructSchema schema); - template - inline Orphan releaseAs(ListSchema schema); - template - inline Orphan releaseAs(InterfaceSchema schema); - // Down-cast the orphan to a specific type. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend class Orphan; - friend class AnyPointer::Builder; -}; - -template struct AnyTypeFor_; -template <> struct AnyTypeFor_ { typedef AnyStruct Type; }; -template <> struct AnyTypeFor_ { typedef AnyList Type; }; - -template -using AnyTypeFor = typename AnyTypeFor_::Type; - -template -inline ReaderFor>> toAny(T&& value) { - return ReaderFor>>( - _::PointerHelpers>::getInternalReader(value)); -} -template -inline BuilderFor>> toAny(T&& value) { - return BuilderFor>>( - _::PointerHelpers>::getInternalBuilder(kj::mv(value))); -} - -template <> -struct List { - // Note: This cannot be used for a list of structs, since such lists are not encoded as pointer - // lists! Use List. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyPointer::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyPointer::Reader(reader.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::POINTER) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyPointer::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyPointer::Builder(builder.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; -}; - -class AnyStruct::Reader { -public: - typedef AnyStruct Reads; - - Reader() = default; - inline Reader(_::StructReader reader): _reader(reader) {} - - template ) == Kind::STRUCT>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} - - kj::ArrayPtr getDataSection() { - return _reader.getDataSectionAsBlob(); - } - List::Reader getPointerSection() { - return List::Reader(_reader.getPointerSectionAsList()); - } - - kj::Array canonicalize() { - return _reader.canonicalize(); - } - - Equality equals(AnyStruct::Reader right); - bool operator==(AnyStruct::Reader right); - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - template - ReaderFor as() const { - // T must be a struct type. - return typename T::Reader(_reader); - } -private: - _::StructReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyStruct::Builder { -public: - typedef AnyStruct Builds; - - inline Builder(decltype(nullptr)) {} - inline Builder(_::StructBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::STRUCT>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline kj::ArrayPtr getDataSection() { - return _builder.getDataSectionAsBlob(); - } - List::Builder getPointerSection() { - return List::Builder(_builder.getPointerSectionAsList()); - } - - inline Equality equals(AnyStruct::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyStruct::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - - template - BuilderFor as() { - // T must be a struct type. - return typename T::Builder(_builder); - } -private: - _::StructBuilder _builder; - friend class Orphanage; - friend class CapBuilderContext; -}; - -#if !CAPNP_LITE -class AnyStruct::Pipeline { -public: - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - inline explicit Pipeline(AnyPointer::Pipeline&& typeless) - : typeless(kj::mv(typeless)) {} - - inline AnyPointer::Pipeline getPointerField(uint16_t pointerIndex) { - // Return a new Promise representing a sub-object of the result. `pointerIndex` is the index - // of the sub-object within the pointer section of the result (the result must be a struct). - // - // TODO(perf): On GCC 4.8 / Clang 3.3, use rvalue qualifiers to avoid the need for copies. - // Also make `ops` into a Vector to optimize this. - return typeless.getPointerField(pointerIndex); - } - -private: - AnyPointer::Pipeline typeless; -}; -#endif // !CAPNP_LITE - -class List::Reader { -public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyStruct::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyStruct::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class List::Builder { -public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::INLINE_COMPOSITE) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyStruct::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyStruct::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - -private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class AnyList::Reader { -public: - typedef AnyList Reads; - - inline Reader(): _reader(ElementSize::VOID) {} - inline Reader(_::ListReader reader): _reader(reader) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _reader.getElementSize(); } - inline uint size() { return unbound(_reader.size() / ELEMENTS); } - - inline kj::ArrayPtr getRawBytes() { return _reader.asRawBytes(); } - - Equality equals(AnyList::Reader right); - bool operator==(AnyList::Reader right); - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template ReaderFor as() { - // T must be List. - return ReaderFor(_reader); - } -private: - _::ListReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyList::Builder { -public: - typedef AnyList Builds; - - inline Builder(decltype(nullptr)): _builder(ElementSize::VOID) {} - inline Builder(_::ListBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _builder.getElementSize(); } - inline uint size() { return unbound(_builder.size() / ELEMENTS); } - - Equality equals(AnyList::Reader right); - inline bool operator==(AnyList::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template BuilderFor as() { - // T must be List. - return BuilderFor(_builder); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - -private: - _::ListBuilder _builder; - - friend class Orphanage; -}; - -// ======================================================================================= -// Pipeline helpers -// -// These relate to capabilities, but we don't declare them in capability.h because generated code -// for structs needs to know about these, even in files that contain no interfaces. - -#if !CAPNP_LITE - -struct PipelineOp { - // Corresponds to rpc.capnp's PromisedAnswer.Op. - - enum Type { - NOOP, // for convenience - - GET_POINTER_FIELD - - // There may be other types in the future... - }; - - Type type; - union { - uint16_t pointerIndex; // for GET_POINTER_FIELD - }; -}; - -class PipelineHook { - // Represents a currently-running call, and implements pipelined requests on its result. - -public: - virtual kj::Own addRef() = 0; - // Increment this object's reference count. - - virtual kj::Own getPipelinedCap(kj::ArrayPtr ops) = 0; - // Extract a promised Capability from the results. - - virtual kj::Own getPipelinedCap(kj::Array&& ops); - // Version of getPipelinedCap() passing the array by move. May avoid a copy in some cases. - // Default implementation just calls the other version. - - template > - static inline kj::Own from(Pipeline&& pipeline); - -private: - template struct FromImpl; -}; - -#endif // !CAPNP_LITE - -// ======================================================================================= -// Inline implementation details - -inline MessageSize AnyPointer::Reader::targetSize() const { - return reader.targetSize().asPublic(); -} - -inline PointerType AnyPointer::Reader::getPointerType() const { - return reader.getPointerType(); -} - -template -inline ReaderFor AnyPointer::Reader::getAs() const { - return _::PointerHelpers::get(reader); -} - -inline MessageSize AnyPointer::Builder::targetSize() const { - return asReader().targetSize(); -} - -inline PointerType AnyPointer::Builder::getPointerType() { - return builder.getPointerType(); -} - -inline void AnyPointer::Builder::clear() { - return builder.clear(); -} - -template -inline BuilderFor AnyPointer::Builder::getAs() { - return _::PointerHelpers::get(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs() { - return _::PointerHelpers::init(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs(uint elementCount) { - return _::PointerHelpers::init(builder, elementCount); -} - -inline AnyList::Builder AnyPointer::Builder::initAsAnyList( - ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList(elementSize, bounded(elementCount) * ELEMENTS)); -} - -inline List::Builder AnyPointer::Builder::initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return List::Builder(builder.initStructList(bounded(elementCount) * ELEMENTS, - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -inline AnyStruct::Builder AnyPointer::Builder::initAsAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -template -inline void AnyPointer::Builder::setAs(ReaderFor value) { - return _::PointerHelpers::set(builder, value); -} - -template -inline void AnyPointer::Builder::setCanonicalAs(ReaderFor value) { - return _::PointerHelpers::setCanonical(builder, value); -} - -template -inline void AnyPointer::Builder::setAs( - std::initializer_list>> list) { - return _::PointerHelpers::set(builder, list); -} - -template -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - _::PointerHelpers::adopt(builder, kj::mv(orphan)); -} - -template -inline Orphan AnyPointer::Builder::disownAs() { - return _::PointerHelpers::disown(builder); -} - -inline Orphan AnyPointer::Builder::disown() { - return Orphan(builder.disown()); -} - -template <> struct ReaderFor_ { typedef AnyPointer::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyPointer::Builder Type; }; -template <> struct ReaderFor_ { typedef AnyStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyStruct::Builder Type; }; - -template <> -struct Orphanage::GetInnerReader { - static inline _::PointerReader apply(const AnyPointer::Reader& t) { - return t.reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::PointerBuilder apply(AnyPointer::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const AnyStruct::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(AnyStruct::Builder& t) { - return t._builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const AnyList::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(AnyList::Builder& t) { - return t._builder; - } -}; - -template -inline BuilderFor Orphan::getAs() { - return _::OrphanGetImpl::apply(builder); -} -template -inline ReaderFor Orphan::getAsReader() const { - return _::OrphanGetImpl::applyReader(builder); -} -template -inline Orphan Orphan::releaseAs() { - return Orphan(kj::mv(builder)); -} - -// Using AnyPointer as the template type should work... - -template <> -inline typename AnyPointer::Reader AnyPointer::Reader::getAs() const { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::getAs() { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::initAs() { - clear(); - return *this; -} -template <> -inline void AnyPointer::Builder::setAs(AnyPointer::Reader value) { - return builder.copyFrom(value.reader); -} -template <> -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - builder.adopt(kj::mv(orphan.builder)); -} -template <> -inline Orphan AnyPointer::Builder::disownAs() { - return Orphan(builder.disown()); -} -template <> -inline Orphan Orphan::releaseAs() { - return kj::mv(*this); -} - -namespace _ { // private - -// Specialize PointerHelpers for AnyPointer. - -template <> -struct PointerHelpers { - static inline AnyPointer::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Reader(reader); - } - static inline AnyPointer::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Builder(builder); - } - static inline void set(PointerBuilder builder, AnyPointer::Reader value) { - AnyPointer::Builder(builder).set(value); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::PointerReader getInternalReader(const AnyPointer::Reader& reader) { - return reader.reader; - } - static inline _::PointerBuilder getInternalBuilder(AnyPointer::Builder&& builder) { - return builder.builder; - } -}; - -template <> -struct PointerHelpers { - static inline AnyStruct::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyStruct::Reader(reader.getStruct(defaultValue)); - } - static inline AnyStruct::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - // TODO(someday): Allow specifying the size somehow? - return AnyStruct::Builder(builder.getStruct( - _::StructSize(ZERO * WORDS, ZERO * POINTERS), defaultValue)); - } - static inline void set(PointerBuilder builder, AnyStruct::Reader value) { - builder.setStruct(value._reader); - } - static inline AnyStruct::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct PointerHelpers { - static inline AnyList::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyList::Reader(reader.getListAnySize(defaultValue)); - } - static inline AnyList::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - return AnyList::Builder(builder.getListAnySize(defaultValue)); - } - static inline void set(PointerBuilder builder, AnyList::Reader value) { - builder.setList(value._reader); - } - static inline AnyList::Builder init( - PointerBuilder builder, ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList( - elementSize, bounded(elementCount) * ELEMENTS)); - } - static inline AnyList::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return AnyList::Builder(builder.initStructList( - bounded(elementCount) * ELEMENTS, - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyStruct::Builder apply(_::OrphanBuilder& builder) { - return AnyStruct::Builder(builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline AnyStruct::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyStruct::Reader(builder.asStructReader(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::StructSize(ZERO * WORDS, ZERO * POINTERS)); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyList::Builder apply(_::OrphanBuilder& builder) { - return AnyList::Builder(builder.asListAnySize()); - } - static inline AnyList::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyList::Reader(builder.asListReaderAnySize()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -} // namespace _ (private) - -#if !CAPNP_LITE - -template -struct PipelineHook::FromImpl { - static inline kj::Own apply(typename T::Pipeline&& pipeline) { - return from(kj::mv(pipeline._typeless)); - } -}; - -template <> -struct PipelineHook::FromImpl { - static inline kj::Own apply(AnyPointer::Pipeline&& pipeline) { - return kj::mv(pipeline.hook); - } -}; - -template -inline kj::Own PipelineHook::from(Pipeline&& pipeline) { - return FromImpl::apply(kj::fwd(pipeline)); -} - -#endif // !CAPNP_LITE - -} // namespace capnp - -#endif // CAPNP_ANY_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/blob.h b/phonelibs/capnp-cpp/include/capnp/blob.h deleted file mode 100644 index d11f101a5a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/blob.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_BLOB_H_ -#define CAPNP_BLOB_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include - -namespace capnp { - -struct Data { - Data() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -struct Text { - Text() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -class Data::Reader: public kj::ArrayPtr { - // Points to a blob of bytes. The usual Reader rules apply -- Data::Reader behaves like a simple - // pointer which does not own its target, can be passed by value, etc. - -public: - typedef Data Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Reader(const byte* value, size_t size): ArrayPtr(value, size) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} -}; - -class Text::Reader: public kj::StringPtr { - // Like Data::Reader, but points at NUL-terminated UTF-8 text. The NUL terminator is not counted - // in the size but must be present immediately after the last byte. - // - // Text::Reader's interface contract is that its data MUST be NUL-terminated. The producer of - // the Text::Reader must guarantee this, so that the consumer need not check. The data SHOULD - // also be valid UTF-8, but this is NOT guaranteed -- the consumer must verify if it cares. - -public: - typedef Text Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): StringPtr(nullptr) {} - inline Reader(const char* value): StringPtr(value) {} - inline Reader(const char* value, size_t size): StringPtr(value, size) {} - inline Reader(const kj::String& value): StringPtr(value) {} - inline Reader(const StringPtr& value): StringPtr(value) {} - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline Reader(const T& t): StringPtr(t) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif -}; - -class Data::Builder: public kj::ArrayPtr { - // Like Data::Reader except the pointers aren't const. - -public: - typedef Data Builds; - - Builder() = default; - inline Builder(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Builder(byte* value, size_t size): ArrayPtr(value, size) {} - inline Builder(kj::Array& value): ArrayPtr(value) {} - inline Builder(ArrayPtr value): ArrayPtr(value) {} - - inline Data::Reader asReader() const { return Data::Reader(*this); } - inline operator Reader() const { return asReader(); } -}; - -class Text::Builder: public kj::DisallowConstCopy { - // Basically identical to kj::StringPtr, except that the contents are non-const. - -public: - inline Builder(): content(nulstr, 1) {} - inline Builder(decltype(nullptr)): content(nulstr, 1) {} - inline Builder(char* value): content(value, strlen(value) + 1) {} - inline Builder(char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - - inline Reader asReader() const { return Reader(content.begin(), content.size() - 1); } - inline operator Reader() const { return asReader(); } - - inline operator kj::ArrayPtr(); - inline kj::ArrayPtr asArray(); - inline operator kj::ArrayPtr() const; - inline kj::ArrayPtr asArray() const; - inline kj::ArrayPtr asBytes() { return asArray().asBytes(); } - inline kj::ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline operator kj::StringPtr() const; - inline kj::StringPtr asString() const; - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - inline char& operator[](size_t index) { return content[index]; } - - inline char* begin() { return content.begin(); } - inline char* end() { return content.end() - 1; } - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(Builder other) const { return asString() == other.asString(); } - inline bool operator!=(Builder other) const { return asString() != other.asString(); } - inline bool operator< (Builder other) const { return asString() < other.asString(); } - inline bool operator> (Builder other) const { return asString() > other.asString(); } - inline bool operator<=(Builder other) const { return asString() <= other.asString(); } - inline bool operator>=(Builder other) const { return asString() >= other.asString(); } - - inline kj::StringPtr slice(size_t start) const; - inline kj::ArrayPtr slice(size_t start, size_t end) const; - inline Builder slice(size_t start); - inline kj::ArrayPtr slice(size_t start, size_t end); - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - -private: - inline explicit Builder(kj::ArrayPtr content): content(content) {} - - kj::ArrayPtr content; - - static char nulstr[1]; -}; - -inline kj::StringPtr KJ_STRINGIFY(Text::Builder builder) { - return builder.asString(); -} - -inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); } -inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); } - -inline Text::Builder::operator kj::StringPtr() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline kj::StringPtr Text::Builder::asString() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() { - return content.slice(0, content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline kj::StringPtr Text::Builder::slice(size_t start) const { - return asReader().slice(start); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline Text::Builder Text::Builder::slice(size_t start) { - return Text::Builder(content.slice(start, content.size())); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) { - return content.slice(start, end); -} - -} // namespace capnp - -#endif // CAPNP_BLOB_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/c++.capnp b/phonelibs/capnp-cpp/include/capnp/c++.capnp deleted file mode 100644 index 2bda547179..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/c++.capnp +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xbdf87d7bb8304e81; -$namespace("capnp::annotations"); - -annotation namespace(file): Text; -annotation name(field, enumerant, struct, enum, interface, method, param, group, union): Text; diff --git a/phonelibs/capnp-cpp/include/capnp/c++.capnp.h b/phonelibs/capnp-cpp/include/capnp/c++.capnp.h deleted file mode 100644 index 6d9817fbde..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/c++.capnp.h +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: c++.capnp - -#ifndef CAPNP_INCLUDED_bdf87d7bb8304e81_ -#define CAPNP_INCLUDED_bdf87d7bb8304e81_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(b9c6f99ebf805f2c); -CAPNP_DECLARE_SCHEMA(f264a779fef191ce); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace annotations { - -// ======================================================================================= - -// ======================================================================================= - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_bdf87d7bb8304e81_ diff --git a/phonelibs/capnp-cpp/include/capnp/c.capnp b/phonelibs/capnp-cpp/include/capnp/c.capnp deleted file mode 100644 index 5de7e7363a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/c.capnp +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2016 NetDEF, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xc0183dd65ffef0f3; - -annotation nameinfix @0x85a8d86d736ba637 (file): Text; -# add an infix (middle insert) for output file names -# -# "make" generally has implicit rules for compiling "foo.c" => "foo". This -# is very annoying with capnp since the rule will be "foo" => "foo.c", leading -# to a loop. $nameinfix (recommended parameter: "-gen") inserts its parameter -# before the ".c", so the filename becomes "foo-gen.c" -# -# ("foo" is really "foo.capnp", so it's foo.capnp-gen.c) - -annotation fieldgetset @0xf72bc690355d66de (file): Void; -# generate getter & setter functions for accessing fields -# -# allows grabbing/putting values without de-/encoding the entire struct. diff --git a/phonelibs/capnp-cpp/include/capnp/capability.h b/phonelibs/capnp-cpp/include/capnp/capability.h deleted file mode 100644 index 56a5e6f6de..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/capability.h +++ /dev/null @@ -1,884 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_CAPABILITY_H_ -#define CAPNP_CAPABILITY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "RPC APIs, including this header, are not available in lite mode." -#endif - -#include -#include -#include "raw-schema.h" -#include "any.h" -#include "pointer-helpers.h" - -namespace capnp { - -template -class Response; - -template -class RemotePromise: public kj::Promise>, public T::Pipeline { - // A Promise which supports pipelined calls. T is typically a struct type. T must declare - // an inner "mix-in" type "Pipeline" which implements pipelining; RemotePromise simply - // multiply-inherits that type along with Promise>. T::Pipeline must be movable, - // but does not need to be copyable (i.e. just like Promise). - // - // The promise is for an owned pointer so that the RPC system can allocate the MessageReader - // itself. - -public: - inline RemotePromise(kj::Promise>&& promise, typename T::Pipeline&& pipeline) - : kj::Promise>(kj::mv(promise)), - T::Pipeline(kj::mv(pipeline)) {} - inline RemotePromise(decltype(nullptr)) - : kj::Promise>(nullptr), - T::Pipeline(nullptr) {} - KJ_DISALLOW_COPY(RemotePromise); - RemotePromise(RemotePromise&& other) = default; - RemotePromise& operator=(RemotePromise&& other) = default; -}; - -class LocalClient; -namespace _ { // private -extern const RawSchema NULL_INTERFACE_SCHEMA; // defined in schema.c++ -class CapabilityServerSetBase; -} // namespace _ (private) - -struct Capability { - // A capability without type-safe methods. Typed capability clients wrap `Client` and typed - // capability servers subclass `Server` to dispatch to the regular, typed methods. - - class Client; - class Server; - - struct _capnpPrivate { - struct IsInterface; - static constexpr uint64_t typeId = 0x3; - static constexpr Kind kind = Kind::INTERFACE; - static constexpr _::RawSchema const* schema = &_::NULL_INTERFACE_SCHEMA; - - static const _::RawBrandedSchema* brand() { - return &_::NULL_INTERFACE_SCHEMA.defaultBrand; - } - }; -}; - -// ======================================================================================= -// Capability clients - -class RequestHook; -class ResponseHook; -class PipelineHook; -class ClientHook; - -template -class Request: public Params::Builder { - // A call that hasn't been sent yet. This class extends a Builder for the call's "Params" - // structure with a method send() that actually sends it. - // - // Given a Cap'n Proto method `foo(a :A, b :B): C`, the generated client interface will have - // a method `Request fooRequest()` (as well as a convenience method - // `RemotePromise foo(A::Reader a, B::Reader b)`). - -public: - inline Request(typename Params::Builder builder, kj::Own&& hook) - : Params::Builder(builder), hook(kj::mv(hook)) {} - inline Request(decltype(nullptr)): Params::Builder(nullptr) {} - - RemotePromise send() KJ_WARN_UNUSED_RESULT; - // Send the call and return a promise for the results. - -private: - kj::Own hook; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template -class Response: public Results::Reader { - // A completed call. This class extends a Reader for the call's answer structure. The Response - // is move-only -- once it goes out-of-scope, the underlying message will be freed. - -public: - inline Response(typename Results::Reader reader, kj::Own&& hook) - : Results::Reader(reader), hook(kj::mv(hook)) {} - -private: - kj::Own hook; - - template - friend class Request; - friend class ResponseHook; -}; - -class Capability::Client { - // Base type for capability clients. - -public: - typedef Capability Reads; - typedef Capability Calls; - - Client(decltype(nullptr)); - // If you need to declare a Client before you have anything to assign to it (perhaps because - // the assignment is going to occur in an if/else scope), you can start by initializing it to - // `nullptr`. The resulting client is not meant to be called and throws exceptions from all - // methods. - - template ()>> - Client(kj::Own&& server); - // Make a client capability that wraps the given server capability. The server's methods will - // only be executed in the given EventLoop, regardless of what thread calls the client's methods. - - template ()>> - Client(kj::Promise&& promise); - // Make a client from a promise for a future client. The resulting client queues calls until the - // promise resolves. - - Client(kj::Exception&& exception); - // Make a broken client that throws the given exception from all calls. - - Client(Client& other); - Client& operator=(Client& other); - // Copies by reference counting. Warning: This refcounting is not thread-safe. All copies of - // the client must remain in one thread. - - Client(Client&&) = default; - Client& operator=(Client&&) = default; - // Move constructor avoids reference counting. - - explicit Client(kj::Own&& hook); - // For use by the RPC implementation: Wrap a ClientHook. - - template - typename T::Client castAs(); - // Reinterpret the capability as implementing the given interface. Note that no error will occur - // here if the capability does not actually implement this interface, but later method calls will - // fail. It's up to the application to decide how indicate that additional interfaces are - // supported. - // - // TODO(perf): GCC 4.8 / Clang 3.3: rvalue-qualified version for better performance. - - template - typename T::Client castAs(InterfaceSchema schema); - // Dynamic version. `T` must be `DynamicCapability`, and you must `#include `. - - kj::Promise whenResolved(); - // If the capability is actually only a promise, the returned promise resolves once the - // capability itself has resolved to its final destination (or propagates the exception if - // the capability promise is rejected). This is mainly useful for error-checking in the case - // where no calls are being made. There is no reason to wait for this before making calls; if - // the capability does not resolve, the call results will propagate the error. - - Request typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - // Make a request without knowing the types of the params or results. You specify the type ID - // and method number manually. - - // TODO(someday): method(s) for Join - -protected: - Client() = default; - - template - Request newCall(uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - -private: - kj::Own hook; - - static kj::Own makeLocalClient(kj::Own&& server); - - template - friend struct _::PointerHelpers; - friend struct DynamicCapability; - friend class Orphanage; - friend struct DynamicStruct; - friend struct DynamicList; - template - friend struct List; - friend class _::CapabilityServerSetBase; - friend class ClientHook; -}; - -// ======================================================================================= -// Capability servers - -class CallContextHook; - -template -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - // - // The CallContext becomes invalid as soon as the call reports completion. - -public: - explicit CallContext(CallContextHook& hook); - - typename Params::Reader getParams(); - // Get the params payload. - - void releaseParams(); - // Release the params payload. getParams() will throw an exception after this is called. - // Releasing the params may allow the RPC system to free up buffer space to handle other - // requests. Long-running asynchronous methods should try to call this as early as is - // convenient. - - typename Results::Builder getResults(kj::Maybe sizeHint = nullptr); - typename Results::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(typename Results::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - // Manipulate the results payload. The "Return" message (part of the RPC protocol) will - // typically be allocated the first time one of these is called. Some RPC systems may - // allocate these messages in a limited space (such as a shared memory segment), therefore the - // application should delay calling these as long as is convenient to do so (but don't delay - // if doing so would require extra copies later). - // - // `sizeHint` indicates a guess at the message size. This will usually be used to decide how - // much space to allocate for the first message segment (don't worry: only space that is actually - // used will be sent on the wire). If omitted, the system decides. The message root pointer - // should not be included in the size. So, if you are simply going to copy some existing message - // directly into the results, just call `.totalSize()` and pass that in. - - template - kj::Promise tailCall(Request&& tailRequest); - // Resolve the call by making a tail call. `tailRequest` is a request that has been filled in - // but not yet sent. The context will send the call, then fill in the results with the result - // of the call. If tailCall() is used, {get,init,set,adopt}Results (above) *must not* be called. - // - // The RPC implementation may be able to optimize a tail call to another machine such that the - // results never actually pass through this machine. Even if no such optimization is possible, - // `tailCall()` may allow pipelined calls to be forwarded optimistically to the new call site. - // - // In general, this should be the last thing a method implementation calls, and the promise - // returned from `tailCall()` should then be returned by the method implementation. - - void allowCancellation(); - // Indicate that it is OK for the RPC system to discard its Promise for this call's result if - // the caller cancels the call, thereby transitively canceling any asynchronous operations the - // call implementation was performing. This is not done by default because it could represent a - // security risk: applications must be carefully written to ensure that they do not end up in - // a bad state if an operation is canceled at an arbitrary point. However, for long-running - // method calls that hold significant resources, prompt cancellation is often useful. - // - // Keep in mind that asynchronous cancellation cannot occur while the method is synchronously - // executing on a local thread. The method must perform an asynchronous operation or call - // `EventLoop::current().evalLater()` to yield control. - // - // Note: You might think that we should offer `onCancel()` and/or `isCanceled()` methods that - // provide notification when the caller cancels the request without forcefully killing off the - // promise chain. Unfortunately, this composes poorly with promise forking: the canceled - // path may be just one branch of a fork of the result promise. The other branches still want - // the call to continue. Promise forking is used within the Cap'n Proto implementation -- in - // particular each pipelined call forks the result promise. So, if a caller made a pipelined - // call and then dropped the original object, the call should not be canceled, but it would be - // excessively complicated for the framework to avoid notififying of cancellation as long as - // pipelined calls still exist. - -private: - CallContextHook* hook; - - friend class Capability::Server; - friend struct DynamicCapability; -}; - -class Capability::Server { - // Objects implementing a Cap'n Proto interface must subclass this. Typically, such objects - // will instead subclass a typed Server interface which will take care of implementing - // dispatchCall(). - -public: - typedef Capability Serves; - - virtual kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) = 0; - // Call the given method. `params` is the input struct, and should be released as soon as it - // is no longer needed. `context` may be used to allocate the output struct and deal with - // cancellation. - - // TODO(someday): Method which can optionally be overridden to implement Join when the object is - // a proxy. - -protected: - inline Capability::Client thisCap(); - // Get a capability pointing to this object, much like the `this` keyword. - // - // The effect of this method is undefined if: - // - No capability client has been created pointing to this object. (This is always the case in - // the server's constructor.) - // - The capability client pointing at this object has been destroyed. (This is always the case - // in the server's destructor.) - // - Multiple capability clients have been created around the same server (possible if the server - // is refcounted, which is not recommended since the client itself provides refcounting). - - template - CallContext internalGetTypedContext( - CallContext typeless); - kj::Promise internalUnimplemented(const char* actualInterfaceName, - uint64_t requestedTypeId); - kj::Promise internalUnimplemented(const char* interfaceName, - uint64_t typeId, uint16_t methodId); - kj::Promise internalUnimplemented(const char* interfaceName, const char* methodName, - uint64_t typeId, uint16_t methodId); - -private: - ClientHook* thisHook = nullptr; - friend class LocalClient; -}; - -// ======================================================================================= - -class ReaderCapabilityTable: private _::CapTableReader { - // Class which imbues Readers with the ability to read capabilities. - // - // In Cap'n Proto format, the encoding of a capability pointer is simply an integer index into - // an external table. Since these pointers fundamentally point outside the message, a - // MessageReader by default has no idea what they point at, and therefore reading capabilities - // from such a reader will throw exceptions. - // - // In order to be able to read capabilities, you must first attach a capability table, using - // this class. By "imbuing" a Reader, you get a new Reader which will interpret capability - // pointers by treating them as indexes into the ReaderCapabilityTable. - // - // Note that when using Cap'n Proto's RPC system, this is handled automatically. - -public: - explicit ReaderCapabilityTable(kj::Array>> table); - KJ_DISALLOW_COPY(ReaderCapabilityTable); - - template - T imbue(T reader); - // Return a reader equivalent to `reader` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Array>> table; - - kj::Maybe> extractCap(uint index) override; -}; - -class BuilderCapabilityTable: private _::CapTableBuilder { - // Class which imbues Builders with the ability to read and write capabilities. - // - // This is much like ReaderCapabilityTable, except for builders. The table starts out empty, - // but capabilities can be added to it over time. - -public: - BuilderCapabilityTable(); - KJ_DISALLOW_COPY(BuilderCapabilityTable); - - inline kj::ArrayPtr>> getTable() { return table; } - - template - T imbue(T builder); - // Return a builder equivalent to `builder` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Vector>> table; - - kj::Maybe> extractCap(uint index) override; - uint injectCap(kj::Own&& cap) override; - void dropCap(uint index) override; -}; - -// ======================================================================================= - -namespace _ { // private - -class CapabilityServerSetBase { -public: - Capability::Client addInternal(kj::Own&& server, void* ptr); - kj::Promise getLocalServerInternal(Capability::Client& client); -}; - -} // namespace _ (private) - -template -class CapabilityServerSet: private _::CapabilityServerSetBase { - // Allows a server to recognize its own capabilities when passed back to it, and obtain the - // underlying Server objects associated with them. - // - // All objects in the set must have the same interface type T. The objects may implement various - // interfaces derived from T (and in fact T can be `capnp::Capability` to accept all objects), - // but note that if you compile with RTTI disabled then you will not be able to down-cast through - // virtual inheritance, and all inheritance between server interfaces is virtual. So, with RTTI - // disabled, you will likely need to set T to be the most-derived Cap'n Proto interface type, - // and you server class will need to be directly derived from that, so that you can use - // static_cast (or kj::downcast) to cast to it after calling getLocalServer(). (If you compile - // with RTTI, then you can freely dynamic_cast and ignore this issue!) - -public: - CapabilityServerSet() = default; - KJ_DISALLOW_COPY(CapabilityServerSet); - - typename T::Client add(kj::Own&& server); - // Create a new capability Client for the given Server and also add this server to the set. - - kj::Promise> getLocalServer(typename T::Client& client); - // Given a Client pointing to a server previously passed to add(), return the corresponding - // Server. This returns a promise because if the input client is itself a promise, this must - // wait for it to resolve. Keep in mind that the server will be deleted when all clients are - // gone, so the caller should make sure to keep the client alive (hence why this method only - // accepts an lvalue input). -}; - -// ======================================================================================= -// Hook interfaces which must be implemented by the RPC system. Applications never call these -// directly; the RPC system implements them and the types defined earlier in this file wrap them. - -class RequestHook { - // Hook interface implemented by RPC system representing a request being built. - -public: - virtual RemotePromise send() = 0; - // Send the call and return a promise for the result. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this request. This can be used by an RPC adapter to - // discover when tail call is going to be sent over its own connection and therefore can be - // optimized into a remote tail call. - - template - inline static kj::Own from(Request&& request) { - return kj::mv(request.hook); - } -}; - -class ResponseHook { - // Hook interface implemented by RPC system representing a response. - // - // At present this class has no methods. It exists only for garbage collection -- when the - // ResponseHook is destroyed, the results can be freed. - -public: - virtual ~ResponseHook() noexcept(false); - // Just here to make sure the type is dynamic. - - template - inline static kj::Own from(Response&& response) { - return kj::mv(response.hook); - } -}; - -// class PipelineHook is declared in any.h because it is needed there. - -class ClientHook { -public: - ClientHook(); - - virtual Request newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) = 0; - // Start a new call, allowing the client to allocate request/response objects as it sees fit. - // This version is used when calls are made from application code in the local process. - - struct VoidPromiseAndPipeline { - kj::Promise promise; - kj::Own pipeline; - }; - - virtual VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId, - kj::Own&& context) = 0; - // Call the object, but the caller controls allocation of the request/response objects. If the - // callee insists on allocating these objects itself, it must make a copy. This version is used - // when calls come in over the network via an RPC system. Note that even if the returned - // `Promise` is discarded, the call may continue executing if any pipelined calls are - // waiting for it. - // - // Since the caller of this method chooses the CallContext implementation, it is the caller's - // responsibility to ensure that the returned promise is not canceled unless allowed via - // the context's `allowCancellation()`. - // - // The call must not begin synchronously; the callee must arrange for the call to begin in a - // later turn of the event loop. Otherwise, application code may call back and affect the - // callee's state in an unexpected way. - - virtual kj::Maybe getResolved() = 0; - // If this ClientHook is a promise that has already resolved, returns the inner, resolved version - // of the capability. The caller may permanently replace this client with the resolved one if - // desired. Returns null if the client isn't a promise or hasn't resolved yet -- use - // `whenMoreResolved()` to distinguish between them. - - virtual kj::Maybe>> whenMoreResolved() = 0; - // If this client is a settled reference (not a promise), return nullptr. Otherwise, return a - // promise that eventually resolves to a new client that is closer to being the final, settled - // client (i.e. the value eventually returned by `getResolved()`). Calling this repeatedly - // should eventually produce a settled client. - - kj::Promise whenResolved(); - // Repeatedly calls whenMoreResolved() until it returns nullptr. - - virtual kj::Own addRef() = 0; - // Return a new reference to the same capability. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this client. This can be used by an RPC adapter to - // discover when a capability it needs to marshal is one that it created in the first place, and - // therefore it can transfer the capability without proxying. - - static const uint NULL_CAPABILITY_BRAND; - // Value is irrelevant; used for pointer. - - inline bool isNull() { return getBrand() == &NULL_CAPABILITY_BRAND; } - // Returns true if the capability was created as a result of assigning a Client to null or by - // reading a null pointer out of a Cap'n Proto message. - - virtual void* getLocalServer(_::CapabilityServerSetBase& capServerSet); - // If this is a local capability created through `capServerSet`, return the underlying Server. - // Otherwise, return nullptr. Default implementation (which everyone except LocalClient should - // use) always returns nullptr. - - static kj::Own from(Capability::Client client) { return kj::mv(client.hook); } -}; - -class CallContextHook { - // Hook interface implemented by RPC system to manage a call on the server side. See - // CallContext. - -public: - virtual AnyPointer::Reader getParams() = 0; - virtual void releaseParams() = 0; - virtual AnyPointer::Builder getResults(kj::Maybe sizeHint) = 0; - virtual kj::Promise tailCall(kj::Own&& request) = 0; - virtual void allowCancellation() = 0; - - virtual kj::Promise onTailCall() = 0; - // If `tailCall()` is called, resolves to the PipelineHook from the tail call. An - // implementation of `ClientHook::call()` is allowed to call this at most once. - - virtual ClientHook::VoidPromiseAndPipeline directTailCall(kj::Own&& request) = 0; - // Call this when you would otherwise call onTailCall() immediately followed by tailCall(). - // Implementations of tailCall() should typically call directTailCall() and then fulfill the - // promise fulfiller for onTailCall() with the returned pipeline. - - virtual kj::Own addRef() = 0; -}; - -kj::Own newLocalPromiseClient(kj::Promise>&& promise); -// Returns a ClientHook that queues up calls until `promise` resolves, then forwards them to -// the new client. This hook's `getResolved()` and `whenMoreResolved()` methods will reflect the -// redirection to the eventual replacement client. - -kj::Own newLocalPromisePipeline(kj::Promise>&& promise); -// Returns a PipelineHook that queues up calls until `promise` resolves, then forwards them to -// the new pipeline. - -kj::Own newBrokenCap(kj::StringPtr reason); -kj::Own newBrokenCap(kj::Exception&& reason); -// Helper function that creates a capability which simply throws exceptions when called. - -kj::Own newBrokenPipeline(kj::Exception&& reason); -// Helper function that creates a pipeline which simply throws exceptions when called. - -Request newBrokenRequest( - kj::Exception&& reason, kj::Maybe sizeHint); -// Helper function that creates a Request object that simply throws exceptions when sent. - -// ======================================================================================= -// Extend PointerHelpers for interfaces - -namespace _ { // private - -template -struct PointerHelpers { - static inline typename T::Client get(PointerReader reader) { - return typename T::Client(reader.getCapability()); - } - static inline typename T::Client get(PointerBuilder builder) { - return typename T::Client(builder.getCapability()); - } - static inline void set(PointerBuilder builder, typename T::Client&& value) { - builder.setCapability(kj::mv(value.Capability::Client::hook)); - } - static inline void set(PointerBuilder builder, typename T::Client& value) { - builder.setCapability(value.Capability::Client::hook->addRef()); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -} // namespace _ (private) - -// ======================================================================================= -// Extend List for interfaces - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Client(reader.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Client(builder.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - inline void set(uint index, typename T::Client value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setCapability(kj::mv(value.hook)); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -// ======================================================================================= -// Inline implementation details - -template -RemotePromise Request::send() { - auto typelessPromise = hook->send(); - hook = nullptr; // prevent reuse - - // Convert the Promise to return the correct response type. - // Explicitly upcast to kj::Promise to make clear that calling .then() doesn't invalidate the - // Pipeline part of the RemotePromise. - auto typedPromise = kj::implicitCast>&>(typelessPromise) - .then([](Response&& response) -> Response { - return Response(response.getAs(), kj::mv(response.hook)); - }); - - // Wrap the typeless pipeline in a typed wrapper. - typename Results::Pipeline typedPipeline( - kj::mv(kj::implicitCast(typelessPromise))); - - return RemotePromise(kj::mv(typedPromise), kj::mv(typedPipeline)); -} - -inline Capability::Client::Client(kj::Own&& hook): hook(kj::mv(hook)) {} -template -inline Capability::Client::Client(kj::Own&& server) - : hook(makeLocalClient(kj::mv(server))) {} -template -inline Capability::Client::Client(kj::Promise&& promise) - : hook(newLocalPromiseClient(promise.then([](T&& t) { return kj::mv(t.hook); }))) {} -inline Capability::Client::Client(Client& other): hook(other.hook->addRef()) {} -inline Capability::Client& Capability::Client::operator=(Client& other) { - hook = other.hook->addRef(); - return *this; -} -template -inline typename T::Client Capability::Client::castAs() { - return typename T::Client(hook->addRef()); -} -inline kj::Promise Capability::Client::whenResolved() { - return hook->whenResolved(); -} -inline Request Capability::Client::typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint) { - return newCall(interfaceId, methodId, sizeHint); -} -template -inline Request Capability::Client::newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) { - auto typeless = hook->newCall(interfaceId, methodId, sizeHint); - return Request(typeless.template getAs(), kj::mv(typeless.hook)); -} - -template -inline CallContext::CallContext(CallContextHook& hook): hook(&hook) {} -template -inline typename Params::Reader CallContext::getParams() { - return hook->getParams().template getAs(); -} -template -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -template -inline typename Results::Builder CallContext::getResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template getAs(); -} -template -inline typename Results::Builder CallContext::initResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template initAs(); -} -template -inline void CallContext::setResults(typename Results::Reader value) { - hook->getResults(value.totalSize()).template setAs(value); -} -template -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(nullptr).adopt(kj::mv(value)); -} -template -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -template -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template -CallContext Capability::Server::internalGetTypedContext( - CallContext typeless) { - return CallContext(*typeless.hook); -} - -Capability::Client Capability::Server::thisCap() { - return Client(thisHook->addRef()); -} - -template -T ReaderCapabilityTable::imbue(T reader) { - return T(_::PointerHelpers>::getInternalReader(reader).imbue(this)); -} - -template -T BuilderCapabilityTable::imbue(T builder) { - return T(_::PointerHelpers>::getInternalBuilder(kj::mv(builder)).imbue(this)); -} - -template -typename T::Client CapabilityServerSet::add(kj::Own&& server) { - void* ptr = reinterpret_cast(server.get()); - // Clang insists that `castAs` is a template-dependent member and therefore we need the - // `template` keyword here, but AFAICT this is wrong: addImpl() is not a template. - return addInternal(kj::mv(server), ptr).template castAs(); -} - -template -kj::Promise> CapabilityServerSet::getLocalServer( - typename T::Client& client) { - return getLocalServerInternal(client) - .then([](void* server) -> kj::Maybe { - if (server == nullptr) { - return nullptr; - } else { - return *reinterpret_cast(server); - } - }); -} - -template -struct Orphanage::GetInnerReader { - static inline kj::Own apply(typename T::Client t) { - return ClientHook::from(kj::mv(t)); - } -}; - -} // namespace capnp - -#endif // CAPNP_CAPABILITY_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/common.h b/phonelibs/capnp-cpp/include/capnp/common.h deleted file mode 100644 index 3fc7a42112..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/common.h +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef CAPNP_COMMON_H_ -#define CAPNP_COMMON_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include - -#if CAPNP_DEBUG_TYPES -#include -#endif - -namespace capnp { - -#define CAPNP_VERSION_MAJOR 0 -#define CAPNP_VERSION_MINOR 6 -#define CAPNP_VERSION_MICRO 1 - -#define CAPNP_VERSION \ - (CAPNP_VERSION_MAJOR * 1000000 + CAPNP_VERSION_MINOR * 1000 + CAPNP_VERSION_MICRO) - -#ifndef CAPNP_LITE -#define CAPNP_LITE 0 -#endif - -typedef unsigned int uint; - -struct Void { - // Type used for Void fields. Using C++'s "void" type creates a bunch of issues since it behaves - // differently from other types. - - inline constexpr bool operator==(Void other) const { return true; } - inline constexpr bool operator!=(Void other) const { return false; } -}; - -static constexpr Void VOID = Void(); -// Constant value for `Void`, which is an empty struct. - -inline kj::StringPtr KJ_STRINGIFY(Void) { return "void"; } - -struct Text; -struct Data; - -enum class Kind: uint8_t { - PRIMITIVE, - BLOB, - ENUM, - STRUCT, - UNION, - INTERFACE, - LIST, - - OTHER - // Some other type which is often a type parameter to Cap'n Proto templates, but which needs - // special handling. This includes types like AnyPointer, Dynamic*, etc. -}; - -enum class Style: uint8_t { - PRIMITIVE, - POINTER, // other than struct - STRUCT, - CAPABILITY -}; - -enum class ElementSize: uint8_t { - // Size of a list element. - - VOID = 0, - BIT = 1, - BYTE = 2, - TWO_BYTES = 3, - FOUR_BYTES = 4, - EIGHT_BYTES = 5, - - POINTER = 6, - - INLINE_COMPOSITE = 7 -}; - -enum class PointerType { - // Various wire types a pointer field can take - - NULL_, - // Should be NULL, but that's #defined in stddef.h - - STRUCT, - LIST, - CAPABILITY -}; - -namespace schemas { - -template -struct EnumInfo; - -} // namespace schemas - -namespace _ { // private - -template struct Kind_; - -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; - -template struct Kind_> { - static constexpr Kind kind = Kind::STRUCT; -}; -template struct Kind_> { - static constexpr Kind kind = Kind::INTERFACE; -}; -template struct Kind_::IsEnum>> { - static constexpr Kind kind = Kind::ENUM; -}; - -} // namespace _ (private) - -template ::kind> -inline constexpr Kind kind() { - // This overload of kind() matches types which have a Kind_ specialization. - - return k; -} - -#if _MSC_VER - -#define CAPNP_KIND(T) ::capnp::_::Kind_::kind -// Avoid constexpr methods in MSVC (it remains buggy in many situations). - -#else // _MSC_VER - -#define CAPNP_KIND(T) ::capnp::kind() -// Use this macro rather than kind() in any code which must work in MSVC. - -#endif // _MSC_VER, else - -#if !CAPNP_LITE - -template ()> -inline constexpr Style style() { - return k == Kind::PRIMITIVE || k == Kind::ENUM ? Style::PRIMITIVE - : k == Kind::STRUCT ? Style::STRUCT - : k == Kind::INTERFACE ? Style::CAPABILITY : Style::POINTER; -} - -#endif // !CAPNP_LITE - -template -struct List; - -#if _MSC_VER - -template -struct List {}; -// For some reason, without this declaration, MSVC will error out on some uses of List -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -template struct ListElementType_; -template struct ListElementType_> { typedef T Type; }; -template using ListElementType = typename ListElementType_::Type; - -namespace _ { // private -template struct Kind_> { - static constexpr Kind kind = Kind::LIST; -}; -} // namespace _ (private) - -template struct ReaderFor_ { typedef typename T::Reader Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef typename T::Client Type; }; -template using ReaderFor = typename ReaderFor_::Type; -// The type returned by List::Reader::operator[]. - -template struct BuilderFor_ { typedef typename T::Builder Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef typename T::Client Type; }; -template using BuilderFor = typename BuilderFor_::Type; -// The type returned by List::Builder::operator[]. - -template struct PipelineFor_ { typedef typename T::Pipeline Type;}; -template struct PipelineFor_ { typedef typename T::Client Type; }; -template using PipelineFor = typename PipelineFor_::Type; - -template struct TypeIfEnum_; -template struct TypeIfEnum_ { typedef T Type; }; - -template -using TypeIfEnum = typename TypeIfEnum_>::Type; - -template -using FromReader = typename kj::Decay::Reads; -// FromReader = MyType (for any Cap'n Proto type). - -template -using FromBuilder = typename kj::Decay::Builds; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromPipeline = typename kj::Decay::Pipelines; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromClient = typename kj::Decay::Calls; -// FromReader = MyType (for any Cap'n Proto interface type). - -template -using FromServer = typename kj::Decay::Serves; -// FromBuilder = MyType (for any Cap'n Proto interface type). - -template -struct FromAny_; - -template -struct FromAny_>> { - using Type = FromReader; -}; - -template -struct FromAny_>> { - using Type = FromBuilder; -}; - -template -struct FromAny_>> { - using Type = FromPipeline; -}; - -// Note that T::Client is covered by FromReader - -template -struct FromAny_, kj::VoidSfinae>> { - using Type = FromServer; -}; - -template -struct FromAny_::kind == Kind::PRIMITIVE || _::Kind_::kind == Kind::ENUM>> { - // TODO(msvc): Ideally the EnableIf condition would be `style() == Style::PRIMITIVE`, but MSVC - // cannot yet use style() in this constexpr context. - - using Type = kj::Decay; -}; - -template -using FromAny = typename FromAny_::Type; -// Given any Cap'n Proto value type as an input, return the Cap'n Proto base type. That is: -// -// Foo::Reader -> Foo -// Foo::Builder -> Foo -// Foo::Pipeline -> Foo -// Foo::Client -> Foo -// Own -> Foo -// uint32_t -> uint32_t - -namespace _ { // private - -template -struct PointerHelpers; - -#if _MSC_VER - -template -struct PointerHelpers {}; -// For some reason, without this declaration, MSVC will error out on some uses of PointerHelpers -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -} // namespace _ (private) - -struct MessageSize { - // Size of a message. Every struct type has a method `.totalSize()` that returns this. - uint64_t wordCount; - uint capCount; -}; - -// ======================================================================================= -// Raw memory types and measures - -using kj::byte; - -class word { uint64_t content KJ_UNUSED_MEMBER; KJ_DISALLOW_COPY(word); public: word() = default; }; -// word is an opaque type with size of 64 bits. This type is useful only to make pointer -// arithmetic clearer. Since the contents are private, the only way to access them is to first -// reinterpret_cast to some other pointer type. -// -// Copying is disallowed because you should always use memcpy(). Otherwise, you may run afoul of -// aliasing rules. -// -// A pointer of type word* should always be word-aligned even if won't actually be dereferenced as -// that type. - -static_assert(sizeof(byte) == 1, "uint8_t is not one byte?"); -static_assert(sizeof(word) == 8, "uint64_t is not 8 bytes?"); - -#if CAPNP_DEBUG_TYPES -// Set CAPNP_DEBUG_TYPES to 1 to use kj::Quantity for "count" types. Otherwise, plain integers are -// used. All the code should still operate exactly the same, we just lose compile-time checking. -// Note that this will also change symbol names, so it's important that the library and any clients -// be compiled with the same setting here. -// -// We disable this by default to reduce symbol name size and avoid any possibility of the compiler -// failing to fully-optimize the types, but anyone modifying Cap'n Proto itself should enable this -// during development and testing. - -namespace _ { class BitLabel; class ElementLabel; struct WirePointer; } - -template -using BitCountN = kj::Quantity(), T>, _::BitLabel>; -template -using ByteCountN = kj::Quantity(), T>, byte>; -template -using WordCountN = kj::Quantity(), T>, word>; -template -using ElementCountN = kj::Quantity(), T>, _::ElementLabel>; -template -using WirePointerCountN = kj::Quantity(), T>, _::WirePointer>; - -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::bounded; -using kj::unbound; -using kj::unboundAs; -using kj::unboundMax; -using kj::unboundMaxBits; -using kj::assertMax; -using kj::assertMaxBits; -using kj::upgradeBound; -using kj::ThrowOverflow; -using kj::assumeBits; -using kj::assumeMax; -using kj::subtractChecked; -using kj::trySubtract; - -template -inline constexpr U* operator+(U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+(const U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator+=(U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} - -template -inline constexpr U* operator-(U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-(const U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator-=(U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} - -constexpr auto BITS = kj::unit>(); -constexpr auto BYTES = kj::unit>(); -constexpr auto WORDS = kj::unit>(); -constexpr auto ELEMENTS = kj::unit>(); -constexpr auto POINTERS = kj::unit>(); - -constexpr auto ZERO = kj::bounded<0>(); -constexpr auto ONE = kj::bounded<1>(); - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr auto BITS_PER_BYTE KJ_UNUSED = bounded<8>() * BITS / BYTES; -constexpr auto BITS_PER_WORD KJ_UNUSED = bounded<64>() * BITS / WORDS; -constexpr auto BYTES_PER_WORD KJ_UNUSED = bounded<8>() * BYTES / WORDS; - -constexpr auto BITS_PER_POINTER KJ_UNUSED = bounded<64>() * BITS / POINTERS; -constexpr auto BYTES_PER_POINTER KJ_UNUSED = bounded<8>() * BYTES / POINTERS; -constexpr auto WORDS_PER_POINTER KJ_UNUSED = ONE * WORDS / POINTERS; - -constexpr auto POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; - -constexpr auto MAX_SEGMENT_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_LIST_ELEMENTS = - bounded()>() * ELEMENTS; -constexpr auto MAX_STUCT_DATA_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_STRUCT_POINTER_COUNT = - bounded()>() * POINTERS; - -using StructDataBitCount = decltype(WordCountN() * BITS_PER_WORD); -// Number of bits in a Struct data segment (should come out to BitCountN<22>). - -using StructDataOffset = decltype(StructDataBitCount() * (ONE * ELEMENTS / BITS)); -using StructPointerOffset = StructPointerCount; -// Type of a field offset. - -inline StructDataOffset assumeDataOffset(uint32_t offset) { - return assumeMax(MAX_STUCT_DATA_WORDS * BITS_PER_WORD * (ONE * ELEMENTS / BITS), - bounded(offset) * ELEMENTS); -} - -inline StructPointerOffset assumePointerOffset(uint32_t offset) { - return assumeMax(MAX_STRUCT_POINTER_COUNT, bounded(offset) * POINTERS); -} - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef kj::Quantity, byte> TextSize; -// Not including NUL terminator. - -template -inline KJ_CONSTEXPR() decltype(bounded() * BYTES / ELEMENTS) bytesPerElement() { - return bounded() * BYTES / ELEMENTS; -} - -template -inline KJ_CONSTEXPR() decltype(bounded() * BITS / ELEMENTS) bitsPerElement() { - return bounded() * BITS / ELEMENTS; -} - -template -inline constexpr kj::Quantity, T> -intervalLength(const T* a, const T* b, kj::Quantity, T>) { - return kj::assumeMax(b - a) * kj::unit, T>>(); -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} - -#else - -template -using BitCountN = T; -template -using ByteCountN = T; -template -using WordCountN = T; -template -using ElementCountN = T; -template -using WirePointerCountN = T; - - -// XXX -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::ThrowOverflow; -// YYY - -template inline constexpr uint bounded() { return i; } -template inline constexpr T bounded(T i) { return i; } -template inline constexpr T unbound(T i) { return i; } - -template inline constexpr T unboundAs(U i) { return i; } - -template inline constexpr uint unboundMax(T i) { return i; } -template inline constexpr uint unboundMaxBits(T i) { return i; } - -template -inline T assertMax(T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMax(uint newMax, T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMaxBits(T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > kj::maxValueForBits())) func(); - return value; -} - -template -inline T assertMaxBits(uint bits, T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > (1ull << bits) - 1)) func(); - return value; -} - -template inline constexpr T upgradeBound(U i) { return i; } - -template inline constexpr T assumeBits(T i) { return i; } -template inline constexpr T assumeMax(T i) { return i; } - -template -inline auto subtractChecked(T a, U b, ErrorFunc&& errorFunc = ErrorFunc()) - -> decltype(a - b) { - if (b > a) errorFunc(); - return a - b; -} - -template -inline auto trySubtract(T a, U b) -> kj::Maybe { - if (b > a) { - return nullptr; - } else { - return a - b; - } -} - -constexpr uint BITS = 1; -constexpr uint BYTES = 1; -constexpr uint WORDS = 1; -constexpr uint ELEMENTS = 1; -constexpr uint POINTERS = 1; - -constexpr uint ZERO = 0; -constexpr uint ONE = 1; - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr uint BITS_PER_BYTE KJ_UNUSED = 8; -constexpr uint BITS_PER_WORD KJ_UNUSED = 64; -constexpr uint BYTES_PER_WORD KJ_UNUSED = 8; - -constexpr uint BITS_PER_POINTER KJ_UNUSED = 64; -constexpr uint BYTES_PER_POINTER KJ_UNUSED = 8; -constexpr uint WORDS_PER_POINTER KJ_UNUSED = 1; - -// XXX -constexpr uint POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; -// YYY - -constexpr auto MAX_SEGMENT_WORDS = kj::maxValueForBits(); -constexpr auto MAX_LIST_ELEMENTS = kj::maxValueForBits(); -constexpr auto MAX_STUCT_DATA_WORDS = kj::maxValueForBits(); -constexpr auto MAX_STRUCT_POINTER_COUNT = kj::maxValueForBits(); - -typedef uint StructDataBitCount; -typedef uint StructDataOffset; -typedef uint StructPointerOffset; - -inline StructDataOffset assumeDataOffset(uint32_t offset) { return offset; } -inline StructPointerOffset assumePointerOffset(uint32_t offset) { return offset; } - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef uint TextSize; - -template -inline KJ_CONSTEXPR() size_t bytesPerElement() { return sizeof(T); } - -template -inline KJ_CONSTEXPR() size_t bitsPerElement() { return sizeof(T) * 8; } - -template -inline constexpr ptrdiff_t intervalLength(const T* a, const T* b, uint) { - return b - a; -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} - -#endif - -} // namespace capnp - -#endif // CAPNP_COMMON_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/compat/json.capnp.h b/phonelibs/capnp-cpp/include/capnp/compat/json.capnp.h deleted file mode 100644 index a8877e540b..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/compat/json.capnp.h +++ /dev/null @@ -1,860 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: json.capnp - -#ifndef CAPNP_INCLUDED_8ef99297a43a5e34_ -#define CAPNP_INCLUDED_8ef99297a43a5e34_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(8825ffaa852cda72); -CAPNP_DECLARE_SCHEMA(c27855d853a937cc); -CAPNP_DECLARE_SCHEMA(9bbf84153dd4bb60); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -struct JsonValue { - JsonValue() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NULL_, - BOOLEAN, - NUMBER, - STRING, - ARRAY, - OBJECT, - CALL, - }; - struct Field; - struct Call; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8825ffaa852cda72, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c27855d853a937cc, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9bbf84153dd4bb60, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class JsonValue::Reader { -public: - typedef JsonValue Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNull() const; - inline ::capnp::Void getNull() const; - - inline bool isBoolean() const; - inline bool getBoolean() const; - - inline bool isNumber() const; - inline double getNumber() const; - - inline bool isString() const; - inline bool hasString() const; - inline ::capnp::Text::Reader getString() const; - - inline bool isArray() const; - inline bool hasArray() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getArray() const; - - inline bool isObject() const; - inline bool hasObject() const; - inline ::capnp::List< ::capnp::JsonValue::Field>::Reader getObject() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::JsonValue::Call::Reader getCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Builder { -public: - typedef JsonValue Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNull(); - inline ::capnp::Void getNull(); - inline void setNull( ::capnp::Void value = ::capnp::VOID); - - inline bool isBoolean(); - inline bool getBoolean(); - inline void setBoolean(bool value); - - inline bool isNumber(); - inline double getNumber(); - inline void setNumber(double value); - - inline bool isString(); - inline bool hasString(); - inline ::capnp::Text::Builder getString(); - inline void setString( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initString(unsigned int size); - inline void adoptString(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownString(); - - inline bool isArray(); - inline bool hasArray(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getArray(); - inline void setArray( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initArray(unsigned int size); - inline void adoptArray(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownArray(); - - inline bool isObject(); - inline bool hasObject(); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder getObject(); - inline void setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder initObject(unsigned int size); - inline void adoptObject(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> disownObject(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::JsonValue::Call::Builder getCall(); - inline void setCall( ::capnp::JsonValue::Call::Reader value); - inline ::capnp::JsonValue::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::JsonValue::Call>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue::Call> disownCall(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Pipeline { -public: - typedef JsonValue Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline bool hasValue() const; - inline ::capnp::JsonValue::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline bool hasValue(); - inline ::capnp::JsonValue::Builder getValue(); - inline void setValue( ::capnp::JsonValue::Reader value); - inline ::capnp::JsonValue::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::JsonValue>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::JsonValue::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasFunction() const; - inline ::capnp::Text::Reader getFunction() const; - - inline bool hasParams() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasFunction(); - inline ::capnp::Text::Builder getFunction(); - inline void setFunction( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFunction(unsigned int size); - inline void adoptFunction(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFunction(); - - inline bool hasParams(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getParams(); - inline void setParams( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initParams(unsigned int size); - inline void adoptParams(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::JsonValue::Which JsonValue::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::JsonValue::Which JsonValue::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Reader::isNull() const { - return which() == JsonValue::NULL_; -} -inline bool JsonValue::Builder::isNull() { - return which() == JsonValue::NULL_; -} -inline ::capnp::Void JsonValue::Reader::getNull() const { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void JsonValue::Builder::getNull() { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNull( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NULL_); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isBoolean() const { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Builder::isBoolean() { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Reader::getBoolean() const { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Builder::getBoolean() { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setBoolean(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::BOOLEAN); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isNumber() const { - return which() == JsonValue::NUMBER; -} -inline bool JsonValue::Builder::isNumber() { - return which() == JsonValue::NUMBER; -} -inline double JsonValue::Reader::getNumber() const { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double JsonValue::Builder::getNumber() { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNumber(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NUMBER); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isString() const { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Builder::isString() { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Reader::hasString() const { - if (which() != JsonValue::STRING) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasString() { - if (which() != JsonValue::STRING) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Reader::getString() const { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Builder::getString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setString( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Builder::initString(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptString( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Builder::disownString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isArray() const { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Builder::isArray() { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Reader::hasArray() const { - if (which() != JsonValue::ARRAY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasArray() { - if (which() != JsonValue::ARRAY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Reader::getArray() const { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::getArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setArray( ::capnp::List< ::capnp::JsonValue>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::initArray(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptArray( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Builder::disownArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isObject() const { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Builder::isObject() { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Reader::hasObject() const { - if (which() != JsonValue::OBJECT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasObject() { - if (which() != JsonValue::OBJECT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Reader JsonValue::Reader::getObject() const { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::getObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::initObject(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptObject( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> JsonValue::Builder::disownObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isCall() const { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Builder::isCall() { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Reader::hasCall() const { - if (which() != JsonValue::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasCall() { - if (which() != JsonValue::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Call::Reader JsonValue::Reader::getCall() const { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::getCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setCall( ::capnp::JsonValue::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::adoptCall( - ::capnp::Orphan< ::capnp::JsonValue::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue::Call> JsonValue::Builder::disownCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Reader JsonValue::Field::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::JsonValue::Pipeline JsonValue::Field::Pipeline::getValue() { - return ::capnp::JsonValue::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void JsonValue::Field::Builder::setValue( ::capnp::JsonValue::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::adoptValue( - ::capnp::Orphan< ::capnp::JsonValue>&& value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue> JsonValue::Field::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasFunction() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasFunction() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Call::Reader::getFunction() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::getFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setFunction( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::initFunction(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptFunction( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Call::Builder::disownFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setParams( ::capnp::List< ::capnp::JsonValue>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::initParams(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -} // namespace - -#endif // CAPNP_INCLUDED_8ef99297a43a5e34_ diff --git a/phonelibs/capnp-cpp/include/capnp/compat/json.h b/phonelibs/capnp-cpp/include/capnp/compat/json.h deleted file mode 100644 index 7fa815e099..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/compat/json.h +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_COMPAT_JSON_H_ -#define CAPNP_COMPAT_JSON_H_ - -#include -#include -#include - -namespace capnp { - -class JsonCodec { - // Flexible class for encoding Cap'n Proto types as JSON, and decoding JSON back to Cap'n Proto. - // - // Typical usage: - // - // JsonCodec json; - // - // // encode - // kj::String encoded = json.encode(someStructReader); - // - // // decode - // json.decode(encoded, someStructBuilder); - // - // Advanced users can do fancy things like override the way certain types or fields are - // represented in JSON by registering handlers. See the unit test for an example. - // - // Notes: - // - When encoding, all primitive fields are always encoded, even if default-valued. Pointer - // fields are only encoded if they are non-null. - // - 64-bit integers are encoded as strings, since JSON "numbers" are double-precision floating - // points which cannot store a 64-bit integer without losing data. - // - NaNs and infinite floating point numbers are not allowed by the JSON spec, and so are encoded - // as null. This matches the behavior of `JSON.stringify` in at least Firefox and Chrome. - // - Data is encoded as an array of numbers in the range [0,255]. You probably want to register - // a handler that does something better, like maybe base64 encoding, but there are a zillion - // different ways people do this. - // - Encoding/decoding capabilities and AnyPointers requires registering a Handler, since there's - // no obvious default behavior. - // - When decoding, unrecognized field names are ignored. Note: This means that JSON is NOT a - // good format for receiving input from a human. Consider `capnp eval` or the SchemaParser - // library for human input. - -public: - JsonCodec(); - ~JsonCodec() noexcept(false); - - // --------------------------------------------------------------------------- - // standard API - - void setPrettyPrint(bool enabled); - // Enable to insert newlines, indentation, and other extra spacing into the output. The default - // is to use minimal whitespace. - - void setMaxNestingDepth(size_t maxNestingDepth); - // Set maximum nesting depth when decoding JSON to prevent highly nested input from overflowing - // the call stack. The default is 64. - - template - kj::String encode(T&& value); - // Encode any Cap'n Proto value to JSON, including primitives and - // Dynamic{Enum,Struct,List,Capability}, but not DynamicValue (see below). - - kj::String encode(DynamicValue::Reader value, Type type) const; - // Encode a DynamicValue to JSON. `type` is needed because `DynamicValue` itself does - // not distinguish between e.g. int32 and int64, which in JSON are handled differently. Most - // of the time, though, you can use the single-argument templated version of `encode()` instead. - - void decode(kj::ArrayPtr input, DynamicStruct::Builder output) const; - // Decode JSON text directly into a struct builder. This only works for structs since lists - // need to be allocated with the correct size in advance. - // - // (Remember that any Cap'n Proto struct reader type can be implicitly cast to - // DynamicStruct::Reader.) - - template - Orphan decode(kj::ArrayPtr input, Orphanage orphanage) const; - // Decode JSON text to any Cap'n Proto object (pointer value), allocated using the given - // orphanage. T must be specified explicitly and cannot be dynamic, e.g.: - // - // Orphan orphan = json.decode(text, orphanage); - - template - ReaderFor decode(kj::ArrayPtr input) const; - // Decode JSON text into a primitive or capability value. T must be specified explicitly and - // cannot be dynamic, e.g.: - // - // uint32_t n = json.decode(text); - - Orphan decode(kj::ArrayPtr input, Type type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(kj::ArrayPtr input, InterfaceSchema type) const; - DynamicEnum decode(kj::ArrayPtr input, EnumSchema type) const; - // Decode to a dynamic value, specifying the type schema. - - // --------------------------------------------------------------------------- - // layered API - // - // You can separate text <-> JsonValue from JsonValue <-> T. These are particularly useful - // for calling from Handler implementations. - - kj::String encodeRaw(JsonValue::Reader value) const; - void decodeRaw(kj::ArrayPtr input, JsonValue::Builder output) const; - // Translate JsonValue <-> text. - - template - void encode(T&& value, JsonValue::Builder output); - void encode(DynamicValue::Reader input, Type type, JsonValue::Builder output) const; - void decode(JsonValue::Reader input, DynamicStruct::Builder output) const; - template - Orphan decode(JsonValue::Reader input, Orphanage orphanage) const; - template - ReaderFor decode(JsonValue::Reader input) const; - - Orphan decode(JsonValue::Reader input, Type type, Orphanage orphanage) const; - Orphan decode(JsonValue::Reader input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(JsonValue::Reader input, InterfaceSchema type) const; - DynamicEnum decode(JsonValue::Reader input, EnumSchema type) const; - - // --------------------------------------------------------------------------- - // specializing particular types - - template ()> - class Handler; - // Implement this interface to specify a special encoding for a particular type or field. - // - // The templates are a bit ugly, but subclasses of this type essentially implement two methods, - // one to encode values of this type and one to decode values of this type. `encode()` is simple: - // - // void encode(const JsonCodec& codec, ReaderFor input, JsonValue::Builder output) const; - // - // `decode()` is a bit trickier. When T is a struct (including DynamicStruct), it is: - // - // void decode(const JsonCodec& codec, JsonValue::Reader input, BuilderFor output) const; - // - // However, when T is a primitive, decode() is: - // - // T decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Or when T is any non-struct object (list, blob), decode() is: - // - // Orphan decode(const JsonCodec& codec, JsonValue::Reader input, Orphanage orphanage) const; - // - // Or when T is an interface: - // - // T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Additionally, when T is a struct you can *optionally* also implement the orphan-returning form - // of decode(), but it will only be called when the struct would be allocated as an individual - // object, not as part of a list. This allows you to return "nullptr" in these cases to say that - // the pointer value should be null. This does not apply to list elements because struct list - // elements cannot ever be null (since Cap'n Proto encodes struct lists as a flat list rather - // than list-of-pointers). - - template - void addTypeHandler(Handler& handler); - void addTypeHandler(Type type, Handler& handler); - void addTypeHandler(EnumSchema type, Handler& handler); - void addTypeHandler(StructSchema type, Handler& handler); - void addTypeHandler(ListSchema type, Handler& handler); - void addTypeHandler(InterfaceSchema type, Handler& handler); - // Arrange that whenever the type T appears in the message, your handler will be used to - // encode/decode it. - // - // Note that if you register a handler for a capability type, it will also apply to subtypes. - // Thus Handler handles all capabilities. - - template - void addFieldHandler(StructSchema::Field field, Handler& handler); - // Matches only the specific field. T can be a dynamic type. T must match the field's type. - -private: - class HandlerBase; - struct Impl; - - kj::Own impl; - - void encodeField(StructSchema::Field field, DynamicValue::Reader input, - JsonValue::Builder output) const; - void decodeArray(List::Reader input, DynamicList::Builder output) const; - void decodeObject(List::Reader input, DynamicStruct::Builder output) const; - void addTypeHandlerImpl(Type type, HandlerBase& handler); - void addFieldHandlerImpl(StructSchema::Field field, Type type, HandlerBase& handler); -}; - -// ======================================================================================= -// inline implementation details - -template -kj::String JsonCodec::encode(T&& value) { - typedef FromAny> Base; - return encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from()); -} - -template -inline Orphan JsonCodec::decode(kj::ArrayPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(kj::ArrayPtr input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - kj::ArrayPtr input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(kj::ArrayPtr input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -template -void JsonCodec::encode(T&& value, JsonValue::Builder output) { - typedef FromAny> Base; - encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from(), output); -} - -template -inline Orphan JsonCodec::decode(JsonValue::Reader input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(JsonValue::Reader input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - JsonValue::Reader input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - JsonValue::Reader input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(JsonValue::Reader input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -class JsonCodec::HandlerBase { - // Internal helper; ignore. -public: - virtual void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const = 0; - virtual Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const; - virtual void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - BuilderFor output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template <> -class JsonCodec::Handler: private JsonCodec::HandlerBase { - // Almost identical to Style::STRUCT except that we pass the struct type to decode(). - -public: - virtual void encode(const JsonCodec& codec, DynamicStruct::Reader input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - StructSchema type, Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(type); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, type.asStruct(), orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, T input, JsonValue::Builder output) const = 0; - virtual T decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, typename T::Client input, - JsonValue::Builder output) const = 0; - virtual typename T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return orphanage.newOrphanCopy(decode(codec, input)); - } - friend class JsonCodec; -}; - -template -inline void JsonCodec::addTypeHandler(Handler& handler) { - addTypeHandlerImpl(Type::from(), handler); -} -inline void JsonCodec::addTypeHandler(Type type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(EnumSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(StructSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(ListSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(InterfaceSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} - -template -inline void JsonCodec::addFieldHandler(StructSchema::Field field, Handler& handler) { - addFieldHandlerImpl(field, Type::from(), handler); -} - -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -// TODO(someday): Implement support for registering handlers that cover thinsg like "all structs" -// or "all lists". Currently you can only target a specific struct or list type. - -} // namespace capnp - -#endif // CAPNP_COMPAT_JSON_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/dynamic.h b/phonelibs/capnp-cpp/include/capnp/dynamic.h deleted file mode 100644 index fcefcc3bf2..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/dynamic.h +++ /dev/null @@ -1,1643 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines classes that can be used to manipulate messages based on schemas that are not -// known until runtime. This is also useful for writing generic code that uses schemas to handle -// arbitrary types in a generic way. -// -// Each of the classes defined here has a to() template method which converts an instance back to a -// native type. This method will throw an exception if the requested type does not match the -// schema. To convert native types to dynamic, use DynamicFactory. -// -// As always, underlying data is validated lazily, so you have to actually traverse the whole -// message if you want to validate all content. - -#ifndef CAPNP_DYNAMIC_H_ -#define CAPNP_DYNAMIC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include "layout.h" -#include "message.h" -#include "any.h" -#include "capability.h" - -namespace capnp { - -class MessageReader; -class MessageBuilder; - -struct DynamicValue { - DynamicValue() = delete; - - enum Type { - UNKNOWN, - // Means that the value has unknown type and content because it comes from a newer version of - // the schema, or from a newer version of Cap'n Proto that has new features that this version - // doesn't understand. - - VOID, - BOOL, - INT, - UINT, - FLOAT, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - CAPABILITY, - ANY_POINTER - }; - - class Reader; - class Builder; - class Pipeline; -}; -class DynamicEnum; -struct DynamicStruct { - DynamicStruct() = delete; - class Reader; - class Builder; - class Pipeline; -}; -struct DynamicList { - DynamicList() = delete; - class Reader; - class Builder; -}; -struct DynamicCapability { - DynamicCapability() = delete; - class Client; - class Server; -}; -template <> class Orphan; - -template struct DynamicTypeFor_; -template <> struct DynamicTypeFor_ { typedef DynamicEnum Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicStruct Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicList Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicCapability Type; }; - -template -using DynamicTypeFor = typename DynamicTypeFor_()>::Type; - -template -ReaderFor>> toDynamic(T&& value); -template -BuilderFor>> toDynamic(T&& value); -template -DynamicTypeFor> toDynamic(T&& value); -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value); - -namespace _ { // private - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -} // namespace _ (private) - -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::PRIMITIVE; } -template <> inline constexpr Style style() { return Style::STRUCT; } -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::CAPABILITY; } - -// ------------------------------------------------------------------- - -class DynamicEnum { -public: - DynamicEnum() = default; - inline DynamicEnum(EnumSchema::Enumerant enumerant) - : schema(enumerant.getContainingEnum()), value(enumerant.getOrdinal()) {} - inline DynamicEnum(EnumSchema schema, uint16_t value) - : schema(schema), value(value) {} - - template () == Kind::ENUM>> - inline DynamicEnum(T&& value): DynamicEnum(toDynamic(value)) {} - - template - inline T as() const { return static_cast(asImpl(typeId())); } - // Cast to a native enum type. - - inline EnumSchema getSchema() const { return schema; } - - kj::Maybe getEnumerant() const; - // Get which enumerant this enum value represents. Returns nullptr if the numeric value does not - // correspond to any enumerant in the schema -- this can happen if the data was built using a - // newer schema that has more values defined. - - inline uint16_t getRaw() const { return value; } - // Returns the raw underlying enum value. - -private: - EnumSchema schema; - uint16_t value; - - uint16_t asImpl(uint64_t requestedTypeId) const; - - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - template - friend DynamicTypeFor> toDynamic(T&& value); -}; - -// ------------------------------------------------------------------- - -class DynamicStruct::Reader { -public: - typedef DynamicStruct Reads; - - Reader() = default; - - template >() == Kind::STRUCT>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - inline MessageSize totalSize() const { return reader.totalSize().asPublic(); } - - template - typename T::Reader as() const; - // Convert the dynamic struct to its compiled-in type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Reader get(StructSchema::Field field) const; - // Read the given field value. - - bool has(StructSchema::Field field) const; - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns false if the union member is not - // active, but does not necessarily return true if the member is active (depends on the field's - // value). - - kj::Maybe which() const; - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - DynamicValue::Reader get(kj::StringPtr name) const; - bool has(kj::StringPtr name) const; - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - -private: - StructSchema schema; - _::StructReader reader; - - inline Reader(StructSchema schema, _::StructReader reader) - : schema(schema), reader(reader) {} - Reader(StructSchema schema, const _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field) const; - void verifySetInUnion(StructSchema::Field field) const; - static DynamicValue::Reader getImpl(_::StructReader reader, StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend class DynamicStruct::Builder; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Builder { -public: - typedef DynamicStruct Builds; - - Builder() = default; - inline Builder(decltype(nullptr)) {} - - template >() == Kind::STRUCT>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - inline MessageSize totalSize() const { return asReader().totalSize(); } - - template - typename T::Builder as(); - // Cast to a particular struct type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Builder get(StructSchema::Field field); - // Read the given field value. - - inline bool has(StructSchema::Field field) { return asReader().has(field); } - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns whether the field is currently - // active and the union as a whole is non-default -- so, the only time has() will return false - // for an active union field is if it is the default active field and it has its default value. - - kj::Maybe which(); - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - void set(StructSchema::Field field, const DynamicValue::Reader& value); - // Set the given field value. - - DynamicValue::Builder init(StructSchema::Field field); - DynamicValue::Builder init(StructSchema::Field field, uint size); - // Init a struct, list, or blob field. - - void adopt(StructSchema::Field field, Orphan&& orphan); - Orphan disown(StructSchema::Field field); - // Adopt/disown. This works even for non-pointer fields: adopt() becomes equivalent to set() - // and disown() becomes like get() followed by clear(). - - void clear(StructSchema::Field field); - // Clear a field, setting it to its default value. For pointer fields, this actually makes the - // field null. - - DynamicValue::Builder get(kj::StringPtr name); - bool has(kj::StringPtr name); - void set(kj::StringPtr name, const DynamicValue::Reader& value); - void set(kj::StringPtr name, std::initializer_list value); - DynamicValue::Builder init(kj::StringPtr name); - DynamicValue::Builder init(kj::StringPtr name, uint size); - void adopt(kj::StringPtr name, Orphan&& orphan); - Orphan disown(kj::StringPtr name); - void clear(kj::StringPtr name); - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - - Reader asReader() const; - -private: - StructSchema schema; - _::StructBuilder builder; - - inline Builder(StructSchema schema, _::StructBuilder builder) - : schema(schema), builder(builder) {} - Builder(StructSchema schema, _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field); - void verifySetInUnion(StructSchema::Field field); - void setInUnion(StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Pipeline { -public: - typedef DynamicStruct Pipelines; - - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - - template - typename T::Pipeline releaseAs(); - // Convert the dynamic pipeline to its compiled-in type. - - inline StructSchema getSchema() { return schema; } - - DynamicValue::Pipeline get(StructSchema::Field field); - // Read the given field value. - - DynamicValue::Pipeline get(kj::StringPtr name); - // Get by string name. - -private: - StructSchema schema; - AnyPointer::Pipeline typeless; - - inline explicit Pipeline(StructSchema schema, AnyPointer::Pipeline&& typeless) - : schema(schema), typeless(kj::mv(typeless)) {} - - friend class Request; -}; - -// ------------------------------------------------------------------- - -class DynamicList::Reader { -public: - typedef DynamicList Reads; - - inline Reader(): reader(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - template - typename T::Reader as() const; - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - DynamicValue::Reader operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - ListSchema schema; - _::ListReader reader; - - Reader(ListSchema schema, _::ListReader reader): schema(schema), reader(reader) {} - Reader(ListSchema schema, const _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend class DynamicList::Builder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicList::Builder { -public: - typedef DynamicList Builds; - - inline Builder(): builder(ElementSize::VOID) {} - inline Builder(decltype(nullptr)): builder(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - template - typename T::Builder as(); - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - DynamicValue::Builder operator[](uint index); - void set(uint index, const DynamicValue::Reader& value); - DynamicValue::Builder init(uint index, uint size); - void adopt(uint index, Orphan&& orphan); - Orphan disown(uint index); - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - void copyFrom(std::initializer_list value); - - Reader asReader() const; - -private: - ListSchema schema; - _::ListBuilder builder; - - Builder(ListSchema schema, _::ListBuilder builder): schema(schema), builder(builder) {} - Builder(ListSchema schema, _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - template - friend struct _::OrphanGetImpl; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -// ------------------------------------------------------------------- - -class DynamicCapability::Client: public Capability::Client { -public: - typedef DynamicCapability Calls; - typedef DynamicCapability Reads; - - Client() = default; - - template >() == Kind::INTERFACE>> - inline Client(T&& client); - - template ()>> - inline Client(kj::Own&& server); - - template () == Kind::INTERFACE>> - typename T::Client as(); - template () == Kind::INTERFACE>> - typename T::Client releaseAs(); - // Convert to any client type. - - Client upcast(InterfaceSchema requestedSchema); - // Upcast to a superclass. Throws an exception if `schema` is not a superclass. - - inline InterfaceSchema getSchema() { return schema; } - - Request newRequest( - InterfaceSchema::Method method, kj::Maybe sizeHint = nullptr); - Request newRequest( - kj::StringPtr methodName, kj::Maybe sizeHint = nullptr); - -private: - InterfaceSchema schema; - - Client(InterfaceSchema schema, kj::Own&& hook) - : Capability::Client(kj::mv(hook)), schema(schema) {} - - template - inline Client(InterfaceSchema schema, kj::Own&& server); - - friend struct Capability; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - friend class Orphan; - friend class Orphan; - friend class Orphan; - template - friend struct _::PointerHelpers; -}; - -class DynamicCapability::Server: public Capability::Server { -public: - typedef DynamicCapability Serves; - - Server(InterfaceSchema schema): schema(schema) {} - - virtual kj::Promise call(InterfaceSchema::Method method, - CallContext context) = 0; - - kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) override final; - - inline InterfaceSchema getSchema() const { return schema; } - -private: - InterfaceSchema schema; -}; - -template <> -class Request: public DynamicStruct::Builder { - // Specialization of `Request` for DynamicStruct. - -public: - inline Request(DynamicStruct::Builder builder, kj::Own&& hook, - StructSchema resultSchema) - : DynamicStruct::Builder(builder), hook(kj::mv(hook)), resultSchema(resultSchema) {} - - RemotePromise send(); - // Send the call and return a promise for the results. - -private: - kj::Own hook; - StructSchema resultSchema; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template <> -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - -public: - explicit CallContext(CallContextHook& hook, StructSchema paramType, StructSchema resultType); - - DynamicStruct::Reader getParams(); - void releaseParams(); - DynamicStruct::Builder getResults(kj::Maybe sizeHint = nullptr); - DynamicStruct::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(DynamicStruct::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - template - kj::Promise tailCall(Request&& tailRequest); - void allowCancellation(); - -private: - CallContextHook* hook; - StructSchema paramType; - StructSchema resultType; - - friend class DynamicCapability::Server; -}; - -// ------------------------------------------------------------------- - -// Make sure ReaderFor and BuilderFor work for DynamicEnum, DynamicStruct, and -// DynamicList, so that we can define DynamicValue::as(). - -template <> struct ReaderFor_ { typedef DynamicEnum Type; }; -template <> struct BuilderFor_ { typedef DynamicEnum Type; }; -template <> struct ReaderFor_ { typedef DynamicStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicStruct::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicList::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicList::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct BuilderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct PipelineFor_ { typedef DynamicCapability::Client Type; }; - -class DynamicValue::Reader { -public: - typedef DynamicValue Reads; - - inline Reader(decltype(nullptr) n = nullptr); // UNKNOWN - inline Reader(Void value); - inline Reader(bool value); - inline Reader(char value); - inline Reader(signed char value); - inline Reader(short value); - inline Reader(int value); - inline Reader(long value); - inline Reader(long long value); - inline Reader(unsigned char value); - inline Reader(unsigned short value); - inline Reader(unsigned int value); - inline Reader(unsigned long value); - inline Reader(unsigned long long value); - inline Reader(float value); - inline Reader(double value); - inline Reader(const char* value); // Text - inline Reader(const Text::Reader& value); - inline Reader(const Data::Reader& value); - inline Reader(const DynamicList::Reader& value); - inline Reader(DynamicEnum value); - inline Reader(const DynamicStruct::Reader& value); - inline Reader(const AnyPointer::Reader& value); - inline Reader(DynamicCapability::Client& value); - inline Reader(DynamicCapability::Client&& value); - template ()>> - inline Reader(kj::Own&& value); - Reader(ConstSchema constant); - - template ()))> - inline Reader(T&& value): Reader(toDynamic(kj::mv(value))) {} - - Reader(const Reader& other); - Reader(Reader&& other) noexcept; - ~Reader() noexcept(false); - Reader& operator=(const Reader& other); - Reader& operator=(Reader&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline ReaderFor as() const { return AsImpl::apply(*this); } - // Use to interpret the value as some Cap'n Proto type. Allowed types are: - // - Void, bool, [u]int{8,16,32,64}_t, float, double, any enum: Returns the raw value. - // - Text, Data, AnyPointer, any struct type: Returns the corresponding Reader. - // - List for any T listed above: Returns List::Reader. - // - DynamicEnum: Returns the corresponding type. - // - DynamicStruct, DynamicList: Returns the corresponding Reader. - // - Any capability type, including DynamicCapability: Returns the corresponding Client. - // - DynamicValue: Returns an identical Reader. Useful to avoid special-casing in generic code. - // (TODO(perf): On GCC 4.8 / Clang 3.3, provide rvalue-qualified version that avoids - // refcounting.) - // - // DynamicValue allows various implicit conversions, mostly just to make the interface friendlier. - // - Any integer can be converted to any other integer type so long as the actual value is within - // the new type's range. - // - Floating-point types can be converted to integers as long as no information would be lost - // in the conversion. - // - Integers can be converted to floating points. This may lose information, but won't throw. - // - Float32/Float64 can be converted between each other. Converting Float64 -> Float32 may lose - // information, but won't throw. - // - Text can be converted to an enum, if the Text matches one of the enumerant names (but not - // vice-versa). - // - Capabilities can be upcast (cast to a supertype), but not downcast. - // - // Any other conversion attempt will throw an exception. - - inline Type getType() const { return type; } - // Get the type of this value. - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Reader textValue; - Data::Reader dataValue; - DynamicList::Reader listValue; - DynamicEnum enumValue; - DynamicStruct::Reader structValue; - AnyPointer::Reader anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - - // Warning: Copy/move constructors assume all these types are trivially copyable except - // Capability. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphanage; // to speed up newOrphanCopy(DynamicValue::Reader) -}; - -class DynamicValue::Builder { -public: - typedef DynamicValue Builds; - - inline Builder(decltype(nullptr) n = nullptr); // UNKNOWN - inline Builder(Void value); - inline Builder(bool value); - inline Builder(char value); - inline Builder(signed char value); - inline Builder(short value); - inline Builder(int value); - inline Builder(long value); - inline Builder(long long value); - inline Builder(unsigned char value); - inline Builder(unsigned short value); - inline Builder(unsigned int value); - inline Builder(unsigned long value); - inline Builder(unsigned long long value); - inline Builder(float value); - inline Builder(double value); - inline Builder(Text::Builder value); - inline Builder(Data::Builder value); - inline Builder(DynamicList::Builder value); - inline Builder(DynamicEnum value); - inline Builder(DynamicStruct::Builder value); - inline Builder(AnyPointer::Builder value); - inline Builder(DynamicCapability::Client& value); - inline Builder(DynamicCapability::Client&& value); - - template ()))> - inline Builder(T value): Builder(toDynamic(value)) {} - - Builder(Builder& other); - Builder(Builder&& other) noexcept; - ~Builder() noexcept(false); - Builder& operator=(Builder& other); - Builder& operator=(Builder&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline BuilderFor as() { return AsImpl::apply(*this); } - // See DynamicValue::Reader::as(). - - inline Type getType() { return type; } - // Get the type of this value. - - Reader asReader() const; - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Builder textValue; - Data::Builder dataValue; - DynamicList::Builder listValue; - DynamicEnum enumValue; - DynamicStruct::Builder structValue; - AnyPointer::Builder anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphan; -}; - -class DynamicValue::Pipeline { -public: - typedef DynamicValue Pipelines; - - inline Pipeline(decltype(nullptr) n = nullptr); - inline Pipeline(DynamicStruct::Pipeline&& value); - inline Pipeline(DynamicCapability::Client&& value); - - Pipeline(Pipeline&& other) noexcept; - Pipeline& operator=(Pipeline&& other); - ~Pipeline() noexcept(false); - - template - inline PipelineFor releaseAs() { return AsImpl::apply(*this); } - - inline Type getType() { return type; } - // Get the type of this value. - -private: - Type type; - union { - DynamicStruct::Pipeline structValue; - DynamicCapability::Client capabilityValue; - }; - - template ()> struct AsImpl; - // Implementation backing the releaseAs() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. -}; - -kj::StringTree KJ_STRINGIFY(const DynamicValue::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicValue::Builder& value); -kj::StringTree KJ_STRINGIFY(DynamicEnum value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Builder& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Builder& value); - -// ------------------------------------------------------------------- -// Orphan <-> Dynamic glue - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::STRUCT>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicStruct::Builder get(); - DynamicStruct::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicStruct::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - StructSchema schema; - _::OrphanBuilder builder; - - inline Orphan(StructSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class MessageBuilder; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::LIST>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicList::Builder get(); - DynamicList::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicList::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - // TODO(someday): Support truncate(). - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - ListSchema schema; - _::OrphanBuilder builder; - - inline Orphan(ListSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::INTERFACE>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicCapability::Client get(); - DynamicCapability::Client getReader() const; - - template - Orphan releaseAs(); - // Like DynamicCapability::Client::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - InterfaceSchema schema; - _::OrphanBuilder builder; - - inline Orphan(InterfaceSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - inline Orphan(decltype(nullptr) n = nullptr): type(DynamicValue::UNKNOWN) {} - inline Orphan(Void value); - inline Orphan(bool value); - inline Orphan(char value); - inline Orphan(signed char value); - inline Orphan(short value); - inline Orphan(int value); - inline Orphan(long value); - inline Orphan(long long value); - inline Orphan(unsigned char value); - inline Orphan(unsigned short value); - inline Orphan(unsigned int value); - inline Orphan(unsigned long value); - inline Orphan(unsigned long long value); - inline Orphan(float value); - inline Orphan(double value); - inline Orphan(DynamicEnum value); - Orphan(Orphan&&) = default; - template - Orphan(Orphan&&); - Orphan(Orphan&&); - Orphan(void*) = delete; // So Orphan(bool) doesn't accept pointers. - KJ_DISALLOW_COPY(Orphan); - - Orphan& operator=(Orphan&&) = default; - - inline DynamicValue::Type getType() { return type; } - - DynamicValue::Builder get(); - DynamicValue::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicValue::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - -private: - DynamicValue::Type type; - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - DynamicEnum enumValue; - StructSchema structSchema; - ListSchema listSchema; - InterfaceSchema interfaceSchema; - }; - - _::OrphanBuilder builder; - // Only used if `type` is a pointer type. - - Orphan(DynamicValue::Builder value, _::OrphanBuilder&& builder); - Orphan(DynamicValue::Type type, _::OrphanBuilder&& builder) - : type(type), builder(kj::mv(builder)) {} - Orphan(StructSchema structSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::STRUCT), structSchema(structSchema), builder(kj::mv(builder)) {} - Orphan(ListSchema listSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::LIST), listSchema(listSchema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct AnyPointer; - friend class Orphanage; -}; - -template -inline Orphan::Orphan(Orphan&& other) - : Orphan(other.get(), kj::mv(other.builder)) {} - -inline Orphan::Orphan(Orphan&& other) - : type(DynamicValue::ANY_POINTER), builder(kj::mv(other.builder)) {} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - type = DynamicValue::UNKNOWN; - return Orphan(kj::mv(builder)); -} - -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(DynamicStruct::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(DynamicList::Builder& t) { - return t.builder; - } -}; - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicStruct::Reader copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicList::Reader copyFrom) const { - return Orphan(copyFrom.getSchema(), - _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicCapability::Client copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.hook->addRef())); -} - -template <> -Orphan Orphanage::newOrphanCopy( - DynamicValue::Reader copyFrom) const; - -namespace _ { // private - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicStruct::Reader getDynamic(PointerReader reader, StructSchema schema); - static DynamicStruct::Builder getDynamic(PointerBuilder builder, StructSchema schema); - static void set(PointerBuilder builder, const DynamicStruct::Reader& value); - static DynamicStruct::Builder init(PointerBuilder builder, StructSchema schema); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, StructSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicList::Reader getDynamic(PointerReader reader, ListSchema schema); - static DynamicList::Builder getDynamic(PointerBuilder builder, ListSchema schema); - static void set(PointerBuilder builder, const DynamicList::Reader& value); - static DynamicList::Builder init(PointerBuilder builder, ListSchema schema, uint size); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, ListSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicCapability::Client getDynamic(PointerReader reader, InterfaceSchema schema); - static DynamicCapability::Client getDynamic(PointerBuilder builder, InterfaceSchema schema); - static void set(PointerBuilder builder, DynamicCapability::Client& value); - static void set(PointerBuilder builder, DynamicCapability::Client&& value); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, InterfaceSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -} // namespace _ (private) - -template -inline ReaderFor AnyPointer::Reader::getAs(StructSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(ListSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(InterfaceSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(StructSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(ListSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(InterfaceSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(StructSchema schema) { - return _::PointerHelpers::init(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(ListSchema schema, uint elementCount) { - return _::PointerHelpers::init(builder, schema, elementCount); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicStruct::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicList::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicCapability::Client value) { - return _::PointerHelpers::set(builder, kj::mv(value)); -} -template <> -void AnyPointer::Builder::adopt(Orphan&& orphan); -template -inline Orphan AnyPointer::Builder::disownAs(StructSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(ListSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(InterfaceSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} - -// We have to declare the methods below inline because Clang and GCC disagree about how to mangle -// their symbol names. -template <> -inline DynamicStruct::Builder Orphan::getAs(StructSchema schema) { - return DynamicStruct::Builder(schema, builder); -} -template <> -inline DynamicStruct::Reader Orphan::getAsReader( - StructSchema schema) const { - return DynamicStruct::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(StructSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicList::Builder Orphan::getAs(ListSchema schema) { - return DynamicList::Builder(schema, builder); -} -template <> -inline DynamicList::Reader Orphan::getAsReader(ListSchema schema) const { - return DynamicList::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(ListSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicCapability::Client Orphan::getAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline DynamicCapability::Client Orphan::getAsReader( - InterfaceSchema schema) const { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline Orphan Orphan::releaseAs( - InterfaceSchema schema) { - return Orphan(schema, kj::mv(builder)); -} - -// ======================================================================================= -// Inline implementation details. - -template -struct ToDynamic_ { - static inline DynamicStruct::Reader apply(const typename T::Reader& value) { - return DynamicStruct::Reader(Schema::from(), value._reader); - } - static inline DynamicStruct::Builder apply(typename T::Builder& value) { - return DynamicStruct::Builder(Schema::from(), value._builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicList::Reader apply(const typename T::Reader& value) { - return DynamicList::Reader(Schema::from(), value.reader); - } - static inline DynamicList::Builder apply(typename T::Builder& value) { - return DynamicList::Builder(Schema::from(), value.builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicCapability::Client apply(typename T::Client value) { - return DynamicCapability::Client(kj::mv(value)); - } - static inline DynamicCapability::Client apply(typename T::Client&& value) { - return DynamicCapability::Client(kj::mv(value)); - } -}; - -template -ReaderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -BuilderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -DynamicTypeFor> toDynamic(T&& value) { - return DynamicEnum(Schema::from>(), static_cast(value)); -} -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value) { - return typename FromServer::Client(kj::mv(value)); -} - -inline DynamicValue::Reader::Reader(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Builder::Builder(std::nullptr_t n): type(UNKNOWN) {} - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline Orphan::Orphan(cppType value) \ - : type(DynamicValue::typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Void, VOID, void); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(bool, BOOL, bool); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(signed char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(short, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(int, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned char, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned short, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned int, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(float, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(double, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicEnum, ENUM, enum); -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(const cppType::Reader& value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType::Builder value) \ - : type(typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Text, TEXT, text); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Data, DATA, data); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicList, LIST, list); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicStruct, STRUCT, struct); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(AnyPointer, ANY_POINTER, anyPointer); - -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -inline DynamicValue::Reader::Reader(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Reader::Reader(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -template -inline DynamicValue::Reader::Reader(kj::Own&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -inline DynamicValue::Reader::Reader(const char* value): Reader(Text::Reader(value)) {} - -#define CAPNP_DECLARE_TYPE(discrim, typeName) \ -template <> \ -struct DynamicValue::Reader::AsImpl { \ - static ReaderFor apply(const Reader& reader); \ -}; \ -template <> \ -struct DynamicValue::Builder::AsImpl { \ - static BuilderFor apply(Builder& builder); \ -}; - -//CAPNP_DECLARE_TYPE(VOID, Void) -CAPNP_DECLARE_TYPE(BOOL, bool) -CAPNP_DECLARE_TYPE(INT8, int8_t) -CAPNP_DECLARE_TYPE(INT16, int16_t) -CAPNP_DECLARE_TYPE(INT32, int32_t) -CAPNP_DECLARE_TYPE(INT64, int64_t) -CAPNP_DECLARE_TYPE(UINT8, uint8_t) -CAPNP_DECLARE_TYPE(UINT16, uint16_t) -CAPNP_DECLARE_TYPE(UINT32, uint32_t) -CAPNP_DECLARE_TYPE(UINT64, uint64_t) -CAPNP_DECLARE_TYPE(FLOAT32, float) -CAPNP_DECLARE_TYPE(FLOAT64, double) - -CAPNP_DECLARE_TYPE(TEXT, Text) -CAPNP_DECLARE_TYPE(DATA, Data) -CAPNP_DECLARE_TYPE(LIST, DynamicList) -CAPNP_DECLARE_TYPE(STRUCT, DynamicStruct) -CAPNP_DECLARE_TYPE(INTERFACE, DynamicCapability) -CAPNP_DECLARE_TYPE(ENUM, DynamicEnum) -CAPNP_DECLARE_TYPE(ANY_POINTER, AnyPointer) -#undef CAPNP_DECLARE_TYPE - -// CAPNP_DECLARE_TYPE(Void) causes gcc 4.7 to segfault. If I do it manually and remove the -// ReaderFor<> and BuilderFor<> wrappers, it works. -template <> -struct DynamicValue::Reader::AsImpl { - static Void apply(const Reader& reader); -}; -template <> -struct DynamicValue::Builder::AsImpl { - static Void apply(Builder& builder); -}; - -template -struct DynamicValue::Reader::AsImpl { - static T apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static T apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Client apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Client apply(Builder& builder) { - return builder.as().as(); - } -}; - -template <> -struct DynamicValue::Reader::AsImpl { - static DynamicValue::Reader apply(const Reader& reader) { - return reader; - } -}; -template <> -struct DynamicValue::Builder::AsImpl { - static DynamicValue::Builder apply(Builder& builder) { - return builder; - } -}; - -inline DynamicValue::Pipeline::Pipeline(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Pipeline::Pipeline(DynamicStruct::Pipeline&& value) - : type(STRUCT), structValue(kj::mv(value)) {} -inline DynamicValue::Pipeline::Pipeline(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Pipeline apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Client apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicStruct::Reader::as() const { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Reader::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} - -template -typename T::Builder DynamicStruct::Builder::as() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Builder::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicStruct::Reader DynamicStruct::Reader::as() const { - return *this; -} -template <> -inline DynamicStruct::Builder DynamicStruct::Builder::as() { - return *this; -} - -inline DynamicStruct::Reader DynamicStruct::Builder::asReader() const { - return DynamicStruct::Reader(schema, builder.asReader()); -} - -template <> -inline AnyStruct::Reader DynamicStruct::Reader::as() const { - return AnyStruct::Reader(reader); -} - -template <> -inline AnyStruct::Builder DynamicStruct::Builder::as() { - return AnyStruct::Builder(builder); -} - -template -typename T::Pipeline DynamicStruct::Pipeline::releaseAs() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Pipeline::releaseAs() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Pipeline(kj::mv(typeless)); -} - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicList::Reader::as() const { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Reader::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} -template -typename T::Builder DynamicList::Builder::as() { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Builder::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicList::Reader DynamicList::Reader::as() const { - return *this; -} -template <> -inline DynamicList::Builder DynamicList::Builder::as() { - return *this; -} - -template <> -inline AnyList::Reader DynamicList::Reader::as() const { - return AnyList::Reader(reader); -} - -template <> -inline AnyList::Builder DynamicList::Builder::as() { - return AnyList::Builder(builder); -} - -// ------------------------------------------------------------------- - -template -inline DynamicCapability::Client::Client(T&& client) - : Capability::Client(kj::mv(client)), schema(Schema::from>()) {} - -template -inline DynamicCapability::Client::Client(kj::Own&& server) - : Client(server->getSchema(), kj::mv(server)) {} -template -inline DynamicCapability::Client::Client(InterfaceSchema schema, kj::Own&& server) - : Capability::Client(kj::mv(server)), schema(schema) {} - -template -typename T::Client DynamicCapability::Client::as() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(hook->addRef()); -} - -template -typename T::Client DynamicCapability::Client::releaseAs() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(kj::mv(hook)); -} - -inline CallContext::CallContext( - CallContextHook& hook, StructSchema paramType, StructSchema resultType) - : hook(&hook), paramType(paramType), resultType(resultType) {} -inline DynamicStruct::Reader CallContext::getParams() { - return hook->getParams().getAs(paramType); -} -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -inline DynamicStruct::Builder CallContext::getResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).getAs(resultType); -} -inline DynamicStruct::Builder CallContext::initResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).initAs(resultType); -} -inline void CallContext::setResults(DynamicStruct::Reader value) { - hook->getResults(value.totalSize()).setAs(value); -} -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(MessageSize { 0, 0 }).adopt(kj::mv(value)); -} -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template <> -inline DynamicCapability::Client Capability::Client::castAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, hook->addRef()); -} - -// ------------------------------------------------------------------- - -template -ReaderFor ConstSchema::as() const { - return DynamicValue::Reader(*this).as(); -} - -} // namespace capnp - -#endif // CAPNP_DYNAMIC_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/endian.h b/phonelibs/capnp-cpp/include/capnp/endian.h deleted file mode 100644 index c5a6e63c5a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/endian.h +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ENDIAN_H_ -#define CAPNP_ENDIAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include // memcpy - -namespace capnp { -namespace _ { // private - -// WireValue -// -// Wraps a primitive value as it appears on the wire. Namely, values are little-endian on the -// wire, because little-endian is the most common endianness in modern CPUs. -// -// Note: In general, code that depends cares about byte ordering is bad. See: -// http://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html -// Cap'n Proto is special because it is essentially doing compiler-like things, fussing over -// allocation and layout of memory, in order to squeeze out every last drop of performance. - -#if _MSC_VER -// Assume Windows is little-endian. -// -// TODO(msvc): This is ugly. Maybe refactor later checks to be based on CAPNP_BYTE_ORDER or -// CAPNP_SWAP_BYTES or something, and define that in turn based on _MSC_VER or the GCC -// intrinsics. - -#ifndef __ORDER_BIG_ENDIAN__ -#define __ORDER_BIG_ENDIAN__ 4321 -#endif -#ifndef __ORDER_LITTLE_ENDIAN__ -#define __ORDER_LITTLE_ENDIAN__ 1234 -#endif -#ifndef __BYTE_ORDER__ -#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ -#endif -#endif - -#if CAPNP_REVERSE_ENDIAN -#define CAPNP_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#else -#define CAPNP_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#endif - -#if defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_WIRE_BYTE_ORDER && \ - !CAPNP_DISABLE_ENDIAN_DETECTION -// CPU is little-endian. We can just read/write the memory directly. - -template -class DirectWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -using WireValue = DirectWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#elif defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER && \ - defined(__GNUC__) && !CAPNP_DISABLE_ENDIAN_DETECTION -// Big-endian, but GCC's __builtin_bswap() is available. - -// TODO(perf): Use dedicated instructions to read little-endian data on big-endian CPUs that have -// them. - -// TODO(perf): Verify that this code optimizes reasonably. In particular, ensure that the -// compiler optimizes away the memcpy()s and keeps everything in registers. - -template -class SwappingWireValue; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - uint16_t swapped = (value << 8) | (value >> 8); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - value = (raw << 8) | (raw >> 8); - } - -private: - uint16_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t swapped = __builtin_bswap32(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap32(raw); - } - -private: - uint32_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t swapped = __builtin_bswap64(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap64(raw); - } - -private: - uint64_t value; -}; - -template -using WireValue = SwappingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#else -// Unknown endianness. Fall back to bit shifts. - -#if !CAPNP_DISABLE_ENDIAN_DETECTION -#if _MSC_VER -#pragma message("Couldn't detect endianness of your platform. Using unoptimized fallback implementation.") -#pragma message("Consider changing this code to detect your platform and send us a patch!") -#else -#warning "Couldn't detect endianness of your platform. Using unoptimized fallback implementation." -#warning "Consider changing this code to detect your platform and send us a patch!" -#endif -#endif // !CAPNP_DISABLE_ENDIAN_DETECTION - -template -class ShiftingWireValue; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint16_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - } - -private: - union { - byte bytes[2]; - uint16_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - } - -private: - union { - byte bytes[4]; - uint32_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24) | - (static_cast(bytes[4]) << 32) | - (static_cast(bytes[5]) << 40) | - (static_cast(bytes[6]) << 48) | - (static_cast(bytes[7]) << 56); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - bytes[4] = raw >> 32; - bytes[5] = raw >> 40; - bytes[6] = raw >> 48; - bytes[7] = raw >> 56; - } - -private: - union { - byte bytes[8]; - uint64_t align; - }; -}; - -template -using WireValue = ShiftingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#endif - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_ENDIAN_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/ez-rpc.h b/phonelibs/capnp-cpp/include/capnp/ez-rpc.h deleted file mode 100644 index fba5ace582..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/ez-rpc.h +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_EZ_RPC_H_ -#define CAPNP_EZ_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" - -struct sockaddr; - -namespace kj { class AsyncIoProvider; class LowLevelAsyncIoProvider; } - -namespace capnp { - -class EzRpcContext; - -class EzRpcClient { - // Super-simple interface for setting up a Cap'n Proto RPC client. Example: - // - // # Cap'n Proto schema - // interface Adder { - // add @0 (left :Int32, right :Int32) -> (value :Int32); - // } - // - // // C++ client - // int main() { - // capnp::EzRpcClient client("localhost:3456"); - // Adder::Client adder = client.getMain(); - // auto request = adder.addRequest(); - // request.setLeft(12); - // request.setRight(34); - // auto response = request.send().wait(client.getWaitScope()); - // assert(response.getValue() == 46); - // return 0; - // } - // - // // C++ server - // class AdderImpl final: public Adder::Server { - // public: - // kj::Promise add(AddContext context) override { - // auto params = context.getParams(); - // context.getResults().setValue(params.getLeft() + params.getRight()); - // return kj::READY_NOW; - // } - // }; - // - // int main() { - // capnp::EzRpcServer server(kj::heap(), "*:3456"); - // kj::NEVER_DONE.wait(server.getWaitScope()); - // } - // - // This interface is easy, but it hides a lot of useful features available from the lower-level - // classes: - // - The server can only export a small set of public, singleton capabilities under well-known - // string names. This is fine for transient services where no state needs to be kept between - // connections, but hides the power of Cap'n Proto when it comes to long-lived resources. - // - EzRpcClient/EzRpcServer automatically set up a `kj::EventLoop` and make it current for the - // thread. Only one `kj::EventLoop` can exist per thread, so you cannot use these interfaces - // if you wish to set up your own event loop. (However, you can safely create multiple - // EzRpcClient / EzRpcServer objects in a single thread; they will make sure to make no more - // than one EventLoop.) - // - These classes only support simple two-party connections, not multilateral VatNetworks. - // - These classes only support communication over a raw, unencrypted socket. If you want to - // build on an abstract stream (perhaps one which supports encryption), you must use the - // lower-level interfaces. - // - // Some of these restrictions will probably be lifted in future versions, but some things will - // always require using the low-level interfaces directly. If you are interested in working - // at a lower level, start by looking at these interfaces: - // - `kj::setupAsyncIo()` in `kj/async-io.h`. - // - `RpcSystem` in `capnp/rpc.h`. - // - `TwoPartyVatNetwork` in `capnp/rpc-twoparty.h`. - -public: - explicit EzRpcClient(kj::StringPtr serverAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()); - // Construct a new EzRpcClient and connect to the given address. The connection is formed in - // the background -- if it fails, calls to capabilities returned by importCap() will fail with an - // appropriate exception. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, the port is required in `serverAddress`. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcClient(const struct sockaddr* serverAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but connects to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - explicit EzRpcClient(int socketFd, ReaderOptions readerOpts = ReaderOptions()); - // Create a client on top of an already-connected socket. - // `readerOpts` acts as in the first constructor. - - ~EzRpcClient() noexcept(false); - - template - typename Type::Client getMain(); - Capability::Client getMain(); - // Get the server's main (aka "bootstrap") interface. - - template - typename Type::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - Capability::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - // ** DEPRECATED ** - // - // Ask the sever for the capability with the given name. You may specify a type to automatically - // down-cast to that type. It is up to you to specify the correct expected type. - // - // Named interfaces are deprecated. The new preferred usage pattern is for the server to export - // a "main" interface which itself has methods for getting any other interfaces. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -class EzRpcServer { - // The server counterpart to `EzRpcClient`. See `EzRpcClient` for an example. - -public: - explicit EzRpcServer(Capability::Client mainInterface, kj::StringPtr bindAddress, - uint defaultPort = 0, ReaderOptions readerOpts = ReaderOptions()); - // Construct a new `EzRpcServer` that binds to the given address. An address of "*" means to - // bind to all local addresses. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, a port is chosen automatically, and you must call getPort() to find out what - // it is. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // The server might not begin listening immediately, especially if `bindAddress` needs to be - // resolved. If you need to wait until the server is definitely up, wait on the promise returned - // by `getPort()`. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcServer(Capability::Client mainInterface, struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but binds to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - EzRpcServer(Capability::Client mainInterface, int socketFd, uint port, - ReaderOptions readerOpts = ReaderOptions()); - // Create a server on top of an already-listening socket (i.e. one on which accept() may be - // called). `port` is returned by `getPort()` -- it serves no other purpose. - // `readerOpts` acts as in the other two above constructors. - - explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(int socketFd, uint port, ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - - ~EzRpcServer() noexcept(false); - - void exportCap(kj::StringPtr name, Capability::Client cap); - // Export a capability publicly under the given name, so that clients can import it. - // - // Keep in mind that you can implicitly convert `kj::Own&&` to - // `Capability::Client`, so it's typical to pass something like - // `kj::heap()` as the second parameter. - - kj::Promise getPort(); - // Get the IP port number on which this server is listening. This promise won't resolve until - // the server is actually listening. If the address was not an IP address (e.g. it was a Unix - // domain socket) then getPort() resolves to zero. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -inline typename Type::Client EzRpcClient::getMain() { - return getMain().castAs(); -} - -template -inline typename Type::Client EzRpcClient::importCap(kj::StringPtr name) { - return importCap(name).castAs(); -} - -} // namespace capnp - -#endif // CAPNP_EZ_RPC_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/generated-header-support.h b/phonelibs/capnp-cpp/include/capnp/generated-header-support.h deleted file mode 100644 index 51b6dd7c11..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/generated-header-support.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is included from all generated headers. - -#ifndef CAPNP_GENERATED_HEADER_SUPPORT_H_ -#define CAPNP_GENERATED_HEADER_SUPPORT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "raw-schema.h" -#include "layout.h" -#include "list.h" -#include "orphan.h" -#include "pointer-helpers.h" -#include "any.h" -#include -#include - -namespace capnp { - -class MessageBuilder; // So that it can be declared a friend. - -template -struct ToDynamic_; // Defined in dynamic.h, needs to be declared as everyone's friend. - -struct DynamicStruct; // So that it can be declared a friend. - -struct Capability; // To declare brandBindingFor() - -namespace _ { // private - -#if !CAPNP_LITE - -template -inline const RawSchema& rawSchema() { - return *CapnpPrivate::schema; -} -template ::typeId> -inline const RawSchema& rawSchema() { - return *schemas::EnumInfo::schema; -} - -template -inline const RawBrandedSchema& rawBrandedSchema() { - return *CapnpPrivate::brand(); -} -template ::typeId> -inline const RawBrandedSchema& rawBrandedSchema() { - return schemas::EnumInfo::schema->defaultBrand; -} - -template -struct ChooseBrand; -// If all of `Params` are `AnyPointer`, return the type's default brand. Otherwise, return a -// specific brand instance. TypeTag is the _capnpPrivate struct for the type in question. - -template -struct ChooseBrand { - // All params were AnyPointer. No specific brand needed. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::schema->defaultBrand; } -}; - -template -struct ChooseBrand: public ChooseBrand {}; -// The first parameter is AnyPointer, so recurse to check the rest. - -template -struct ChooseBrand { - // At least one parameter is not AnyPointer, so use the specificBrand constant. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::specificBrand; } -}; - -template ()> -struct BrandBindingFor_; - -#define HANDLE_TYPE(Type, which) \ - template <> \ - struct BrandBindingFor_ { \ - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { \ - return { which, listDepth, nullptr }; \ - } \ - } -HANDLE_TYPE(Void, 0); -HANDLE_TYPE(bool, 1); -HANDLE_TYPE(int8_t, 2); -HANDLE_TYPE(int16_t, 3); -HANDLE_TYPE(int32_t, 4); -HANDLE_TYPE(int64_t, 5); -HANDLE_TYPE(uint8_t, 6); -HANDLE_TYPE(uint16_t, 7); -HANDLE_TYPE(uint32_t, 8); -HANDLE_TYPE(uint64_t, 9); -HANDLE_TYPE(float, 10); -HANDLE_TYPE(double, 11); -#undef HANDLE_TYPE - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 12, listDepth, nullptr }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 13, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_, Kind::LIST> { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return BrandBindingFor_::get(listDepth + 1); - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 15, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 16, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 17, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 0 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 1 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 2 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 3 }; - } -}; - -template -constexpr RawBrandedSchema::Binding brandBindingFor() { - return BrandBindingFor_::get(0); -} - -kj::StringTree structString(StructReader reader, const RawBrandedSchema& schema); -kj::String enumString(uint16_t value, const RawBrandedSchema& schema); -// Declared here so that we can declare inline stringify methods on generated types. -// Defined in stringify.c++, which depends on dynamic.c++, which is allowed not to be linked in. - -template -inline kj::StringTree structString(StructReader reader) { - return structString(reader, rawBrandedSchema()); -} -template -inline kj::String enumString(T value) { - return enumString(static_cast(value), rawBrandedSchema()); -} - -#endif // !CAPNP_LITE - -// TODO(cleanup): Unify ConstStruct and ConstList. -template -class ConstStruct { -public: - ConstStruct() = delete; - KJ_DISALLOW_COPY(ConstStruct); - inline explicit constexpr ConstStruct(const word* ptr): ptr(ptr) {} - - inline typename T::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs(); - } - - inline operator typename T::Reader() const { return get(); } - inline typename T::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstList { -public: - ConstList() = delete; - KJ_DISALLOW_COPY(ConstList); - inline explicit constexpr ConstList(const word* ptr): ptr(ptr) {} - - inline typename List::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs>(); - } - - inline operator typename List::Reader() const { return get(); } - inline typename List::Reader operator*() const { return get(); } - inline TemporaryPointer::Reader> operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstText { -public: - ConstText() = delete; - KJ_DISALLOW_COPY(ConstText); - inline explicit constexpr ConstText(const word* ptr): ptr(ptr) {} - - inline Text::Reader get() const { - return Text::Reader(reinterpret_cast(ptr), size); - } - - inline operator Text::Reader() const { return get(); } - inline Text::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - - inline kj::StringPtr toString() const { - return get(); - } - -private: - const word* ptr; -}; - -template -inline kj::StringPtr KJ_STRINGIFY(const ConstText& s) { - return s.get(); -} - -template -class ConstData { -public: - ConstData() = delete; - KJ_DISALLOW_COPY(ConstData); - inline explicit constexpr ConstData(const word* ptr): ptr(ptr) {} - - inline Data::Reader get() const { - return Data::Reader(reinterpret_cast(ptr), size); - } - - inline operator Data::Reader() const { return get(); } - inline Data::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -inline auto KJ_STRINGIFY(const ConstData& s) -> decltype(kj::toCharSequence(s.get())) { - return kj::toCharSequence(s.get()); -} - -} // namespace _ (private) - -template -inline constexpr uint64_t typeId() { return CapnpPrivate::typeId; } -template ::typeId> -inline constexpr uint64_t typeId() { return id; } -// typeId() returns the type ID as defined in the schema. Works with structs, enums, and -// interfaces. - -template -inline constexpr uint sizeInWords() { - // Return the size, in words, of a Struct type, if allocated free-standing (not in a list). - // May be useful for pre-computing space needed in order to precisely allocate messages. - - return unbound((upgradeBound(_::structSize().data) + - _::structSize().pointers * WORDS_PER_POINTER) / WORDS); -} - -} // namespace capnp - -#if _MSC_VER -// MSVC doesn't understand floating-point constexpr yet. -// -// TODO(msvc): Remove this hack when MSVC is fixed. -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) = value -#else -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) = value -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) -#endif - -#if _MSC_VER -// TODO(msvc): A little hack to allow MSVC to use C++14 return type deduction in cases where the -// explicit type exposes bugs in the compiler. -#define CAPNP_AUTO_IF_MSVC(...) auto -#else -#define CAPNP_AUTO_IF_MSVC(...) __VA_ARGS__ -#endif - -#if CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::kj::str(static_cast(value)); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - } - -#if _MSC_VER -// TODO(msvc): MSVC dosen't expect constexprs to have definitions. -#define CAPNP_DEFINE_ENUM(type, id) -#else -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId -#endif - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } - -#else // CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id; \ - extern const ::capnp::_::RawSchema s_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::capnp::_::enumString(value); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &s_##id; \ - } -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId; \ - constexpr ::capnp::_::RawSchema const* EnumInfo::schema - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::STRUCT; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#define CAPNP_DECLARE_INTERFACE_HEADER(id) \ - struct IsInterface; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::INTERFACE; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#endif // CAPNP_LITE, else - -#endif // CAPNP_GENERATED_HEADER_SUPPORT_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/json.capnp b/phonelibs/capnp-cpp/include/capnp/json.capnp deleted file mode 100644 index 55188736f8..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/json.capnp +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0x8ef99297a43a5e34; - -$import "/capnp/c++.capnp".namespace("capnp"); - -struct JsonValue { - union { - null @0 :Void; - boolean @1 :Bool; - number @2 :Float64; - string @3 :Text; - array @4 :List(JsonValue); - object @5 :List(Field); - # Standard JSON values. - - call @6 :Call; - # Non-standard: A "function call", applying a named function (named by a single identifier) - # to a parameter list. Examples: - # - # BinData(0, "Zm9vCg==") - # ISODate("2015-04-15T08:44:50.218Z") - # - # Mongo DB users will recognize the above as exactly the syntax Mongo uses to represent BSON - # "binary" and "date" types in text, since JSON has no analog of these. This is basically the - # reason this extension exists. We do NOT recommend using `call` unless you specifically need - # to be compatible with some silly format that uses this syntax. - } - - struct Field { - name @0 :Text; - value @1 :JsonValue; - } - - struct Call { - function @0 :Text; - params @1 :List(JsonValue); - } -} diff --git a/phonelibs/capnp-cpp/include/capnp/layout.h b/phonelibs/capnp-cpp/include/capnp/layout.h deleted file mode 100644 index 99dc533b2b..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/layout.h +++ /dev/null @@ -1,1274 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is NOT intended for use by clients, except in generated code. -// -// This file defines low-level, non-type-safe classes for traversing the Cap'n Proto memory layout -// (which is also its wire format). Code generated by the Cap'n Proto compiler uses these classes, -// as does other parts of the Cap'n proto library which provide a higher-level interface for -// dynamic introspection. - -#ifndef CAPNP_LAYOUT_H_ -#define CAPNP_LAYOUT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include "blob.h" -#include "endian.h" - -#if (defined(__mips__) || defined(__hppa__)) && !defined(CAPNP_CANONICALIZE_NAN) -#define CAPNP_CANONICALIZE_NAN 1 -// Explicitly detect NaNs and canonicalize them to the quiet NaN value as would be returned by -// __builtin_nan("") on systems implementing the IEEE-754 recommended (but not required) NaN -// signalling/quiet differentiation (such as x86). Unfortunately, some architectures -- in -// particular, MIPS -- represent quiet vs. signalling nans differently than the rest of the world. -// Canonicalizing them makes output consistent (which is important!), but hurts performance -// slightly. -// -// Note that trying to convert MIPS NaNs to standard NaNs without losing data doesn't work. -// Signaling vs. quiet is indicated by a bit, with the meaning being the opposite on MIPS vs. -// everyone else. It would be great if we could just flip that bit, but we can't, because if the -// significand is all-zero, then the value is infinity rather than NaN. This means that on most -// machines, where the bit indicates quietness, there is one more quiet NaN value than signalling -// NaN value, whereas on MIPS there is one more sNaN than qNaN, and thus there is no isomorphic -// mapping that properly preserves quietness. Instead of doing something hacky, we just give up -// and blow away NaN payloads, because no one uses them anyway. -#endif - -namespace capnp { - -#if !CAPNP_LITE -class ClientHook; -#endif // !CAPNP_LITE - -namespace _ { // private - -class PointerBuilder; -class PointerReader; -class StructBuilder; -class StructReader; -class ListBuilder; -class ListReader; -class OrphanBuilder; -struct WirePointer; -struct WireHelpers; -class SegmentReader; -class SegmentBuilder; -class Arena; -class BuilderArena; - -// ============================================================================= - -#if CAPNP_DEBUG_TYPES -typedef kj::UnitRatio, BitLabel, ElementLabel> BitsPerElementTableType; -#else -typedef uint BitsPerElementTableType; -#endif - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType dataBitsPerElement(ElementSize size) { - return _::BITS_PER_ELEMENT_TABLE[static_cast(size)]; -} - -inline constexpr PointersPerElementN<1> pointersPerElement(ElementSize size) { - return size == ElementSize::POINTER - ? PointersPerElementN<1>(ONE * POINTERS / ELEMENTS) - : PointersPerElementN<1>(ZERO * POINTERS / ELEMENTS); -} - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType bitsPerElementIncludingPointers(ElementSize size) { - return _::BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[static_cast(size)]; -} - -template struct ElementSizeForByteSize; -template <> struct ElementSizeForByteSize<1> { static constexpr ElementSize value = ElementSize::BYTE; }; -template <> struct ElementSizeForByteSize<2> { static constexpr ElementSize value = ElementSize::TWO_BYTES; }; -template <> struct ElementSizeForByteSize<4> { static constexpr ElementSize value = ElementSize::FOUR_BYTES; }; -template <> struct ElementSizeForByteSize<8> { static constexpr ElementSize value = ElementSize::EIGHT_BYTES; }; - -template struct ElementSizeForType { - static constexpr ElementSize value = - // Primitive types that aren't special-cased below can be determined from sizeof(). - CAPNP_KIND(T) == Kind::PRIMITIVE ? ElementSizeForByteSize::value : - CAPNP_KIND(T) == Kind::ENUM ? ElementSize::TWO_BYTES : - CAPNP_KIND(T) == Kind::STRUCT ? ElementSize::INLINE_COMPOSITE : - - // Everything else is a pointer. - ElementSize::POINTER; -}; - -// Void and bool are special. -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::VOID; }; -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::BIT; }; - -// Lists and blobs are pointers, not structs. -template struct ElementSizeForType> { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; - -template -inline constexpr ElementSize elementSizeForType() { - return ElementSizeForType::value; -} - -struct MessageSizeCounts { - WordCountN<61, uint64_t> wordCount; // 2^64 bytes - uint capCount; - - MessageSizeCounts& operator+=(const MessageSizeCounts& other) { - // OK to truncate unchecked because this class is used to count actual stuff in memory, and - // we couldn't possibly have anywhere near 2^61 words. - wordCount = assumeBits<61>(wordCount + other.wordCount); - capCount += other.capCount; - return *this; - } - - void addWords(WordCountN<61, uint64_t> other) { - wordCount = assumeBits<61>(wordCount + other); - } - - MessageSize asPublic() { - return MessageSize { unbound(wordCount / WORDS), capCount }; - } -}; - -// ============================================================================= - -template -union AlignedData { - // Useful for declaring static constant data blobs as an array of bytes, but forcing those - // bytes to be word-aligned. - - uint8_t bytes[wordCount * sizeof(word)]; - word words[wordCount]; -}; - -struct StructSize { - StructDataWordCount data; - StructPointerCount pointers; - - inline constexpr WordCountN<17> total() const { return data + pointers * WORDS_PER_POINTER; } - - StructSize() = default; - inline constexpr StructSize(StructDataWordCount data, StructPointerCount pointers) - : data(data), pointers(pointers) {} -}; - -template -inline constexpr StructSize structSize() { - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize( - dataBitsPerElement(elementSizeForType()) * ELEMENTS > ZERO * BITS - ? StructDataWordCount(ONE * WORDS) : StructDataWordCount(ZERO * WORDS), - pointersPerElement(elementSizeForType()) * ELEMENTS); -} - -// ------------------------------------------------------------------- -// Masking of default values - -template struct Mask_; -template struct Mask_ { typedef T Type; }; -template struct Mask_ { typedef uint16_t Type; }; -template <> struct Mask_ { typedef uint32_t Type; }; -template <> struct Mask_ { typedef uint64_t Type; }; - -template struct Mask_ { - // Union discriminants end up here. - static_assert(sizeof(T) == 2, "Don't know how to mask this type."); - typedef uint16_t Type; -}; - -template -using Mask = typename Mask_::Type; - -template -KJ_ALWAYS_INLINE(Mask mask(T value, Mask mask)); -template -KJ_ALWAYS_INLINE(T unmask(Mask value, Mask mask)); - -template -inline Mask mask(T value, Mask mask) { - return static_cast >(value) ^ mask; -} - -template <> -inline uint32_t mask(float value, uint32_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7fc00000u ^ mask; - } -#endif - - uint32_t i; - static_assert(sizeof(i) == sizeof(value), "float is not 32 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template <> -inline uint64_t mask(double value, uint64_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7ff8000000000000ull ^ mask; - } -#endif - - uint64_t i; - static_assert(sizeof(i) == sizeof(value), "double is not 64 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template -inline T unmask(Mask value, Mask mask) { - return static_cast(value ^ mask); -} - -template <> -inline float unmask(uint32_t value, uint32_t mask) { - value ^= mask; - float result; - static_assert(sizeof(result) == sizeof(value), "float is not 32 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -template <> -inline double unmask(uint64_t value, uint64_t mask) { - value ^= mask; - double result; - static_assert(sizeof(result) == sizeof(value), "double is not 64 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -// ------------------------------------------------------------------- - -class CapTableReader { -public: -#if !CAPNP_LITE - virtual kj::Maybe> extractCap(uint index) = 0; - // Extract the capability at the given index. If the index is invalid, returns null. -#endif // !CAPNP_LITE -}; - -class CapTableBuilder: public CapTableReader { -public: -#if !CAPNP_LITE - virtual uint injectCap(kj::Own&& cap) = 0; - // Add the capability to the message and return its index. If the same ClientHook is injected - // twice, this may return the same index both times, but in this case dropCap() needs to be - // called an equal number of times to actually remove the cap. - - virtual void dropCap(uint index) = 0; - // Remove a capability injected earlier. Called when the pointer is overwritten or zero'd out. -#endif // !CAPNP_LITE -}; - -// ------------------------------------------------------------------- - -class PointerBuilder: public kj::DisallowConstCopy { - // Represents a single pointer, usually embedded in a struct or a list. - -public: - inline PointerBuilder(): segment(nullptr), capTable(nullptr), pointer(nullptr) {} - - static inline PointerBuilder getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location); - // Get a PointerBuilder representing a message root located in the given segment at the given - // location. - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructBuilder getStruct(StructSize size, const word* defaultValue); - ListBuilder getList(ElementSize elementSize, const word* defaultValue); - ListBuilder getStructList(StructSize elementSize, const word* defaultValue); - ListBuilder getListAnySize(const word* defaultValue); - template typename T::Builder getBlob( - const void* defaultValue, ByteCount defaultSize); -#if !CAPNP_LITE - kj::Own getCapability(); -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, initialize it to a copy of the default value. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - StructBuilder initStruct(StructSize size); - ListBuilder initList(ElementSize elementSize, ElementCount elementCount); - ListBuilder initStructList(ElementCount elementCount, StructSize size); - template typename T::Builder initBlob(ByteCount size); - // Init methods: Initialize the pointer to a newly-allocated object, discarding the existing - // object. - - void setStruct(const StructReader& value, bool canonical = false); - void setList(const ListReader& value, bool canonical = false); - template void setBlob(typename T::Reader value); -#if !CAPNP_LITE - void setCapability(kj::Own&& cap); -#endif // !CAPNP_LITE - // Set methods: Initialize the pointer to a newly-allocated copy of the given value, discarding - // the existing object. - - void adopt(OrphanBuilder&& orphan); - // Set the pointer to point at the given orphaned value. - - OrphanBuilder disown(); - // Set the pointer to null and return its previous value as an orphan. - - void clear(); - // Clear the pointer to null, discarding its previous value. - - void transferFrom(PointerBuilder other); - // Equivalent to `adopt(other.disown())`. - - void copyFrom(PointerReader other, bool canonical = false); - // Equivalent to `set(other.get())`. - // If you set the canonical flag, it will attempt to lay the target out - // canonically, provided enough space is available. - - PointerReader asReader() const; - - BuilderArena* getArena() const; - // Get the arena containing this pointer. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the pointer resides. - CapTableBuilder* capTable; // Table of capability indexes. - WirePointer* pointer; // Pointer to the pointer. - - inline PointerBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, WirePointer* pointer) - : segment(segment), capTable(capTable), pointer(pointer) {} - - friend class StructBuilder; - friend class ListBuilder; - friend class OrphanBuilder; -}; - -class PointerReader { -public: - inline PointerReader() - : segment(nullptr), capTable(nullptr), pointer(nullptr), nestingLimit(0x7fffffff) {} - - static PointerReader getRoot(SegmentReader* segment, CapTableReader* capTable, - const word* location, int nestingLimit); - // Get a PointerReader representing a message root located in the given segment at the given - // location. - - static inline PointerReader getRootUnchecked(const word* location); - // Get a PointerReader for an unchecked message. - - MessageSizeCounts targetSize() const; - // Return the total size of the target object and everything to which it points. Does not count - // far pointer overhead. This is useful for deciding how much space is needed to copy the object - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructReader getStruct(const word* defaultValue) const; - ListReader getList(ElementSize expectedElementSize, const word* defaultValue) const; - ListReader getListAnySize(const word* defaultValue) const; - template - typename T::Reader getBlob(const void* defaultValue, ByteCount defaultSize) const; -#if !CAPNP_LITE - kj::Own getCapability() const; -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, return the default value instead. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - const word* getUnchecked() const; - // If this is an unchecked message, get a word* pointing at the location of the pointer. This - // word* can actually be passed to readUnchecked() to read the designated sub-object later. If - // this isn't an unchecked message, throws an exception. - - kj::Maybe getArena() const; - // Get the arena containing this pointer. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the pointer resides. - CapTableReader* capTable; // Table of capability indexes. - const WirePointer* pointer; // Pointer to the pointer. null = treat as null pointer. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline PointerReader(SegmentReader* segment, CapTableReader* capTable, - const WirePointer* pointer, int nestingLimit) - : segment(segment), capTable(capTable), pointer(pointer), nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListReader; - friend class PointerBuilder; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class StructBuilder: public kj::DisallowConstCopy { -public: - inline StructBuilder(): segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr) {} - - inline word* getLocation() { return reinterpret_cast(data); } - // Get the object's location. Only valid for independently-allocated objects (i.e. not list - // elements). - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListBuilder getPointerSectionAsList(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset)); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset)); - // Gets the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask)); - // Like getDataField() but applies the given XOR mask to the data on load. Used for reading - // fields with non-zero default values. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, kj::NoInfer value)); - // Sets the data field value at the given offset. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, - kj::NoInfer value, Mask mask)); - // Like setDataField() but applies the given XOR mask before storing. Used for writing fields - // with non-zero default values. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerField(StructPointerOffset ptrIndex)); - // Get a builder for a pointer field given the index within the pointer section. - - void clearAll(); - // Clear all pointers and data. - - void transferContentFrom(StructBuilder other); - // Adopt all pointers from `other`, and also copy all data. If `other`'s sections are larger - // than this, the extra data is not transferred, meaning there is a risk of data loss when - // transferring from messages built with future versions of the protocol. - - void copyContentFrom(StructReader other); - // Copy content from `other`. If `other`'s sections are larger than this, the extra data is not - // copied, meaning there is a risk of data loss when copying from messages built with future - // versions of the protocol. - - StructReader asReader() const; - // Gets a StructReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - StructBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the struct resides. - CapTableBuilder* capTable; // Table of capability indexes. - void* data; // Pointer to the encoded data. - WirePointer* pointers; // Pointer to the encoded pointers. - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - inline StructBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, - void* data, WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount) {} - - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class StructReader { -public: - inline StructReader() - : segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr), - dataSize(ZERO * BITS), pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - inline StructReader(kj::ArrayPtr data) - : segment(nullptr), capTable(nullptr), data(data.begin()), pointers(nullptr), - dataSize(assumeBits(data.size()) * WORDS * BITS_PER_WORD), - pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - - const void* getLocation() const { return data; } - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListReader getPointerSectionAsList(); - - kj::Array canonicalize(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset) const); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset) const); - // Get the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. Returns zero if the offset is past the - // end of the struct's data section. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask) const); - // Like getDataField(offset), but applies the given XOR mask to the result. Used for reading - // fields with non-zero default values. - - KJ_ALWAYS_INLINE(PointerReader getPointerField(StructPointerOffset ptrIndex) const); - // Get a reader for a pointer field given the index within the pointer section. If the index - // is out-of-bounds, returns a null pointer. - - MessageSizeCounts totalSize() const; - // Return the total size of the struct and everything to which it points. Does not count far - // pointer overhead. This is useful for deciding how much space is needed to copy the struct - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - StructReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const word **ptrHead, - bool *dataTrunc, bool *ptrTrunc); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - // - // If this function returns false, the struct is non-canonical. If it - // returns true, then: - // * If it is a composite in a list, it is canonical if at least one struct - // in the list outputs dataTrunc = 1, and at least one outputs ptrTrunc = 1 - // * If it is derived from a struct pointer, it is canonical if - // dataTrunc = 1 AND ptrTrunc = 1 - -private: - SegmentReader* segment; // Memory segment in which the struct resides. - CapTableReader* capTable; // Table of capability indexes. - - const void* data; - const WirePointer* pointers; - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - // TODO(perf): Limit to 16 bits for better packing? - - inline StructReader(SegmentReader* segment, CapTableReader* capTable, - const void* data, const WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount, - int nestingLimit) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount), - nestingLimit(nestingLimit) {} - - friend class ListReader; - friend class StructBuilder; - friend struct WireHelpers; -}; - -// ------------------------------------------------------------------- - -class ListBuilder: public kj::DisallowConstCopy { -public: - inline explicit ListBuilder(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize) {} - - inline word* getLocation() { - // Get the object's location. - - if (elementSize == ElementSize::INLINE_COMPOSITE && ptr != nullptr) { - return reinterpret_cast(ptr) - POINTER_SIZE_IN_WORDS; - } else { - return reinterpret_cast(ptr); - } - } - - inline ElementSize getElementSize() const { return elementSize; } - - inline ListElementCount size() const; - // The number of elements in the list. - - Text::Builder asText(); - Data::Builder asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index)); - // Get the element of the given type at the given index. - - template - KJ_ALWAYS_INLINE(void setDataElement(ElementCount index, kj::NoInfer value)); - // Set the element at the given index. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerElement(ElementCount index)); - - StructBuilder getStructElement(ElementCount index); - - ListReader asReader() const; - // Get a ListReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - ListBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the list resides. - CapTableBuilder* capTable; // Table of capability indexes. - - byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 128 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - inline ListBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, void* ptr, - BitsPerElementN<23> step, ListElementCount size, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(size), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize) {} - - friend class StructBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class ListReader { -public: - inline explicit ListReader(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize), nestingLimit(0x7fffffff) {} - - inline ListElementCount size() const; - // The number of elements in the list. - - inline ElementSize getElementSize() const { return elementSize; } - - Text::Reader asText(); - Data::Reader asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - kj::ArrayPtr asRawBytes(); - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index) const); - // Get the element of the given type at the given index. - - KJ_ALWAYS_INLINE(PointerReader getPointerElement(ElementCount index) const); - - StructReader getStructElement(ElementCount index) const; - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - ListReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const WirePointer* ref); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the list resides. - CapTableReader* capTable; // Table of capability indexes. - - const byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 2 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline ListReader(SegmentReader* segment, CapTableReader* capTable, const void* ptr, - ListElementCount elementCount, BitsPerElementN<23> step, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize, int nestingLimit) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(elementCount), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize), - nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class OrphanBuilder { -public: - inline OrphanBuilder(): segment(nullptr), capTable(nullptr), location(nullptr) { - memset(&tag, 0, sizeof(tag)); - } - OrphanBuilder(const OrphanBuilder& other) = delete; - inline OrphanBuilder(OrphanBuilder&& other) noexcept; - inline ~OrphanBuilder() noexcept(false); - - static OrphanBuilder initStruct(BuilderArena* arena, CapTableBuilder* capTable, StructSize size); - static OrphanBuilder initList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, ElementSize elementSize); - static OrphanBuilder initStructList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, StructSize elementSize); - static OrphanBuilder initText(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - static OrphanBuilder initData(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, StructReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, ListReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, PointerReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Text::Reader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Data::Reader copyFrom); -#if !CAPNP_LITE - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, - kj::Own copyFrom); -#endif // !CAPNP_LITE - - static OrphanBuilder concat(BuilderArena* arena, CapTableBuilder* capTable, - ElementSize expectedElementSize, StructSize expectedStructSize, - kj::ArrayPtr lists); - - static OrphanBuilder referenceExternalData(BuilderArena* arena, Data::Reader data); - - OrphanBuilder& operator=(const OrphanBuilder& other) = delete; - inline OrphanBuilder& operator=(OrphanBuilder&& other); - - inline bool operator==(decltype(nullptr)) const { return location == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return location != nullptr; } - - StructBuilder asStruct(StructSize size); - // Interpret as a struct, or throw an exception if not a struct. - - ListBuilder asList(ElementSize elementSize); - // Interpret as a list, or throw an exception if not a list. elementSize cannot be - // INLINE_COMPOSITE -- use asStructList() instead. - - ListBuilder asStructList(StructSize elementSize); - // Interpret as a struct list, or throw an exception if not a list. - - ListBuilder asListAnySize(); - // For AnyList. - - Text::Builder asText(); - Data::Builder asData(); - // Interpret as a blob, or throw an exception if not a blob. - - StructReader asStructReader(StructSize size) const; - ListReader asListReader(ElementSize elementSize) const; - ListReader asListReaderAnySize() const; -#if !CAPNP_LITE - kj::Own asCapability() const; -#endif // !CAPNP_LITE - Text::Reader asTextReader() const; - Data::Reader asDataReader() const; - - bool truncate(ElementCount size, bool isText) KJ_WARN_UNUSED_RESULT; - // Resize the orphan list to the given size. Returns false if the list is currently empty but - // the requested size is non-zero, in which case the caller will need to allocate a new list. - - void truncate(ElementCount size, ElementSize elementSize); - void truncate(ElementCount size, StructSize elementSize); - void truncateText(ElementCount size); - // Versions of truncate() that know how to allocate a new list if needed. - -private: - static_assert(ONE * POINTERS * WORDS_PER_POINTER == ONE * WORDS, - "This struct assumes a pointer is one word."); - word tag; - // Contains an encoded WirePointer representing this object. WirePointer is defined in - // layout.c++, but fits in a word. - // - // This may be a FAR pointer. Even in that case, `location` points to the eventual destination - // of that far pointer. The reason we keep the far pointer around rather than just making `tag` - // represent the final destination is because if the eventual adopter of the pointer is not in - // the target's segment then it may be useful to reuse the far pointer landing pad. - // - // If `tag` is not a far pointer, its offset is garbage; only `location` points to the actual - // target. - - SegmentBuilder* segment; - // Segment in which the object resides. - - CapTableBuilder* capTable; - // Table of capability indexes. - - word* location; - // Pointer to the object, or nullptr if the pointer is null. For capabilities, we make this - // 0x1 just so that it is non-null for operator==, but it is never used. - - inline OrphanBuilder(const void* tagPtr, SegmentBuilder* segment, - CapTableBuilder* capTable, word* location) - : segment(segment), capTable(capTable), location(location) { - memcpy(&tag, tagPtr, sizeof(tag)); - } - - inline WirePointer* tagAsPtr() { return reinterpret_cast(&tag); } - inline const WirePointer* tagAsPtr() const { return reinterpret_cast(&tag); } - - void euthanize(); - // Erase the target object, zeroing it out and possibly reclaiming the memory. Called when - // the OrphanBuilder is being destroyed or overwritten and it is non-null. - - friend struct WireHelpers; -}; - -// ======================================================================================= -// Internal implementation details... - -// These are defined in the source file. -template <> typename Text::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Text::Reader value); -template <> typename Text::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Text::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -template <> typename Data::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Data::Reader value); -template <> typename Data::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Data::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -inline PointerBuilder PointerBuilder::getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location) { - return PointerBuilder(segment, capTable, reinterpret_cast(location)); -} - -inline PointerReader PointerReader::getRootUnchecked(const word* location) { - return PointerReader(nullptr, nullptr, - reinterpret_cast(location), 0x7fffffff); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructBuilder::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListBuilder StructBuilder::getPointerSectionAsList() { - return _::ListBuilder(segment, capTable, pointers, ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, - pointerCount * (ONE * ELEMENTS / POINTERS), - ZERO * BITS, ONE * POINTERS, ElementSize::POINTER); -} - -template -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return false; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); -} - -template <> -inline bool StructBuilder::getDataField(StructDataOffset offset) { - BitCount32 boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void StructBuilder::getDataField(StructDataOffset offset) { - return VOID; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset, Mask mask) { - return unmask(getDataField >(offset), mask); -} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, kj::NoInfer value) { - reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, float value) { - setDataField(offset, mask(value, 0)); -} -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, double value) { - setDataField(offset, mask(value, 0)); -} -#endif - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, bool value) { - auto boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - uint bitnum = unboundMaxBits<3>(boffset % BITS_PER_BYTE / BITS); - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << bitnum)) - | (static_cast(value) << bitnum); -} - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, Void value) {} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, - kj::NoInfer value, Mask m) { - setDataField >(offset, mask(value, m)); -} - -inline PointerBuilder StructBuilder::getPointerField(StructPointerOffset ptrIndex) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerBuilder(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER)); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructReader::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListReader StructReader::getPointerSectionAsList() { - return _::ListReader(segment, capTable, pointers, pointerCount * (ONE * ELEMENTS / POINTERS), - ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, ZERO * BITS, ONE * POINTERS, - ElementSize::POINTER, nestingLimit); -} - -template -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return false; -} - -template -inline T StructReader::getDataField(StructDataOffset offset) const { - if ((offset + ONE * ELEMENTS) * capnp::bitsPerElement() <= dataSize) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); - } else { - return static_cast(0); - } -} - -template <> -inline bool StructReader::getDataField(StructDataOffset offset) const { - auto boffset = offset * (ONE * BITS / ELEMENTS); - if (boffset < dataSize) { - const byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; - } else { - return false; - } -} - -template <> -inline Void StructReader::getDataField(StructDataOffset offset) const { - return VOID; -} - -template -T StructReader::getDataField(StructDataOffset offset, Mask mask) const { - return unmask(getDataField >(offset), mask); -} - -inline PointerReader StructReader::getPointerField(StructPointerOffset ptrIndex) const { - if (ptrIndex < pointerCount) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerReader(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER), nestingLimit); - } else{ - return PointerReader(); - } -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListBuilder::size() const { return elementCount; } - -template -inline T ListBuilder::getDataElement(ElementCount index) { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); - - // TODO(perf): Benchmark this alternate implementation, which I suspect may make better use of - // the x86 SIB byte. Also use it for all the other getData/setData implementations below, and - // the various non-inline methods that look up pointers. - // Also if using this, consider changing ptr back to void* instead of byte*. -// return reinterpret_cast*>(ptr)[ -// index / ELEMENTS * (step / capnp::bitsPerElement())].get(); -} - -template <> -inline bool ListBuilder::getDataElement(ElementCount index) { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListBuilder::getDataElement(ElementCount index) { - return VOID; -} - -template -inline void ListBuilder::setDataElement(ElementCount index, kj::NoInfer value) { - reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void ListBuilder::setDataElement(ElementCount index, float value) { - setDataElement(index, mask(value, 0)); -} -template <> -inline void ListBuilder::setDataElement(ElementCount index, double value) { - setDataElement(index, mask(value, 0)); -} -#endif - -template <> -inline void ListBuilder::setDataElement(ElementCount index, bool value) { - // Ignore stepBytes for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - auto bitnum = bindex % BITS_PER_BYTE / BITS; - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << unbound(bitnum))) - | (static_cast(value) << unbound(bitnum)); -} - -template <> -inline void ListBuilder::setDataElement(ElementCount index, Void value) {} - -inline PointerBuilder ListBuilder::getPointerElement(ElementCount index) { - return PointerBuilder(segment, capTable, reinterpret_cast(ptr + - upgradeBound(index) * step / BITS_PER_BYTE)); -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListReader::size() const { return elementCount; } - -template -inline T ListReader::getDataElement(ElementCount index) const { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); -} - -template <> -inline bool ListReader::getDataElement(ElementCount index) const { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - const byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListReader::getDataElement(ElementCount index) const { - return VOID; -} - -inline PointerReader ListReader::getPointerElement(ElementCount index) const { - return PointerReader(segment, capTable, reinterpret_cast( - ptr + upgradeBound(index) * step / BITS_PER_BYTE), nestingLimit); -} - -// ------------------------------------------------------------------- - -inline OrphanBuilder::OrphanBuilder(OrphanBuilder&& other) noexcept - : segment(other.segment), capTable(other.capTable), location(other.location) { - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; -} - -inline OrphanBuilder::~OrphanBuilder() noexcept(false) { - if (segment != nullptr) euthanize(); -} - -inline OrphanBuilder& OrphanBuilder::operator=(OrphanBuilder&& other) { - // With normal smart pointers, it's important to handle the case where the incoming pointer - // is actually transitively owned by this one. In this case, euthanize() would destroy `other` - // before we copied it. This isn't possible in the case of `OrphanBuilder` because it only - // owns message objects, and `other` is not itself a message object, therefore cannot possibly - // be transitively owned by `this`. - - if (segment != nullptr) euthanize(); - segment = other.segment; - capTable = other.capTable; - location = other.location; - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; - return *this; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_LAYOUT_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/list.h b/phonelibs/capnp-cpp/include/capnp/list.h deleted file mode 100644 index 23e5e6c10e..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/list.h +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_LIST_H_ -#define CAPNP_LIST_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "orphan.h" -#include -#ifdef KJ_STD_COMPAT -#include -#endif // KJ_STD_COMPAT - -namespace capnp { -namespace _ { // private - -template -class TemporaryPointer { - // This class is a little hack which lets us define operator->() in cases where it needs to - // return a pointer to a temporary value. We instead construct a TemporaryPointer and return that - // (by value). The compiler then invokes operator->() on the TemporaryPointer, which itself is - // able to return a real pointer to its member. - -public: - TemporaryPointer(T&& value): value(kj::mv(value)) {} - TemporaryPointer(const T& value): value(value) {} - - inline T* operator->() { return &value; } -private: - T value; -}; - -template -class IndexingIterator { -public: - IndexingIterator() = default; - - inline Element operator*() const { return (*container)[index]; } - inline TemporaryPointer operator->() const { - return TemporaryPointer((*container)[index]); - } - inline Element operator[]( int off) const { return (*container)[index]; } - inline Element operator[](uint off) const { return (*container)[index]; } - - inline IndexingIterator& operator++() { ++index; return *this; } - inline IndexingIterator operator++(int) { IndexingIterator other = *this; ++index; return other; } - inline IndexingIterator& operator--() { --index; return *this; } - inline IndexingIterator operator--(int) { IndexingIterator other = *this; --index; return other; } - - inline IndexingIterator operator+(uint amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-(uint amount) const { return IndexingIterator(container, index - amount); } - inline IndexingIterator operator+( int amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-( int amount) const { return IndexingIterator(container, index - amount); } - - inline int operator-(const IndexingIterator& other) const { return index - other.index; } - - inline IndexingIterator& operator+=(uint amount) { index += amount; return *this; } - inline IndexingIterator& operator-=(uint amount) { index -= amount; return *this; } - inline IndexingIterator& operator+=( int amount) { index += amount; return *this; } - inline IndexingIterator& operator-=( int amount) { index -= amount; return *this; } - - // STL says comparing iterators of different containers is not allowed, so we only compare - // indices here. - inline bool operator==(const IndexingIterator& other) const { return index == other.index; } - inline bool operator!=(const IndexingIterator& other) const { return index != other.index; } - inline bool operator<=(const IndexingIterator& other) const { return index <= other.index; } - inline bool operator>=(const IndexingIterator& other) const { return index >= other.index; } - inline bool operator< (const IndexingIterator& other) const { return index < other.index; } - inline bool operator> (const IndexingIterator& other) const { return index > other.index; } - -private: - Container* container; - uint index; - - friend Container; - inline IndexingIterator(Container* container, uint index) - : container(container), index(index) {} -}; - -} // namespace _ (private) - -template -struct List { - // List of primitives. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(_::elementSizeForType()) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline T operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.template getDataElement(bounded(index) * ELEMENTS); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(_::elementSizeForType()) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline T operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.template getDataElement(bounded(index) * ELEMENTS); - } - inline void set(uint index, T value) { - // Alas, it is not possible to make operator[] return a reference to which you can assign, - // since the encoded representation does not necessarily match the compiler's representation - // of the type. We can't even return a clever class that implements operator T() and - // operator=() because it will lead to surprising behavior when using type inference (e.g. - // calling a template function with inferred argument types, or using "auto" or "decltype"). - - builder.template setDataElement(bounded(index) * ELEMENTS, value); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(_::elementSizeForType(), bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(_::elementSizeForType(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(_::elementSizeForType(), defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List: public List {}; - -template -struct List { - // List of structs. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::INLINE_COMPOSITE) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - inline void adoptWithCaveats(uint index, Orphan&& orphan) { - // Mostly behaves like you'd expect `adopt` to behave, but with two caveats originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // * This actually performs a shallow copy, effectively adopting each of the orphan's - // children rather than adopting the orphan itself. The orphan ends up being discarded, - // possibly wasting space in the message object. - // * If the orphan is larger than the target struct -- say, because the orphan was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - - KJ_IREQUIRE(index < size()); - - // We pass a zero-valued StructSize to asStruct() because we do not want the struct to be - // expanded under any circumstances. We're just going to throw it away anyway, and - // transferContentFrom() already carefully compares the struct sizes before transferring. - builder.getStructElement(bounded(index) * ELEMENTS).transferContentFrom( - orphan.builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - inline void setWithCaveats(uint index, const typename T::Reader& reader) { - // Mostly behaves like you'd expect `set` to behave, but with a caveat originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // If the source struct is larger than the target struct -- say, because the source was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - // - // Note: If you are trying to concatenate some lists, use Orphanage::newOrphanConcat() to - // do it without losing any data in case the source lists come from a newer version of the - // protocol. (Plus, it's easier to use anyhow.) - - KJ_IREQUIRE(index < size()); - builder.getStructElement(bounded(index) * ELEMENTS).copyContentFrom(reader._reader); - } - - // There are no init(), set(), adopt(), or disown() methods for lists of structs because the - // elements of the list are inlined and are initialized when the list is initialized. This - // means that init() would be redundant, and set() would risk data loss if the input struct - // were from a newer version of the protocol. - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initStructList(bounded(size) * ELEMENTS, _::structSize()); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getStructList(_::structSize(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::INLINE_COMPOSITE, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List, Kind::LIST> { - // List of lists. - - List() = delete; - - class Reader { - public: - typedef List> Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename List::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename List::Reader(_::PointerHelpers>::get( - reader.getPointerElement(bounded(index) * ELEMENTS))); - } - - typedef _::IndexingIterator::Reader> Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List> Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename List::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename List::Builder(_::PointerHelpers>::get( - builder.getPointerElement(bounded(index) * ELEMENTS))); - } - inline typename List::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return typename List::Builder(_::PointerHelpers>::init( - builder.getPointerElement(bounded(index) * ELEMENTS), size)); - } - inline void set(uint index, typename List::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setList(value.reader); - } - void set(uint index, std::initializer_list> value) { - KJ_IREQUIRE(index < size()); - auto l = init(index, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator::Builder> Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - inline void set(uint index, typename T::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).template setBlob(value); - } - inline typename T::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template initBlob(bounded(size) * BYTES); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -} // namespace capnp - -#ifdef KJ_STD_COMPAT -namespace std { - -template -struct iterator_traits> - : public std::iterator {}; - -} // namespace std -#endif // KJ_STD_COMPAT - -#endif // CAPNP_LIST_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/membrane.h b/phonelibs/capnp-cpp/include/capnp/membrane.h deleted file mode 100644 index 6fa8a1335d..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/membrane.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_MEMBRANE_H_ -#define CAPNP_MEMBRANE_H_ -// In capability theory, a "membrane" is a wrapper around a capability which (usually) forwards -// calls but recursively wraps capabilities in those calls in the same membrane. The purpose of a -// membrane is to enforce a barrier between two capabilities that cannot be bypassed by merely -// introducing new objects. -// -// The most common use case for a membrane is revocation: Say Alice wants to give Bob a capability -// to access Carol, but wants to be able to revoke this capability later. Alice can accomplish this -// by wrapping Carol in a revokable wrapper which passes through calls until such a time as Alice -// indicates it should be revoked, after which all calls through the wrapper will throw exceptions. -// However, a naive wrapper approach has a problem: if Bob makes a call to Carol and sends a new -// capability in that call, or if Carol returns a capability to Bob in the response to a call, then -// the two are now able to communicate using this new capability, which Alice cannot revoke. In -// order to avoid this problem, Alice must use not just a wrapper but a "membrane", which -// recursively wraps all objects that pass through it in either direction. Thus, all connections -// formed between Bob and Carol (originating from Alice's original introduction) can be revoked -// together by revoking the membrane. -// -// Note that when a capability is passed into a membrane and then passed back out, the result is -// the original capability, not a double-membraned capability. This means that in our revocation -// example, if Bob uses his capability to Carol to obtain another capability from her, then send -// it back to her, the capability Carol receives back will NOT be revoked when Bob's access to -// Carol is revoked. Thus Bob can create long-term irrevocable connections. In most practical use -// cases, this is what you want. APIs commonly rely on the fact that a capability obtained and then -// passed back can be recognized as the original capability. -// -// Mark Miller on membranes: http://www.eros-os.org/pipermail/e-lang/2003-January/008434.html - -#include "capability.h" - -namespace capnp { - -class MembranePolicy { - // Applications may implement this interface to define a membrane policy, which allows some - // calls crossing the membrane to be blocked or redirected. - -public: - virtual kj::Maybe inboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Given an inbound call (a call originating "outside" the membrane destined for an object - // "inside" the membrane), decides what to do with it. The policy may: - // - // - Return null to indicate that the call should proceed to the destination. All capabilities - // in the parameters or result will be properly wrapped in the same membrane. - // - Return a capability to have the call redirected to that capability. Note that the redirect - // capability will be treated as outside the membrane, so the params and results will not be - // auto-wrapped; however, the callee can easily wrap the returned capability in the membrane - // itself before returning to achieve this effect. - // - Throw an exception to cause the call to fail with that exception. - // - // `target` is the underlying capability (*inside* the membrane) for which the call is destined. - // Generally, the only way you should use `target` is to wrap it in some capability which you - // return as a redirect. The redirect capability may modify the call in some way and send it to - // `target`. Be careful to use `copyIntoMembrane()` and `copyOutOfMembrane()` as appropriate when - // copying parameters or results across the membrane. - // - // Note that since `target` is inside the capability, if you were to directly return it (rather - // than return null), the effect would be that the membrane would be broken: the call would - // proceed directly and any new capabilities introduced through it would not be membraned. You - // generally should not do that. - - virtual kj::Maybe outboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Like `inboundCall()`, but applies to calls originating *inside* the membrane and terminating - // outside. - // - // Note: It is strongly recommended that `outboundCall()` returns null in exactly the same cases - // that `inboundCall()` return null. Conversely, for any case where `inboundCall()` would - // redirect or throw, `outboundCall()` should also redirect or throw. Otherwise, you can run - // into inconsistent behavion when a promise is returned across a membrane, and that promise - // later resolves to a capability on the other side of the membrane: calls on the promise - // will enter and then exit the membrane, but calls on the eventual resolution will not cross - // the membrane at all, so it is important that these two cases behave the same. - - virtual kj::Own addRef() = 0; - // Return a new owned pointer to the same policy. - // - // Typically an implementation of MembranePolicy should also inherit kj::Refcounted and implement - // `addRef()` as `return kj::addRef(*this);`. - // - // Note that the membraning system considers two membranes created with the same MembranePolicy - // object actually to be the *same* membrane. This is relevant when an object passes into the - // membrane and then back out (or out and then back in): instead of double-wrapping the object, - // the wrapping will be removed. -}; - -Capability::Client membrane(Capability::Client inner, kj::Own policy); -// Wrap `inner` in a membrane specified by `policy`. `inner` is considered "inside" the membrane, -// while the returned capability should only be called from outside the membrane. - -Capability::Client reverseMembrane(Capability::Client outer, kj::Own policy); -// Like `membrane` but treat the input capability as "outside" the membrane, and return a -// capability appropriate for use inside. -// -// Applications typically won't use this directly; the membraning code automatically sets up -// reverse membranes where needed. - -template -ClientType membrane(ClientType inner, kj::Own policy); -template -ClientType reverseMembrane(ClientType inner, kj::Own policy); -// Convenience templates which return the same interface type as the input. - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy); -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy); -// Convenience templates which input a capability server type and return the appropriate client -// type. - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Copy a Cap'n Proto object (e.g. struct or list), adding the given membrane to any capabilities -// found within it. `from` is interpreted as "outside" the membrane while `to` is "inside". - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Like copyIntoMembrane() except that `from` is "inside" the membrane and `to` is "outside". - -// ======================================================================================= -// inline implementation details - -template -ClientType membrane(ClientType inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -ClientType reverseMembrane(ClientType inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -namespace _ { // private - -OrphanBuilder copyOutOfMembrane(PointerReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(StructReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(ListReader from, Orphanage to, - kj::Own policy, bool reverse); - -} // namespace _ (private) - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), true); -} - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), false); -} - -} // namespace capnp - -#endif // CAPNP_MEMBRANE_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/message.h b/phonelibs/capnp-cpp/include/capnp/message.h deleted file mode 100644 index b4d5e9fc82..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/message.h +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include -#include -#include -#include -#include "common.h" -#include "layout.h" -#include "any.h" - -#ifndef CAPNP_MESSAGE_H_ -#define CAPNP_MESSAGE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -namespace capnp { - -namespace _ { // private - class ReaderArena; - class BuilderArena; -} - -class StructSchema; -class Orphanage; -template -class Orphan; - -// ======================================================================================= - -struct ReaderOptions { - // Options controlling how data is read. - - uint64_t traversalLimitInWords = 8 * 1024 * 1024; - // Limits how many total words of data are allowed to be traversed. Traversal is counted when - // a new struct or list builder is obtained, e.g. from a get() accessor. This means that calling - // the getter for the same sub-struct multiple times will cause it to be double-counted. Once - // the traversal limit is reached, an error will be reported. - // - // This limit exists for security reasons. It is possible for an attacker to construct a message - // in which multiple pointers point at the same location. This is technically invalid, but hard - // to detect. Using such a message, an attacker could cause a message which is small on the wire - // to appear much larger when actually traversed, possibly exhausting server resources leading to - // denial-of-service. - // - // It makes sense to set a traversal limit that is much larger than the underlying message. - // Together with sensible coding practices (e.g. trying to avoid calling sub-object getters - // multiple times, which is expensive anyway), this should provide adequate protection without - // inconvenience. - // - // The default limit is 64 MiB. This may or may not be a sensible number for any given use case, - // but probably at least prevents easy exploitation while also avoiding causing problems in most - // typical cases. - - int nestingLimit = 64; - // Limits how deeply-nested a message structure can be, e.g. structs containing other structs or - // lists of structs. - // - // Like the traversal limit, this limit exists for security reasons. Since it is common to use - // recursive code to traverse recursive data structures, an attacker could easily cause a stack - // overflow by sending a very-deeply-nested (or even cyclic) message, without the message even - // being very large. The default limit of 64 is probably low enough to prevent any chance of - // stack overflow, yet high enough that it is never a problem in practice. -}; - -class MessageReader { - // Abstract interface for an object used to read a Cap'n Proto message. Subclasses of - // MessageReader are responsible for reading the raw, flat message content. Callers should - // usually call `messageReader.getRoot()` to get a `MyStructType::Reader` - // representing the root of the message, then use that to traverse the message content. - // - // Some common subclasses of `MessageReader` include `SegmentArrayMessageReader`, whose - // constructor accepts pointers to the raw data, and `StreamFdMessageReader` (from - // `serialize.h`), which reads the message from a file descriptor. One might implement other - // subclasses to handle things like reading from shared memory segments, mmap()ed files, etc. - -public: - MessageReader(ReaderOptions options); - // It is suggested that subclasses take ReaderOptions as a constructor parameter, but give it a - // default value of "ReaderOptions()". The base class constructor doesn't have a default value - // in order to remind subclasses that they really need to give the user a way to provide this. - - virtual ~MessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) = 0; - // Gets the segment with the given ID, or returns null if no such segment exists. This method - // will be called at most once for each segment ID. - - inline const ReaderOptions& getOptions(); - // Get the options passed to the constructor. - - template - typename RootType::Reader getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Reader getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - bool isCanonical(); - // Returns whether the message encoded in the reader is in canonical form. - -private: - ReaderOptions options; - - // Space in which we can construct a ReaderArena. We don't use ReaderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a ReaderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - void* arenaSpace[15 + sizeof(kj::MutexGuarded) / sizeof(void*)]; - bool allocatedArena; - - _::ReaderArena* arena() { return reinterpret_cast<_::ReaderArena*>(arenaSpace); } - AnyPointer::Reader getRootInternal(); -}; - -class MessageBuilder { - // Abstract interface for an object used to allocate and build a message. Subclasses of - // MessageBuilder are responsible for allocating the space in which the message will be written. - // The most common subclass is `MallocMessageBuilder`, but other subclasses may be used to do - // tricky things like allocate messages in shared memory or mmap()ed files. - // - // Creating a new message ususually means allocating a new MessageBuilder (ideally on the stack) - // and then calling `messageBuilder.initRoot()` to get a `MyStructType::Builder`. - // That, in turn, can be used to fill in the message content. When done, you can call - // `messageBuilder.getSegmentsForOutput()` to get a list of flat data arrays containing the - // message. - -public: - MessageBuilder(); - virtual ~MessageBuilder() noexcept(false); - KJ_DISALLOW_COPY(MessageBuilder); - - struct SegmentInit { - kj::ArrayPtr space; - - size_t wordsUsed; - // Number of words in `space` which are used; the rest are free space in which additional - // objects may be allocated. - }; - - explicit MessageBuilder(kj::ArrayPtr segments); - // Create a MessageBuilder backed by existing memory. This is an advanced interface that most - // people should not use. THIS METHOD IS INSECURE; see below. - // - // This allows a MessageBuilder to be constructed to modify an in-memory message without first - // making a copy of the content. This is especially useful in conjunction with mmap(). - // - // The contents of each segment must outlive the MessageBuilder, but the SegmentInit array itself - // only need outlive the constructor. - // - // SECURITY: Do not use this in conjunction with untrusted data. This constructor assumes that - // the input message is valid. This constructor is designed to be used with data you control, - // e.g. an mmap'd file which is owned and accessed by only one program. When reading data you - // do not trust, you *must* load it into a Reader and then copy into a Builder as a means of - // validating the content. - // - // WARNING: It is NOT safe to initialize a MessageBuilder in this way from memory that is - // currently in use by another MessageBuilder or MessageReader. Other readers/builders will - // not observe changes to the segment sizes nor newly-allocated segments caused by allocating - // new objects in this message. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) = 0; - // Allocates an array of at least the given number of words, throwing an exception or crashing if - // this is not possible. It is expected that this method will usually return more space than - // requested, and the caller should use that extra space as much as possible before allocating - // more. The returned space remains valid at least until the MessageBuilder is destroyed. - // - // Cap'n Proto will only call this once at a time, so the subclass need not worry about - // thread-safety. - - template - typename RootType::Builder initRoot(); - // Initialize the root struct of the message as the given struct type. - - template - void setRoot(Reader&& value); - // Set the root struct to a deep copy of the given struct. - - template - typename RootType::Builder getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Builder getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - typename RootType::Builder initRoot(SchemaType schema); - // Dynamically init the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - void adoptRoot(Orphan&& orphan); - // Like setRoot() but adopts the orphan without copying. - - kj::ArrayPtr> getSegmentsForOutput(); - // Get the raw data that makes up the message. - - Orphanage getOrphanage(); - - bool isCanonical(); - // Check whether the message builder is in canonical form - -private: - void* arenaSpace[22]; - // Space in which we can construct a BuilderArena. We don't use BuilderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a BuilderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - - bool allocatedArena = false; - // We have to initialize the arena lazily because when we do so we want to allocate the root - // pointer immediately, and this will allocate a segment, which requires a virtual function - // call on the MessageBuilder. We can't do such a call in the constructor since the subclass - // isn't constructed yet. This is kind of annoying because it means that getOrphanage() is - // not thread-safe, but that shouldn't be a huge deal... - - _::BuilderArena* arena() { return reinterpret_cast<_::BuilderArena*>(arenaSpace); } - _::SegmentBuilder* getRootSegment(); - AnyPointer::Builder getRootInternal(); -}; - -template -typename RootType::Reader readMessageUnchecked(const word* data); -// IF THE INPUT IS INVALID, THIS MAY CRASH, CORRUPT MEMORY, CREATE A SECURITY HOLE IN YOUR APP, -// MURDER YOUR FIRST-BORN CHILD, AND/OR BRING ABOUT ETERNAL DAMNATION ON ALL OF HUMANITY. DO NOT -// USE UNLESS YOU UNDERSTAND THE CONSEQUENCES. -// -// Given a pointer to a known-valid message located in a single contiguous memory segment, -// returns a reader for that message. No bounds-checking will be done while traversing this -// message. Use this only if you have already verified that all pointers are valid and in-bounds, -// and there are no far pointers in the message. -// -// To create a message that can be passed to this function, build a message using a MallocAllocator -// whose preferred segment size is larger than the message size. This guarantees that the message -// will be allocated as a single segment, meaning getSegmentsForOutput() returns a single word -// array. That word array is your message; you may pass a pointer to its first word into -// readMessageUnchecked() to read the message. -// -// This can be particularly handy for embedding messages in generated code: you can -// embed the raw bytes (using AlignedData) then make a Reader for it using this. This is the way -// default values are embedded in code generated by the Cap'n Proto compiler. E.g., if you have -// a message MyMessage, you can read its default value like so: -// MyMessage::Reader reader = Message::readMessageUnchecked(MyMessage::DEFAULT.words); -// -// To sanitize a message from an untrusted source such that it can be safely passed to -// readMessageUnchecked(), use copyToUnchecked(). - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer); -// Copy the content of the given reader into the given buffer, such that it can safely be passed to -// readMessageUnchecked(). The buffer's size must be exactly reader.totalSizeInWords() + 1, -// otherwise an exception will be thrown. The buffer must be zero'd before calling. - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data); -// Interprets the given data as a single, data-only struct. Only primitive fields (booleans, -// numbers, and enums) will be readable; all pointers will be null. This is useful if you want -// to use Cap'n Proto as a language/platform-neutral way to pack some bits. -// -// The input is a word array rather than a byte array to enforce alignment. If you have a byte -// array which you know is word-aligned (or if your platform supports unaligned reads and you don't -// mind the performance penalty), then you can use `reinterpret_cast` to convert a byte array into -// a word array: -// -// kj::arrayPtr(reinterpret_cast(bytes.begin()), -// reinterpret_cast(bytes.end())) - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder); -// Given a struct builder, get the underlying data section as a word array, suitable for passing -// to `readDataStruct()`. -// -// Note that you may call `.toBytes()` on the returned value to convert to `ArrayPtr`. - -template -static typename Type::Reader defaultValue(); -// Get a default instance of the given struct or list type. -// -// TODO(cleanup): Find a better home for this function? - -// ======================================================================================= - -class SegmentArrayMessageReader: public MessageReader { - // A simple MessageReader that reads from an array of word arrays representing all segments. - // In particular you can read directly from the output of MessageBuilder::getSegmentsForOutput() - // (although it would probably make more sense to call builder.getRoot().asReader() in that case). - -public: - SegmentArrayMessageReader(kj::ArrayPtr> segments, - ReaderOptions options = ReaderOptions()); - // Creates a message pointing at the given segment array, without taking ownership of the - // segments. All arrays passed in must remain valid until the MessageReader is destroyed. - - KJ_DISALLOW_COPY(SegmentArrayMessageReader); - ~SegmentArrayMessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) override; - -private: - kj::ArrayPtr> segments; -}; - -enum class AllocationStrategy: uint8_t { - FIXED_SIZE, - // The builder will prefer to allocate the same amount of space for each segment with no - // heuristic growth. It will still allocate larger segments when the preferred size is too small - // for some single object. This mode is generally not recommended, but can be particularly useful - // for testing in order to force a message to allocate a predictable number of segments. Note - // that you can force every single object in the message to be located in a separate segment by - // using this mode with firstSegmentWords = 0. - - GROW_HEURISTICALLY - // The builder will heuristically decide how much space to allocate for each segment. Each - // allocated segment will be progressively larger than the previous segments on the assumption - // that message sizes are exponentially distributed. The total number of segments that will be - // allocated for a message of size n is O(log n). -}; - -constexpr uint SUGGESTED_FIRST_SEGMENT_WORDS = 1024; -constexpr AllocationStrategy SUGGESTED_ALLOCATION_STRATEGY = AllocationStrategy::GROW_HEURISTICALLY; - -class MallocMessageBuilder: public MessageBuilder { - // A simple MessageBuilder that uses malloc() (actually, calloc()) to allocate segments. This - // implementation should be reasonable for any case that doesn't require writing the message to - // a specific location in memory. - -public: - explicit MallocMessageBuilder(uint firstSegmentWords = SUGGESTED_FIRST_SEGMENT_WORDS, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // Creates a BuilderContext which allocates at least the given number of words for the first - // segment, and then uses the given strategy to decide how much to allocate for subsequent - // segments. When choosing a value for firstSegmentWords, consider that: - // 1) Reading and writing messages gets slower when multiple segments are involved, so it's good - // if most messages fit in a single segment. - // 2) Unused bytes will not be written to the wire, so generally it is not a big deal to allocate - // more space than you need. It only becomes problematic if you are allocating many messages - // in parallel and thus use lots of memory, or if you allocate so much extra space that just - // zeroing it out becomes a bottleneck. - // The defaults have been chosen to be reasonable for most people, so don't change them unless you - // have reason to believe you need to. - - explicit MallocMessageBuilder(kj::ArrayPtr firstSegment, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // This version always returns the given array for the first segment, and then proceeds with the - // allocation strategy. This is useful for optimization when building lots of small messages in - // a tight loop: you can reuse the space for the first segment. - // - // firstSegment MUST be zero-initialized. MallocMessageBuilder's destructor will write new zeros - // over any space that was used so that it can be reused. - - KJ_DISALLOW_COPY(MallocMessageBuilder); - virtual ~MallocMessageBuilder() noexcept(false); - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - uint nextSize; - AllocationStrategy allocationStrategy; - - bool ownFirstSegment; - bool returnedFirstSegment; - - void* firstSegment; - - struct MoreSegments; - kj::Maybe> moreSegments; -}; - -class FlatMessageBuilder: public MessageBuilder { - // THIS IS NOT THE CLASS YOU'RE LOOKING FOR. - // - // If you want to write a message into already-existing scratch space, use `MallocMessageBuilder` - // and pass the scratch space to its constructor. It will then only fall back to malloc() if - // the scratch space is not large enough. - // - // Do NOT use this class unless you really know what you're doing. This class is problematic - // because it requires advance knowledge of the size of your message, which is usually impossible - // to determine without actually building the message. The class was created primarily to - // implement `copyToUnchecked()`, which itself exists only to support other internal parts of - // the Cap'n Proto implementation. - -public: - explicit FlatMessageBuilder(kj::ArrayPtr array); - KJ_DISALLOW_COPY(FlatMessageBuilder); - virtual ~FlatMessageBuilder() noexcept(false); - - void requireFilled(); - // Throws an exception if the flat array is not exactly full. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - kj::ArrayPtr array; - bool allocated; -}; - -// ======================================================================================= -// implementation details - -inline const ReaderOptions& MessageReader::getOptions() { - return options; -} - -template -inline typename RootType::Reader MessageReader::getRoot() { - return getRootInternal().getAs(); -} - -template -inline typename RootType::Builder MessageBuilder::initRoot() { - return getRootInternal().initAs(); -} - -template -inline void MessageBuilder::setRoot(Reader&& value) { - getRootInternal().setAs>(value); -} - -template -inline typename RootType::Builder MessageBuilder::getRoot() { - return getRootInternal().getAs(); -} - -template -void MessageBuilder::adoptRoot(Orphan&& orphan) { - return getRootInternal().adopt(kj::mv(orphan)); -} - -template -typename RootType::Reader MessageReader::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::initRoot(SchemaType schema) { - return getRootInternal().initAs(schema); -} - -template -typename RootType::Reader readMessageUnchecked(const word* data) { - return AnyPointer::Reader(_::PointerReader::getRootUnchecked(data)).getAs(); -} - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer) { - FlatMessageBuilder builder(uncheckedBuffer); - builder.setRoot(kj::fwd(reader)); - builder.requireFilled(); -} - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data) { - return typename RootType::Reader(_::StructReader(data)); -} - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder) { - auto bytes = _::PointerHelpers>::getInternalBuilder(kj::mv(builder)) - .getDataSectionAsBlob(); - return kj::arrayPtr(reinterpret_cast(bytes.begin()), - reinterpret_cast(bytes.end())); -} - -template -static typename Type::Reader defaultValue() { - return typename Type::Reader(_::StructReader()); -} - -template -kj::Array canonicalize(T&& reader) { - return _::PointerHelpers>::getInternalReader(reader).canonicalize(); -} - -} // namespace capnp - -#endif // CAPNP_MESSAGE_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/orphan.h b/phonelibs/capnp-cpp/include/capnp/orphan.h deleted file mode 100644 index 8c8b9a6054..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/orphan.h +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ORPHAN_H_ -#define CAPNP_ORPHAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -struct DynamicStruct; -struct DynamicList; -namespace _ { struct OrphanageInternal; } - -template -class Orphan { - // Represents an object which is allocated within some message builder but has no pointers - // pointing at it. An Orphan can later be "adopted" by some other object as one of that object's - // fields, without having to copy the orphan. For a field `foo` of pointer type, the generated - // code will define builder methods `void adoptFoo(Orphan)` and `Orphan disownFoo()`. - // Orphans can also be created independently of any parent using an Orphanage. - // - // `Orphan` can be moved but not copied, like `Own`, so that it is impossible for one - // orphan to be adopted multiple times. If an orphan is destroyed without being adopted, its - // contents are zero'd out (and possibly reused, if we ever implement the ability to reuse space - // in a message arena). - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder): builder(kj::mv(builder)) {} - - inline BuilderFor get(); - // Get the underlying builder. If the orphan is null, this will allocate and return a default - // object rather than crash. This is done for security -- otherwise, you might enable a DoS - // attack any time you disown a field and fail to check if it is null. In the case of structs, - // this means that the orphan is no longer null after get() returns. In the case of lists, - // no actual object is allocated since a simple empty ListBuilder can be returned. - - inline ReaderFor getReader() const; - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - - inline void truncate(uint size); - // Resize an object (which must be a list or a blob) to the given size. - // - // If the new size is less than the original, the remaining elements will be discarded. The - // list is never moved in this case. If the list happens to be located at the end of its segment - // (which is always true if the list was the last thing allocated), the removed memory will be - // reclaimed (reducing the messag size), otherwise it is simply zeroed. The reclaiming behavior - // is particularly useful for allocating buffer space when you aren't sure how much space you - // actually need: you can pre-allocate, say, a 4k byte array, read() from a file into it, and - // then truncate it back to the amount of space actually used. - // - // If the new size is greater than the original, the list is extended with default values. If - // the list is the last object in its segment *and* there is enough space left in the segment to - // extend it to cover the new values, then the list is extended in-place. Otherwise, it must be - // moved to a new location, leaving a zero'd hole in the previous space that won't be filled. - // This copy is shallow; sub-objects will simply be reparented, not copied. - // - // Any existing readers or builders pointing at the object are invalidated by this call (even if - // it doesn't move). You must call `get()` or `getReader()` again to get the new, valid pointer. - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - template - friend struct List; - template - friend class Orphan; - friend class Orphanage; - friend class MessageBuilder; -}; - -class Orphanage: private kj::DisallowConstCopy { - // Use to directly allocate Orphan objects, without having a parent object allocate and then - // disown the object. - -public: - inline Orphanage(): arena(nullptr) {} - - template - static Orphanage getForMessageContaining(BuilderType builder); - // Construct an Orphanage that allocates within the message containing the given Builder. This - // allows the constructed Orphans to be adopted by objects within said message. - // - // This constructor takes the builder rather than having the builder have a getOrphanage() method - // because this is an advanced feature and we don't want to pollute the builder APIs with it. - // - // Note that if you have a direct pointer to the `MessageBuilder`, you can simply call its - // `getOrphanage()` method. - - template - Orphan newOrphan() const; - // Allocate a new orphaned struct. - - template - Orphan newOrphan(uint size) const; - // Allocate a new orphaned list or blob. - - Orphan newOrphan(StructSchema schema) const; - // Dynamically create an orphan struct with the given schema. You must - // #include to use this. - - Orphan newOrphan(ListSchema schema, uint size) const; - // Dynamically create an orphan list with the given schema. You must #include - // to use this. - - template - Orphan> newOrphanCopy(Reader copyFrom) const; - // Allocate a new orphaned object (struct, list, or blob) and initialize it as a copy of the - // given object. - - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - // Given an array of List readers, copy and concatenate the lists, creating a new Orphan. - // - // Note that compared to allocating the list yourself and using `setWithCaveats()` to set each - // item, this method avoids the "caveats": the new list will be allocated with the element size - // being the maximum of that from all the input lists. This is particularly important when - // concatenating struct lists: if the lists were created using a newer version of the protocol - // in which some new fields had been added to the struct, using `setWithCaveats()` would - // truncate off those new fields. - - Orphan referenceExternalData(Data::Reader data) const; - // Creates an Orphan that points at an existing region of memory (e.g. from another message) - // without copying it. There are some SEVERE restrictions on how this can be used: - // - The memory must remain valid until the `MessageBuilder` is destroyed (even if the orphan is - // abandoned). - // - Because the data is const, you will not be allowed to obtain a `Data::Builder` - // for this blob. Any call which would return such a builder will throw an exception. You - // can, however, obtain a Reader, e.g. via orphan.getReader() or from a parent Reader (once - // the orphan is adopted). It is your responsibility to make sure your code can deal with - // these problems when using this optimization; if you can't, allocate a copy instead. - // - `data.begin()` must be aligned to a machine word boundary (32-bit or 64-bit depending on - // the CPU). Any pointer returned by malloc() as well as any data blob obtained from another - // Cap'n Proto message satisfies this. - // - If `data.size()` is not a multiple of 8, extra bytes past data.end() up until the next 8-byte - // boundary will be visible in the raw message when it is written out. Thus, there must be no - // secrets in these bytes. Data blobs obtained from other Cap'n Proto messages should be safe - // as these bytes should be zero (unless the sender had the same problem). - // - // The array will actually become one of the message's segments. The data can thus be adopted - // into the message tree without copying it. This is particularly useful when referencing very - // large blobs, such as whole mmap'd files. - -private: - _::BuilderArena* arena; - _::CapTableBuilder* capTable; - - inline explicit Orphanage(_::BuilderArena* arena, _::CapTableBuilder* capTable) - : arena(arena), capTable(capTable) {} - - template - struct GetInnerBuilder; - template - struct GetInnerReader; - template - struct NewOrphanListImpl; - - friend class MessageBuilder; - friend struct _::OrphanageInternal; -}; - -// ======================================================================================= -// Inline implementation details. - -namespace _ { // private - -template -struct OrphanGetImpl; - -template -struct OrphanGetImpl { - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::elementSizeForType()); - } -}; - -template -struct OrphanGetImpl { - static inline typename T::Builder apply(_::OrphanBuilder& builder) { - return typename T::Builder(builder.asStruct(_::structSize())); - } - static inline typename T::Reader applyReader(const _::OrphanBuilder& builder) { - return typename T::Reader(builder.asStructReader(_::structSize())); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::structSize()); - } -}; - -#if !CAPNP_LITE -template -struct OrphanGetImpl { - static inline typename T::Client apply(_::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline typename T::Client applyReader(const _::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; -#endif // !CAPNP_LITE - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asList(_::ElementSizeForType::value)); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asStructList(_::structSize())); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Text::Builder apply(_::OrphanBuilder& builder) { - return Text::Builder(builder.asText()); - } - static inline Text::Reader applyReader(const _::OrphanBuilder& builder) { - return Text::Reader(builder.asTextReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Data::Builder apply(_::OrphanBuilder& builder) { - return Data::Builder(builder.asData()); - } - static inline Data::Reader applyReader(const _::OrphanBuilder& builder) { - return Data::Reader(builder.asDataReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -struct OrphanageInternal { - static inline _::BuilderArena* getArena(Orphanage orphanage) { return orphanage.arena; } - static inline _::CapTableBuilder* getCapTable(Orphanage orphanage) { return orphanage.capTable; } -}; - -} // namespace _ (private) - -template -inline BuilderFor Orphan::get() { - return _::OrphanGetImpl::apply(builder); -} - -template -inline ReaderFor Orphan::getReader() const { - return _::OrphanGetImpl::applyReader(builder); -} - -template -inline void Orphan::truncate(uint size) { - _::OrphanGetImpl>::truncateListOf(builder, bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncateText(bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncate(bounded(size) * ELEMENTS, ElementSize::BYTE); -} - -template -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(typename T::Builder& t) { - return t._builder; - } -}; - -template -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(typename T::Builder& t) { - return t.builder; - } -}; - -template -Orphanage Orphanage::getForMessageContaining(BuilderType builder) { - auto inner = GetInnerBuilder>::apply(builder); - return Orphanage(inner.getArena(), inner.getCapTable()); -} - -template -Orphan Orphanage::newOrphan() const { - return Orphan(_::OrphanBuilder::initStruct(arena, capTable, _::structSize())); -} - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initList( - arena, capTable, bounded(size) * ELEMENTS, _::ElementSizeForType::value); - } -}; - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initStructList( - arena, capTable, bounded(size) * ELEMENTS, _::structSize()); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initText(arena, capTable, bounded(size) * BYTES); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initData(arena, capTable, bounded(size) * BYTES); - } -}; - -template -Orphan Orphanage::newOrphan(uint size) const { - return Orphan(NewOrphanListImpl::apply(arena, capTable, size)); -} - -template -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const typename T::Reader& t) { - return t._reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const typename T::Reader& t) { - return t.reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline const typename T::Reader& apply(const typename T::Reader& t) { - return t; - } -}; - -template -inline Orphan> Orphanage::newOrphanCopy(Reader copyFrom) const { - return Orphan>(_::OrphanBuilder::copy( - arena, capTable, GetInnerReader>::apply(copyFrom))); -} - -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - return newOrphanConcat(kj::implicitCast>(lists)); -} -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - // Optimization / simplification: Rely on List::Reader containing nothing except a - // _::ListReader. - static_assert(sizeof(T) == sizeof(_::ListReader), "lists are not bare readers?"); - kj::ArrayPtr raw( - reinterpret_cast(lists.begin()), lists.size()); - typedef ListElementType> Element; - return Orphan>( - _::OrphanBuilder::concat(arena, capTable, - _::elementSizeForType(), - _::minStructSizeForElement(), raw)); -} - -inline Orphan Orphanage::referenceExternalData(Data::Reader data) const { - return Orphan(_::OrphanBuilder::referenceExternalData(arena, data)); -} - -} // namespace capnp - -#endif // CAPNP_ORPHAN_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/persistent.capnp b/phonelibs/capnp-cpp/include/capnp/persistent.capnp deleted file mode 100644 index a13b47168a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/persistent.capnp +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb8630836983feed7; - -$import "/capnp/c++.capnp".namespace("capnp"); - -interface Persistent@0xc8cb212fcd9f5691(SturdyRef, Owner) { - # Interface implemented by capabilities that outlive a single connection. A client may save() - # the capability, producing a SturdyRef. The SturdyRef can be stored to disk, then later used to - # obtain a new reference to the capability on a future connection. - # - # The exact format of SturdyRef depends on the "realm" in which the SturdyRef appears. A "realm" - # is an abstract space in which all SturdyRefs have the same format and refer to the same set of - # resources. Every vat is in exactly one realm. All capability clients within that vat must - # produce SturdyRefs of the format appropriate for the realm. - # - # Similarly, every VatNetwork also resides in a particular realm. Usually, a vat's "realm" - # corresponds to the realm of its main VatNetwork. However, a Vat can in fact communicate over - # a VatNetwork in a different realm -- in this case, all SturdyRefs need to be transformed when - # coming or going through said VatNetwork. The RPC system has hooks for registering - # transformation callbacks for this purpose. - # - # Since the format of SturdyRef is realm-dependent, it is not defined here. An application should - # choose an appropriate realm for itself as part of its design. Note that under Sandstorm, every - # application exists in its own realm and is therefore free to define its own SturdyRef format; - # the Sandstorm platform handles translating between realms. - # - # Note that whether a capability is persistent is often orthogonal to its type. In these cases, - # the capability's interface should NOT inherit `Persistent`; instead, just perform a cast at - # runtime. It's not type-safe, but trying to be type-safe in these cases will likely lead to - # tears. In cases where a particular interface only makes sense on persistent capabilities, it - # still should not explicitly inherit Persistent because the `SturdyRef` and `Owner` types will - # vary between realms (they may even be different at the call site than they are on the - # implementation). Instead, mark persistent interfaces with the $persistent annotation (defined - # below). - # - # Sealing - # ------- - # - # As an added security measure, SturdyRefs may be "sealed" to a particular owner, such that - # if the SturdyRef itself leaks to a third party, that party cannot actually restore it because - # they are not the owner. To restore a sealed capability, you must first prove to its host that - # you are the rightful owner. The precise mechanism for this authentication is defined by the - # realm. - # - # Sealing is a defense-in-depth mechanism meant to mitigate damage in the case of catastrophic - # attacks. For example, say an attacker temporarily gains read access to a database full of - # SturdyRefs: it would be unfortunate if it were then necessary to revoke every single reference - # in the database to prevent the attacker from using them. - # - # In general, an "owner" is a course-grained identity. Because capability-based security is still - # the primary mechanism of security, it is not necessary nor desirable to have a separate "owner" - # identity for every single process or object; that is exactly what capabilities are supposed to - # avoid! Instead, it makes sense for an "owner" to literally identify the owner of the machines - # where the capability is stored. If untrusted third parties are able to run arbitrary code on - # said machines, then the sandbox for that code should be designed using Distributed Confinement - # such that the third-party code never sees the bits of the SturdyRefs and cannot directly - # exercise the owner's power to restore refs. See: - # - # http://www.erights.org/elib/capability/dist-confine.html - # - # Resist the urge to represent an Owner as a simple public key. The whole point of sealing is to - # defend against leaked-storage attacks. Such attacks can easily result in the owner's private - # key being stolen as well. A better solution is for `Owner` to contain a simple globally unique - # identifier for the owner, and for everyone to separately maintain a mapping of owner IDs to - # public keys. If an owner's private key is compromised, then humans will need to communicate - # and agree on a replacement public key, then update the mapping. - # - # As a concrete example, an `Owner` could simply contain a domain name, and restoring a SturdyRef - # would require signing a request using the domain's private key. Authenticating this key could - # be accomplished through certificate authorities or web-of-trust techniques. - - save @0 SaveParams -> SaveResults; - # Save a capability persistently so that it can be restored by a future connection. Not all - # capabilities can be saved -- application interfaces should define which capabilities support - # this and which do not. - - struct SaveParams { - sealFor @0 :Owner; - # Seal the SturdyRef so that it can only be restored by the specified Owner. This is meant - # to mitigate damage when a SturdyRef is leaked. See comments above. - # - # Leaving this value null may or may not be allowed; it is up to the realm to decide. If a - # realm does allow a null owner, this should indicate that anyone is allowed to restore the - # ref. - } - struct SaveResults { - sturdyRef @0 :SturdyRef; - } -} - -interface RealmGateway(InternalRef, ExternalRef, InternalOwner, ExternalOwner) { - # Interface invoked when a SturdyRef is about to cross realms. The RPC system supports providing - # a RealmGateway as a callback hook when setting up RPC over some VatNetwork. - - import @0 (cap :Persistent(ExternalRef, ExternalOwner), - params :Persistent(InternalRef, InternalOwner).SaveParams) - -> Persistent(InternalRef, InternalOwner).SaveResults; - # Given an external capability, save it and return an internal reference. Used when someone - # inside the realm tries to save a capability from outside the realm. - - export @1 (cap :Persistent(InternalRef, InternalOwner), - params :Persistent(ExternalRef, ExternalOwner).SaveParams) - -> Persistent(ExternalRef, ExternalOwner).SaveResults; - # Given an internal capability, save it and return an external reference. Used when someone - # outside the realm tries to save a capability from inside the realm. -} - -annotation persistent(interface, field) :Void; -# Apply this annotation to interfaces for objects that will always be persistent, instead of -# extending the Persistent capability, since the correct type parameters to Persistent depend on -# the realm, which is orthogonal to the interface type and therefore should not be defined -# along-side it. -# -# You may also apply this annotation to a capability-typed field which will always contain a -# persistent capability, but where the capability's interface itself is not already marked -# persistent. -# -# Note that absence of the $persistent annotation doesn't mean a capability of that type isn't -# persistent; it just means not *all* such capabilities are persistent. diff --git a/phonelibs/capnp-cpp/include/capnp/persistent.capnp.h b/phonelibs/capnp-cpp/include/capnp/persistent.capnp.h deleted file mode 100644 index f9b443220a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/persistent.capnp.h +++ /dev/null @@ -1,1328 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: persistent.capnp - -#ifndef CAPNP_INCLUDED_b8630836983feed7_ -#define CAPNP_INCLUDED_b8630836983feed7_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(c8cb212fcd9f5691); -CAPNP_DECLARE_SCHEMA(f76fba59183073a5); -CAPNP_DECLARE_SCHEMA(b76848c18c40efbf); -CAPNP_DECLARE_SCHEMA(84ff286cd00a3ed4); -CAPNP_DECLARE_SCHEMA(f0c2cc1d3909574d); -CAPNP_DECLARE_SCHEMA(ecafa18b482da3aa); -CAPNP_DECLARE_SCHEMA(f622595091cafb67); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -template -struct Persistent { - Persistent() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct SaveParams; - struct SaveResults; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(c8cb212fcd9f5691) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct Persistent::SaveParams { - SaveParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f76fba59183073a5, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct Persistent::SaveResults { - SaveResults() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b76848c18c40efbf, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway { - RealmGateway() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct ImportParams; - struct ExportParams; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(84ff286cd00a3ed4) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct RealmGateway::ImportParams { - ImportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f0c2cc1d3909574d, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway::ExportParams { - ExportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ecafa18b482da3aa, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -#if !CAPNP_LITE -template -class Persistent::Client - : public virtual ::capnp::Capability::Client { -public: - typedef Persistent Calls; - typedef Persistent Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename Persistent::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) saveRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class Persistent::Server - : public virtual ::capnp::Capability::Server { -public: - typedef Persistent Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef ::capnp::CallContext::SaveParams, typename ::capnp::Persistent::SaveResults> SaveContext; - virtual ::kj::Promise save(SaveContext context); - - inline typename ::capnp::Persistent::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::Persistent>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveParams::Reader { -public: - typedef SaveParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Reader asPersistentGeneric() { - return typename Persistent::SaveParams::Reader(_reader); - } - - inline bool hasSealFor() const; - inline ::capnp::ReaderFor getSealFor() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveParams::Builder { -public: - typedef SaveParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Builder asPersistentGeneric() { - return typename Persistent::SaveParams::Builder(_builder); - } - - inline bool hasSealFor(); - inline ::capnp::BuilderFor getSealFor(); - inline void setSealFor( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSealFor(); - inline ::capnp::BuilderFor initSealFor(unsigned int size); - inline void adoptSealFor(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSealFor(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveParams::Pipeline { -public: - typedef SaveParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSealFor(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveResults::Reader { -public: - typedef SaveResults Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Reader asPersistentGeneric() { - return typename Persistent::SaveResults::Reader(_reader); - } - - inline bool hasSturdyRef() const; - inline ::capnp::ReaderFor getSturdyRef() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveResults::Builder { -public: - typedef SaveResults Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Builder asPersistentGeneric() { - return typename Persistent::SaveResults::Builder(_builder); - } - - inline bool hasSturdyRef(); - inline ::capnp::BuilderFor getSturdyRef(); - inline void setSturdyRef( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSturdyRef(); - inline ::capnp::BuilderFor initSturdyRef(unsigned int size); - inline void adoptSturdyRef(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSturdyRef(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveResults::Pipeline { -public: - typedef SaveResults Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSturdyRef(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -class RealmGateway::Client - : public virtual ::capnp::Capability::Client { -public: - typedef RealmGateway Calls; - typedef RealmGateway Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename RealmGateway::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) importRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) exportRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class RealmGateway::Server - : public virtual ::capnp::Capability::Server { -public: - typedef RealmGateway Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef typename ::capnp::RealmGateway::ImportParams ImportParams; - typedef ::capnp::CallContext::SaveResults> ImportContext; - virtual ::kj::Promise import(ImportContext context); - typedef typename ::capnp::RealmGateway::ExportParams ExportParams; - typedef ::capnp::CallContext::SaveResults> ExportContext; - virtual ::kj::Promise export_(ExportContext context); - - inline typename ::capnp::RealmGateway::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::RealmGateway>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ImportParams::Reader { -public: - typedef ImportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ImportParams::Builder { -public: - typedef ImportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ImportParams::Pipeline { -public: - typedef ImportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ExportParams::Reader { -public: - typedef ExportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ExportParams::Builder { -public: - typedef ExportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ExportParams::Pipeline { -public: - typedef ExportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -#if !CAPNP_LITE -template -inline Persistent::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline Persistent::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline Persistent::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline Persistent::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline Persistent::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool Persistent::SaveParams::Reader::hasSealFor() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveParams::Builder::hasSealFor() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveParams::Reader::getSealFor() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::getSealFor() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveParams::Pipeline::getSealFor() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveParams::Builder::setSealFor( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveParams::Builder::adoptSealFor( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveParams::Builder::disownSealFor() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveParams -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveParams::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f76fba59183073a5, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool Persistent::SaveResults::Reader::hasSturdyRef() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveResults::Builder::hasSturdyRef() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveResults::Reader::getSturdyRef() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::getSturdyRef() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveResults::Pipeline::getSturdyRef() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveResults::Builder::setSturdyRef( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveResults::Builder::adoptSturdyRef( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveResults::Builder::disownSturdyRef() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveResults -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveResults::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveResults::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveResults::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveResults::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveResults::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_b76848c18c40efbf, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) -Persistent::Client::saveRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::SaveParams, typename ::capnp::Persistent::SaveResults>( - 0xc8cb212fcd9f5691ull, 0, sizeHint); -} -template -::kj::Promise Persistent::Server::save(SaveContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", "save", - 0xc8cb212fcd9f5691ull, 0); -} -template -::kj::Promise Persistent::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0xc8cb212fcd9f5691ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:Persistent", interfaceId); - } -} -template -::kj::Promise Persistent::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return save(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::Persistent::SaveParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", - 0xc8cb212fcd9f5691ull, methodId); - } -} -#endif // !CAPNP_LITE - -// Persistent -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency Persistent::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema Persistent::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_c8cb212fcd9f5691, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -inline RealmGateway::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline RealmGateway::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline RealmGateway::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline RealmGateway::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline RealmGateway::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool RealmGateway::ImportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ImportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ImportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ImportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ImportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ImportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ImportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ImportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ImportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ImportParams -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ImportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ImportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ImportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ImportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ImportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ImportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f0c2cc1d3909574d, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ExportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ExportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ExportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ExportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ExportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ExportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ExportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ExportParams -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ExportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ExportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ExportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ExportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ExportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ExportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_ecafa18b482da3aa, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::importRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ImportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 0, sizeHint); -} -template -::kj::Promise RealmGateway::Server::import(ImportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "import", - 0x84ff286cd00a3ed4ull, 0); -} -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::exportRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ExportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 1, sizeHint); -} -template -::kj::Promise RealmGateway::Server::export_(ExportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "export", - 0x84ff286cd00a3ed4ull, 1); -} -template -::kj::Promise RealmGateway::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0x84ff286cd00a3ed4ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:RealmGateway", interfaceId); - } -} -template -::kj::Promise RealmGateway::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return import(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ImportParams, typename ::capnp::Persistent::SaveResults>(context)); - case 1: - return export_(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ExportParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", - 0x84ff286cd00a3ed4ull, methodId); - } -} -#endif // !CAPNP_LITE - -// RealmGateway -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::RealmGateway::ImportParams::_capnpPrivate::brand() }, - { 33554433, ::capnp::RealmGateway::ExportParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, - { 50331649, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_84ff286cd00a3ed4, brandScopes, brandDependencies, - 1, 4, nullptr -}; -#endif // !CAPNP_LITE - -} // namespace - -#endif // CAPNP_INCLUDED_b8630836983feed7_ diff --git a/phonelibs/capnp-cpp/include/capnp/pointer-helpers.h b/phonelibs/capnp-cpp/include/capnp/pointer-helpers.h deleted file mode 100644 index fe70e5036f..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/pointer-helpers.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_POINTER_HELPERS_H_ -#define CAPNP_POINTER_HELPERS_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "list.h" - -namespace capnp { -namespace _ { // private - -// PointerHelpers is a template class that assists in wrapping/unwrapping the low-level types in -// layout.h with the high-level public API and generated types. This way, the code generator -// and other templates do not have to specialize on each kind of pointer. - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, const word* defaultValue = nullptr) { - return typename T::Reader(reader.getStruct(defaultValue)); - } - static inline typename T::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename T::Builder(builder.getStruct(structSize(), defaultValue)); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader, true); - } - static inline typename T::Builder init(PointerBuilder builder) { - return typename T::Builder(builder.initStruct(structSize())); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::StructReader getInternalReader(const typename T::Reader& reader) { - return reader._reader; - } - static inline _::StructBuilder getInternalBuilder(typename T::Builder&& builder) { - return builder._builder; - } -}; - -template -struct PointerHelpers, Kind::LIST> { - static inline typename List::Reader get(PointerReader reader, - const word* defaultValue = nullptr) { - return typename List::Reader(List::getFromPointer(reader, defaultValue)); - } - static inline typename List::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename List::Builder(List::getFromPointer(builder, defaultValue)); - } - static inline void set(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader); - } - static inline void setCanonical(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader, true); - } - static void set(PointerBuilder builder, kj::ArrayPtr> value) { - auto l = init(builder, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - static inline typename List::Builder init(PointerBuilder builder, uint size) { - return typename List::Builder(List::initPointer(builder, size)); - } - static inline void adopt(PointerBuilder builder, Orphan>&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan> disown(PointerBuilder builder) { - return Orphan>(builder.disown()); - } - static inline _::ListReader getInternalReader(const typename List::Reader& reader) { - return reader.reader; - } - static inline _::ListBuilder getInternalBuilder(typename List::Builder&& builder) { - return builder.builder; - } -}; - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return reader.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline typename T::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return builder.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline typename T::Builder init(PointerBuilder builder, uint size) { - return builder.initBlob(bounded(size) * BYTES); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -struct UncheckedMessage { - typedef const word* Reader; -}; - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -template <> -struct PointerHelpers { - // Reads an AnyPointer field as an unchecked message pointer. Requires that the containing - // message is itself unchecked. This hack is currently private. It is used to locate default - // values within encoded schemas. - - static inline const word* get(PointerReader reader) { - return reader.getUnchecked(); - } -}; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_POINTER_HELPERS_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/pretty-print.h b/phonelibs/capnp-cpp/include/capnp/pretty-print.h deleted file mode 100644 index e6458bca49..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/pretty-print.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_PRETTY_PRINT_H_ -#define CAPNP_PRETTY_PRINT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "dynamic.h" -#include - -namespace capnp { - -kj::StringTree prettyPrint(DynamicStruct::Reader value); -kj::StringTree prettyPrint(DynamicStruct::Builder value); -kj::StringTree prettyPrint(DynamicList::Reader value); -kj::StringTree prettyPrint(DynamicList::Builder value); -// Print the given Cap'n Proto struct or list with nice indentation. Note that you can pass any -// struct or list reader or builder type to this method, since they can be implicitly converted -// to one of the dynamic types. -// -// If you don't want indentation, just use the value's KJ stringifier (e.g. pass it to kj::str(), -// any of the KJ debug macros, etc.). - -} // namespace capnp - -#endif // PRETTY_PRINT_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/raw-schema.h b/phonelibs/capnp-cpp/include/capnp/raw-schema.h deleted file mode 100644 index ed9425a624..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/raw-schema.h +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RAW_SCHEMA_H_ -#define CAPNP_RAW_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" // for uint and friends - -#if _MSC_VER -#include -#endif - -namespace capnp { -namespace _ { // private - -struct RawSchema; - -struct RawBrandedSchema { - // Represents a combination of a schema and bindings for its generic parameters. - // - // Note that while we generate one `RawSchema` per type, we generate a `RawBrandedSchema` for - // every _instance_ of a generic type -- or, at least, every instance that is actually used. For - // generated-code types, we use template magic to initialize these. - - const RawSchema* generic; - // Generic type which we're branding. - - struct Binding { - uint8_t which; // Numeric value of one of schema::Type::Which. - - bool isImplicitParameter; - // For AnyPointer, true if it's an implicit method parameter. - - uint16_t listDepth; // Number of times to wrap the base type in List(). - - uint16_t paramIndex; - // For AnyPointer. If it's a type parameter (scopeId is non-zero) or it's an implicit parameter - // (isImplicitParameter is true), then this is the parameter index. Otherwise this is a numeric - // value of one of schema::Type::AnyPointer::Unconstrained::Which. - - union { - const RawBrandedSchema* schema; // for struct, enum, interface - uint64_t scopeId; // for AnyPointer, if it's a type parameter - }; - - Binding() = default; - inline constexpr Binding(uint8_t which, uint16_t listDepth, const RawBrandedSchema* schema) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(0), - schema(schema) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, - uint64_t scopeId, uint16_t paramIndex) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(paramIndex), - scopeId(scopeId) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, uint16_t implicitParamIndex) - : which(which), isImplicitParameter(true), listDepth(listDepth), - paramIndex(implicitParamIndex), scopeId(0) {} - }; - - struct Scope { - uint64_t typeId; - // Type ID whose parameters are being bound. - - const Binding* bindings; - uint bindingCount; - // Bindings for those parameters. - - bool isUnbound; - // This scope is unbound, in the sense of SchemaLoader::getUnbound(). - }; - - const Scope* scopes; - // Array of enclosing scopes for which generic variables have been bound, sorted by type ID. - - struct Dependency { - uint location; - const RawBrandedSchema* schema; - }; - - const Dependency* dependencies; - // Map of branded schemas for dependencies of this type, given our brand. Only dependencies that - // are branded are included in this map; if a dependency is missing, use its `defaultBrand`. - - uint32_t scopeCount; - uint32_t dependencyCount; - - enum class DepKind { - // Component of a Dependency::location. Specifies what sort of dependency this is. - - INVALID, - // Mostly defined to ensure that zero is not a valid location. - - FIELD, - // Binding needed for a field's type. The index is the field index (NOT ordinal!). - - METHOD_PARAMS, - // Bindings needed for a method's params type. The index is the method number. - - METHOD_RESULTS, - // Bindings needed for a method's results type. The index is the method ordinal. - - SUPERCLASS, - // Bindings needed for a superclass type. The index is the superclass's index in the - // "extends" list. - - CONST_TYPE - // Bindings needed for the type of a constant. The index is zero. - }; - - static inline uint makeDepLocation(DepKind kind, uint index) { - // Make a number representing the location of a particular dependency within its parent - // schema. - - return (static_cast(kind) << 24) | index; - } - - class Initializer { - public: - virtual void init(const RawBrandedSchema* generic) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - inline bool isUnbound() const; - // Checks if this schema is the result of calling SchemaLoader::getUnbound(), in which case - // binding lookups need to be handled specially. -}; - -struct RawSchema { - // The generated code defines a constant RawSchema for every compiled declaration. - // - // This is an internal structure which could change in the future. - - uint64_t id; - - const word* encodedNode; - // Encoded SchemaNode, readable via readMessageUnchecked(encodedNode). - - uint32_t encodedSize; - // Size of encodedNode, in words. - - const RawSchema* const* dependencies; - // Pointers to other types on which this one depends, sorted by ID. The schemas in this table - // may be uninitialized -- you must call ensureInitialized() on the one you wish to use before - // using it. - // - // TODO(someday): Make this a hashtable. - - const uint16_t* membersByName; - // Indexes of members sorted by name. Used to implement name lookup. - // TODO(someday): Make this a hashtable. - - uint32_t dependencyCount; - uint32_t memberCount; - // Sizes of above tables. - - const uint16_t* membersByDiscriminant; - // List of all member indexes ordered by discriminant value. Those which don't have a - // discriminant value are listed at the end, in order by ordinal. - - const RawSchema* canCastTo; - // Points to the RawSchema of a compiled-in type to which it is safe to cast any DynamicValue - // with this schema. This is null for all compiled-in types; it is only set by SchemaLoader on - // dynamically-loaded types. - - class Initializer { - public: - virtual void init(const RawSchema* schema) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - RawBrandedSchema defaultBrand; - // Specifies the brand to use for this schema if no generic parameters have been bound to - // anything. Generally, in the default brand, all generic parameters are treated as if they were - // bound to `AnyPointer`. -}; - -inline bool RawBrandedSchema::isUnbound() const { - // The unbound schema is the only one that has no scopes but is not the default schema. - return scopeCount == 0 && this != &generic->defaultBrand; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RAW_SCHEMA_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/rpc-prelude.h b/phonelibs/capnp-cpp/include/capnp/rpc-prelude.h deleted file mode 100644 index 7d26e39de8..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc-prelude.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before rpc.h can start. -// We don't define these directly in rpc.h because it makes the file hard to read. - -#ifndef CAPNP_RPC_PRELUDE_H_ -#define CAPNP_RPC_PRELUDE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "persistent.capnp.h" - -namespace capnp { - -class OutgoingRpcMessage; -class IncomingRpcMessage; - -template -class RpcSystem; - -namespace _ { // private - -class VatNetworkBase { - // Non-template version of VatNetwork. Ignore this class; see VatNetwork in rpc.h. - -public: - class Connection; - - struct ConnectionAndProvisionId { - kj::Own connection; - kj::Own firstMessage; - Orphan provisionId; - }; - - class Connection { - public: - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) = 0; - virtual kj::Promise>> receiveIncomingMessage() = 0; - virtual kj::Promise shutdown() = 0; - virtual AnyStruct::Reader baseGetPeerVatId() = 0; - }; - virtual kj::Maybe> baseConnect(AnyStruct::Reader vatId) = 0; - virtual kj::Promise> baseAccept() = 0; -}; - -class SturdyRefRestorerBase { -public: - virtual Capability::Client baseRestore(AnyPointer::Reader ref) = 0; -}; - -class BootstrapFactoryBase { - // Non-template version of BootstrapFactory. Ignore this class; see BootstrapFactory in rpc.h. -public: - virtual Capability::Client baseCreateFor(AnyStruct::Reader clientId) = 0; -}; - -class RpcSystemBase { - // Non-template version of RpcSystem. Ignore this class; see RpcSystem in rpc.h. - -public: - RpcSystemBase(VatNetworkBase& network, kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, BootstrapFactoryBase& bootstrapFactory, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& restorer); - RpcSystemBase(RpcSystemBase&& other) noexcept; - ~RpcSystemBase() noexcept(false); - -private: - class Impl; - kj::Own impl; - - Capability::Client baseBootstrap(AnyStruct::Reader vatId); - Capability::Client baseRestore(AnyStruct::Reader vatId, AnyPointer::Reader objectId); - void baseSetFlowLimit(size_t words); - - template - friend class capnp::RpcSystem; -}; - -template struct InternalRefFromRealmGateway_; -template -struct InternalRefFromRealmGateway_> { - typedef InternalRef Type; -}; -template -using InternalRefFromRealmGateway = typename InternalRefFromRealmGateway_::Type; -template -using InternalRefFromRealmGatewayClient = InternalRefFromRealmGateway; - -template struct ExternalRefFromRealmGateway_; -template -struct ExternalRefFromRealmGateway_> { - typedef ExternalRef Type; -}; -template -using ExternalRefFromRealmGateway = typename ExternalRefFromRealmGateway_::Type; -template -using ExternalRefFromRealmGatewayClient = ExternalRefFromRealmGateway; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RPC_PRELUDE_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp b/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp deleted file mode 100644 index 0b670e8ac3..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xa184c7885cdaf2a1; -# This file defines the "network-specific parameters" in rpc.capnp to support a network consisting -# of two vats. Each of these vats may in fact be in communication with other vats, but any -# capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities -# received from the other end appear to live in a single vat. -# -# Two notable use cases for this model include: -# - Regular client-server communications, where a remote client machine (perhaps living on an end -# user's personal device) connects to a server. The server may be part of a cluster, and may -# call on other servers in the cluster to help service the user's request. It may even obtain -# capabilities from these other servers which it passes on to the user. To simplify network -# common traversal problems (e.g. if the user is behind a firewall), it is probably desirable to -# multiplex all communications between the server cluster and the client over the original -# connection rather than form new ones. This connection should use the two-party protocol, as -# the client has no interest in knowing about additional servers. -# - Applications running in a sandbox. A supervisor process may execute a confined application -# such that all of the confined app's communications with the outside world must pass through -# the supervisor. In this case, the connection between the confined app and the supervisor might -# as well use the two-party protocol, because the confined app is intentionally prevented from -# talking to any other vat anyway. Any external resources will be proxied through the supervisor, -# and so to the contained app will appear as if they were hosted by the supervisor itself. -# -# Since there are only two vats in this network, there is never a need for three-way introductions, -# so level 3 is free. Moreover, because it is never necessary to form new connections, the -# two-party protocol can be used easily anywhere where a two-way byte stream exists, without regard -# to where that byte stream goes or how it was initiated. This makes the two-party runtime library -# highly reusable. -# -# Joins (level 4) _could_ be needed in cases where one or both vats are participating in other -# networks that use joins. For instance, if Alice and Bob are speaking through the two-party -# protocol, and Bob is also participating on another network, Bob may send Alice two or more -# proxied capabilities which, unbeknownst to Bob at the time, are in fact pointing at the same -# remote object. Alice may then request to join these capabilities, at which point Bob will have -# to forward the join to the other network. Note, however, that if Alice is _not_ participating on -# any other network, then Alice will never need to _receive_ a Join, because Alice would always -# know when two locally-hosted capabilities are the same and would never export a redundant alias -# to Bob. So, Alice can respond to all incoming joins with an error, and only needs to implement -# outgoing joins if she herself desires to use this feature. Also, outgoing joins are relatively -# easy to implement in this scenario. -# -# What all this means is that a level 4 implementation of the confined network is barely more -# complicated than a level 2 implementation. However, such an implementation allows the "client" -# or "confined" app to access the server's/supervisor's network with equal functionality to any -# native participant. In other words, an application which implements only the two-party protocol -# can be paired with a proxy app in order to participate in any network. -# -# So, when implementing Cap'n Proto in a new language, it makes sense to implement only the -# two-party protocol initially, and then pair applications with an appropriate proxy written in -# C++, rather than implement other parameterizations of the RPC protocol directly. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc::twoparty"); - -# Note: SturdyRef is not specified here. It is up to the application to define semantics of -# SturdyRefs if desired. - -enum Side { - server @0; - # The object lives on the "server" or "supervisor" end of the connection. Only the - # server/supervisor knows how to interpret the ref; to the client, it is opaque. - # - # Note that containers intending to implement strong confinement should rewrite SturdyRefs - # received from the external network before passing them on to the confined app. The confined - # app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps - # maliciously leak), but instead receives only a thing that it can pass back to the container - # later to restore the ref. See: - # http://www.erights.org/elib/capability/dist-confine.html - - client @1; - # The object lives on the "client" or "confined app" end of the connection. Only the client - # knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not - # actually know how to persist capabilities at all, so use of this is unusual. -} - -struct VatId { - side @0 :Side; -} - -struct ProvisionId { - # Only used for joins, since three-way introductions never happen on a two-party network. - - joinId @0 :UInt32; - # The ID from `JoinKeyPart`. -} - -struct RecipientId {} -# Never used, because there are only two parties. - -struct ThirdPartyCapId {} -# Never used, because there is no third party. - -struct JoinKeyPart { - # Joins in the two-party case are simplified by a few observations. - # - # First, on a two-party network, a Join only ever makes sense if the receiving end is also - # connected to other networks. A vat which is not connected to any other network can safely - # reject all joins. - # - # Second, since a two-party connection bisects the network -- there can be no other connections - # between the networks at either end of the connection -- if one part of a join crosses the - # connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request - # off some other network which needs to be forwarded across the two-party connection can - # collect all the parts on its end and only forward them across the two-party connection when all - # have been received. - # - # For example, imagine that Alice and Bob are vats connected over a two-party connection, and - # each is also connected to other networks. At some point, Alice receives one part of a Join - # request off her network. The request is addressed to a capability that Alice received from - # Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as - # if she hosted the capability locally (this is important so that if not all the Join parts end - # up at Alice, the original sender can detect the failed Join without hanging). As other parts - # trickle in, Alice verifies that each part is addressed to a capability from Bob and continues - # to respond to each one. Once the complete set of join parts is received, Alice checks if they - # were all for the exact same capability. If so, she doesn't need to send anything to Bob at - # all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were - # addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice - # does not forward the Join parts she received herself, but essentially forwards the Join as a - # whole. - # - # On Bob's end, since he knows that Alice will always send all parts of a Join together, he - # simply waits until he's received them all, then performs a join on the respective capabilities - # as if it had been requested locally. - - joinId @0 :UInt32; - # A number identifying this join, chosen by the sender. May be reused once `Finish` messages are - # sent corresponding to all of the `Join` messages. - - partCount @1 :UInt16; - # The number of capabilities to be joined. - - partNum @2 :UInt16; - # Which part this request targets -- a number in the range [0, partCount). -} - -struct JoinResult { - joinId @0 :UInt32; - # Matches `JoinKeyPart`. - - succeeded @1 :Bool; - # All JoinResults in the set will have the same value for `succeeded`. The receiver actually - # implements the join by waiting for all the `JoinKeyParts` and then performing its own join on - # them, then going back and answering all the join requests afterwards. - - cap @2 :AnyPointer; - # One of the JoinResults will have a non-null `cap` which is the joined capability. - # - # TODO(cleanup): Change `AnyPointer` to `Capability` when that is supported. -} diff --git a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp.h b/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp.h deleted file mode 100644 index 9d7820646a..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.capnp.h +++ /dev/null @@ -1,726 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc-twoparty.capnp - -#ifndef CAPNP_INCLUDED_a184c7885cdaf2a1_ -#define CAPNP_INCLUDED_a184c7885cdaf2a1_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(9fd69ebc87b9719c); -enum class Side_9fd69ebc87b9719c: uint16_t { - SERVER, - CLIENT, -}; -CAPNP_DECLARE_ENUM(Side, 9fd69ebc87b9719c); -CAPNP_DECLARE_SCHEMA(d20b909fee733a8e); -CAPNP_DECLARE_SCHEMA(b88d09a9c5f39817); -CAPNP_DECLARE_SCHEMA(89f389b6fd4082c1); -CAPNP_DECLARE_SCHEMA(b47f4979672cb59d); -CAPNP_DECLARE_SCHEMA(95b29059097fca83); -CAPNP_DECLARE_SCHEMA(9d263a3630b7ebee); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { -namespace twoparty { - -typedef ::capnp::schemas::Side_9fd69ebc87b9719c Side; - -struct VatId { - VatId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d20b909fee733a8e, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ProvisionId { - ProvisionId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b88d09a9c5f39817, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct RecipientId { - RecipientId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(89f389b6fd4082c1, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapId { - ThirdPartyCapId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b47f4979672cb59d, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinKeyPart { - JoinKeyPart() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95b29059097fca83, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinResult { - JoinResult() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9d263a3630b7ebee, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class VatId::Reader { -public: - typedef VatId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class VatId::Builder { -public: - typedef VatId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide(); - inline void setSide( ::capnp::rpc::twoparty::Side value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class VatId::Pipeline { -public: - typedef VatId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ProvisionId::Reader { -public: - typedef ProvisionId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ProvisionId::Builder { -public: - typedef ProvisionId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ProvisionId::Pipeline { -public: - typedef ProvisionId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class RecipientId::Reader { -public: - typedef RecipientId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class RecipientId::Builder { -public: - typedef RecipientId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class RecipientId::Pipeline { -public: - typedef RecipientId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapId::Reader { -public: - typedef ThirdPartyCapId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapId::Builder { -public: - typedef ThirdPartyCapId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapId::Pipeline { -public: - typedef ThirdPartyCapId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinKeyPart::Reader { -public: - typedef JoinKeyPart Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline ::uint16_t getPartCount() const; - - inline ::uint16_t getPartNum() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinKeyPart::Builder { -public: - typedef JoinKeyPart Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline ::uint16_t getPartCount(); - inline void setPartCount( ::uint16_t value); - - inline ::uint16_t getPartNum(); - inline void setPartNum( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinKeyPart::Pipeline { -public: - typedef JoinKeyPart Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinResult::Reader { -public: - typedef JoinResult Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline bool getSucceeded() const; - - inline bool hasCap() const; - inline ::capnp::AnyPointer::Reader getCap() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinResult::Builder { -public: - typedef JoinResult Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline bool getSucceeded(); - inline void setSucceeded(bool value); - - inline bool hasCap(); - inline ::capnp::AnyPointer::Builder getCap(); - inline ::capnp::AnyPointer::Builder initCap(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinResult::Pipeline { -public: - typedef JoinResult Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::twoparty::Side VatId::Reader::getSide() const { - return _reader.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::twoparty::Side VatId::Builder::getSide() { - return _builder.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void VatId::Builder::setSide( ::capnp::rpc::twoparty::Side value) { - _builder.setDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t ProvisionId::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ProvisionId::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ProvisionId::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinKeyPart::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinKeyPart::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartNum() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartNum() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinResult::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinResult::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::getSucceeded() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool JoinResult::Builder::getSucceeded() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setSucceeded(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JoinResult::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader JoinResult::Reader::getCap() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::getCap() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::initCap() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -} // namespace -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a184c7885cdaf2a1_ diff --git a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.h b/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.h deleted file mode 100644 index 093c1fecdf..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc-twoparty.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_TWOPARTY_H_ -#define CAPNP_RPC_TWOPARTY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" -#include -#include - -namespace capnp { - -namespace rpc { - namespace twoparty { - typedef VatId SturdyRefHostId; // For backwards-compatibility with version 0.4. - } -} - -typedef VatNetwork - TwoPartyVatNetworkBase; - -class TwoPartyVatNetwork: public TwoPartyVatNetworkBase, - private TwoPartyVatNetworkBase::Connection { - // A `VatNetwork` that consists of exactly two parties communicating over an arbitrary byte - // stream. This is used to implement the common case of a client/server network. - // - // See `ez-rpc.h` for a simple interface for setting up two-party clients and servers. - // Use `TwoPartyVatNetwork` only if you need the advanced features. - -public: - TwoPartyVatNetwork(kj::AsyncIoStream& stream, rpc::twoparty::Side side, - ReaderOptions receiveOptions = ReaderOptions()); - KJ_DISALLOW_COPY(TwoPartyVatNetwork); - - kj::Promise onDisconnect() { return disconnectPromise.addBranch(); } - // Returns a promise that resolves when the peer disconnects. - - rpc::twoparty::Side getSide() { return side; } - - // implements VatNetwork ----------------------------------------------------- - - kj::Maybe> connect( - rpc::twoparty::VatId::Reader ref) override; - kj::Promise> accept() override; - -private: - class OutgoingMessageImpl; - class IncomingMessageImpl; - - kj::AsyncIoStream& stream; - rpc::twoparty::Side side; - MallocMessageBuilder peerVatId; - ReaderOptions receiveOptions; - bool accepted = false; - - kj::Maybe> previousWrite; - // Resolves when the previous write completes. This effectively serves as the write queue. - // Becomes null when shutdown() is called. - - kj::Own>> acceptFulfiller; - // Fulfiller for the promise returned by acceptConnectionAsRefHost() on the client side, or the - // second call on the server side. Never fulfilled, because there is only one connection. - - kj::ForkedPromise disconnectPromise = nullptr; - - class FulfillerDisposer: public kj::Disposer { - // Hack: TwoPartyVatNetwork is both a VatNetwork and a VatNetwork::Connection. When the RPC - // system detects (or initiates) a disconnection, it drops its reference to the Connection. - // When all references have been dropped, then we want disconnectPromise to be fulfilled. - // So we hand out Owns with this disposer attached, so that we can detect when - // they are dropped. - - public: - mutable kj::Own> fulfiller; - mutable uint refcount = 0; - - void disposeImpl(void* pointer) const override; - }; - FulfillerDisposer disconnectFulfiller; - - kj::Own asConnection(); - // Returns a pointer to this with the disposer set to disconnectFulfiller. - - // implements Connection ----------------------------------------------------- - - rpc::twoparty::VatId::Reader getPeerVatId() override; - kj::Own newOutgoingMessage(uint firstSegmentWordSize) override; - kj::Promise>> receiveIncomingMessage() override; - kj::Promise shutdown() override; -}; - -class TwoPartyServer: private kj::TaskSet::ErrorHandler { - // Convenience class which implements a simple server which accepts connections on a listener - // socket and serices them as two-party connections. - -public: - explicit TwoPartyServer(Capability::Client bootstrapInterface); - - void accept(kj::Own&& connection); - // Accepts the connection for servicing. - - kj::Promise listen(kj::ConnectionReceiver& listener); - // Listens for connections on the given listener. The returned promise never resolves unless an - // exception is thrown while trying to accept. You may discard the returned promise to cancel - // listening. - -private: - Capability::Client bootstrapInterface; - kj::TaskSet tasks; - - struct AcceptedConnection; - - void taskFailed(kj::Exception&& exception) override; -}; - -class TwoPartyClient { - // Convenience class which implements a simple client. - -public: - explicit TwoPartyClient(kj::AsyncIoStream& connection); - TwoPartyClient(kj::AsyncIoStream& connection, Capability::Client bootstrapInterface, - rpc::twoparty::Side side = rpc::twoparty::Side::CLIENT); - - Capability::Client bootstrap(); - // Get the server's bootstrap interface. - - inline kj::Promise onDisconnect() { return network.onDisconnect(); } - -private: - TwoPartyVatNetwork network; - RpcSystem rpcSystem; -}; - -} // namespace capnp - -#endif // CAPNP_RPC_TWOPARTY_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/rpc.capnp b/phonelibs/capnp-cpp/include/capnp/rpc.capnp deleted file mode 100644 index cd808b39f7..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc.capnp +++ /dev/null @@ -1,1399 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb312981b2552a250; -# Recall that Cap'n Proto RPC allows messages to contain references to remote objects that -# implement interfaces. These references are called "capabilities", because they both designate -# the remote object to use and confer permission to use it. -# -# Recall also that Cap'n Proto RPC has the feature that when a method call itself returns a -# capability, the caller can begin calling methods on that capability _before the first call has -# returned_. The caller essentially sends a message saying "Hey server, as soon as you finish -# that previous call, do this with the result!". Cap'n Proto's RPC protocol makes this possible. -# -# The protocol is significantly more complicated than most RPC protocols. However, this is -# implementation complexity that underlies an easy-to-grasp higher-level model of object oriented -# programming. That is, just like TCP is a surprisingly complicated protocol that implements a -# conceptually-simple byte stream abstraction, Cap'n Proto is a surprisingly complicated protocol -# that implements a conceptually-simple object abstraction. -# -# Cap'n Proto RPC is based heavily on CapTP, the object-capability protocol used by the E -# programming language: -# http://www.erights.org/elib/distrib/captp/index.html -# -# Cap'n Proto RPC takes place between "vats". A vat hosts some set of objects and talks to other -# vats through direct bilateral connections. Typically, there is a 1:1 correspondence between vats -# and processes (in the unix sense of the word), although this is not strictly always true (one -# process could run multiple vats, or a distributed virtual vat might live across many processes). -# -# Cap'n Proto does not distinguish between "clients" and "servers" -- this is up to the application. -# Either end of any connection can potentially hold capabilities pointing to the other end, and -# can call methods on those capabilities. In the doc comments below, we use the words "sender" -# and "receiver". These refer to the sender and receiver of an instance of the struct or field -# being documented. Sometimes we refer to a "third-party" that is neither the sender nor the -# receiver. Documentation is generally written from the point of view of the sender. -# -# It is generally up to the vat network implementation to securely verify that connections are made -# to the intended vat as well as to encrypt transmitted data for privacy and integrity. See the -# `VatNetwork` example interface near the end of this file. -# -# When a new connection is formed, the only interesting things that can be done are to send a -# `Bootstrap` (level 0) or `Accept` (level 3) message. -# -# Unless otherwise specified, messages must be delivered to the receiving application in the same -# order in which they were initiated by the sending application. The goal is to support "E-Order", -# which states that two calls made on the same reference must be delivered in the order which they -# were made: -# http://erights.org/elib/concurrency/partial-order.html -# -# Since the full protocol is complicated, we define multiple levels of support that an -# implementation may target. For many applications, level 1 support will be sufficient. -# Comments in this file indicate which level requires the corresponding feature to be -# implemented. -# -# * **Level 0:** The implementation does not support object references. Only the bootstrap interface -# can be called. At this level, the implementation does not support object-oriented protocols and -# is similar in complexity to JSON-RPC or Protobuf services. This level should be considered only -# a temporary stepping-stone toward level 1 as the lack of object references drastically changes -# how protocols are designed. Applications _should not_ attempt to design their protocols around -# the limitations of level 0 implementations. -# -# * **Level 1:** The implementation supports simple bilateral interaction with object references -# and promise pipelining, but interactions between three or more parties are supported only via -# proxying of objects. E.g. if Alice (in Vat A) wants to send Bob (in Vat B) a capability -# pointing to Carol (in Vat C), Alice must create a proxy of Carol within Vat A and send Bob a -# reference to that; Bob cannot form a direct connection to Carol. Level 1 implementations do -# not support checking if two capabilities received from different vats actually point to the -# same object ("join"), although they should be able to do this check on capabilities received -# from the same vat. -# -# * **Level 2:** The implementation supports saving persistent capabilities -- i.e. capabilities -# that remain valid even after disconnect, and can be restored on a future connection. When a -# capability is saved, the requester receives a `SturdyRef`, which is a token that can be used -# to restore the capability later. -# -# * **Level 3:** The implementation supports three-way interactions. That is, if Alice (in Vat A) -# sends Bob (in Vat B) a capability pointing to Carol (in Vat C), then Vat B will automatically -# form a direct connection to Vat C rather than have requests be proxied through Vat A. -# -# * **Level 4:** The entire protocol is implemented, including joins (checking if two capabilities -# are equivalent). -# -# Note that an implementation must also support specific networks (transports), as described in -# the "Network-specific Parameters" section below. An implementation might have different levels -# depending on the network used. -# -# New implementations of Cap'n Proto should start out targeting the simplistic two-party network -# type as defined in `rpc-twoparty.capnp`. With this network type, level 3 is irrelevant and -# levels 2 and 4 are much easier than usual to implement. When such an implementation is paired -# with a container proxy, the contained app effectively gets to make full use of the proxy's -# network at level 4. And since Cap'n Proto IPC is extremely fast, it may never make sense to -# bother implementing any other vat network protocol -- just use the correct container type and get -# it for free. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc"); - -# ======================================================================================== -# The Four Tables -# -# Cap'n Proto RPC connections are stateful (although an application built on Cap'n Proto could -# export a stateless interface). As in CapTP, for each open connection, a vat maintains four state -# tables: questions, answers, imports, and exports. See the diagram at: -# http://www.erights.org/elib/distrib/captp/4tables.html -# -# The question table corresponds to the other end's answer table, and the imports table corresponds -# to the other end's exports table. -# -# The entries in each table are identified by ID numbers (defined below as 32-bit integers). These -# numbers are always specific to the connection; a newly-established connection starts with no -# valid IDs. Since low-numbered IDs will pack better, it is suggested that IDs be assigned like -# Unix file descriptors -- prefer the lowest-number ID that is currently available. -# -# IDs in the questions/answers tables are chosen by the questioner and generally represent method -# calls that are in progress. -# -# IDs in the imports/exports tables are chosen by the exporter and generally represent objects on -# which methods may be called. Exports may be "settled", meaning the exported object is an actual -# object living in the exporter's vat, or they may be "promises", meaning the exported object is -# the as-yet-unknown result of an ongoing operation and will eventually be resolved to some other -# object once that operation completes. Calls made to a promise will be forwarded to the eventual -# target once it is known. The eventual replacement object does *not* get the same ID as the -# promise, as it may turn out to be an object that is already exported (so already has an ID) or -# may even live in a completely different vat (and so won't get an ID on the same export table -# at all). -# -# IDs can be reused over time. To make this safe, we carefully define the lifetime of IDs. Since -# messages using the ID could be traveling in both directions simultaneously, we must define the -# end of life of each ID _in each direction_. The ID is only safe to reuse once it has been -# released by both sides. -# -# When a Cap'n Proto connection is lost, everything on the four tables is lost. All questions are -# canceled and throw exceptions. All imports become broken (all future calls to them throw -# exceptions). All exports and answers are implicitly released. The only things not lost are -# persistent capabilities (`SturdyRef`s). The application must plan for this and should respond by -# establishing a new connection and restoring from these persistent capabilities. - -using QuestionId = UInt32; -# **(level 0)** -# -# Identifies a question in the sender's question table (which corresponds to the receiver's answer -# table). The questioner (caller) chooses an ID when making a call. The ID remains valid in -# caller -> callee messages until a Finish message is sent, and remains valid in callee -> caller -# messages until a Return message is sent. - -using AnswerId = QuestionId; -# **(level 0)** -# -# Identifies an answer in the sender's answer table (which corresponds to the receiver's question -# table). -# -# AnswerId is physically equivalent to QuestionId, since the question and answer tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. - -using ExportId = UInt32; -# **(level 1)** -# -# Identifies an exported capability or promise in the sender's export table (which corresponds -# to the receiver's import table). The exporter chooses an ID before sending a capability over the -# wire. If the capability is already in the table, the exporter should reuse the same ID. If the -# ID is a promise (as opposed to a settled capability), this must be indicated at the time the ID -# is introduced (e.g. by using `senderPromise` instead of `senderHosted` in `CapDescriptor`); in -# this case, the importer shall expect a later `Resolve` message that replaces the promise. -# -# ExportId/ImportIds are subject to reference counting. Whenever an `ExportId` is sent over the -# wire (from the exporter to the importer), the export's reference count is incremented (unless -# otherwise specified). The reference count is later decremented by a `Release` message. Since -# the `Release` message can specify an arbitrary number by which to reduce the reference count, the -# importer should usually batch reference decrements and only send a `Release` when it believes the -# reference count has hit zero. Of course, it is possible that a new reference to the export is -# in-flight at the time that the `Release` message is sent, so it is necessary for the exporter to -# keep track of the reference count on its end as well to avoid race conditions. -# -# When a connection is lost, all exports are implicitly released. It is not possible to restore -# a connection state after disconnect (although a transport layer could implement a concept of -# persistent connections if it is transparent to the RPC layer). - -using ImportId = ExportId; -# **(level 1)** -# -# Identifies an imported capability or promise in the sender's import table (which corresponds to -# the receiver's export table). -# -# ImportId is physically equivalent to ExportId, since the export and import tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. -# -# An `ImportId` remains valid in importer -> exporter messages until the importer has sent -# `Release` messages that (it believes) have reduced the reference count to zero. - -# ======================================================================================== -# Messages - -struct Message { - # An RPC connection is a bi-directional stream of Messages. - - union { - unimplemented @0 :Message; - # The sender previously received this message from the peer but didn't understand it or doesn't - # yet implement the functionality that was requested. So, the sender is echoing the message - # back. In some cases, the receiver may be able to recover from this by pretending the sender - # had taken some appropriate "null" action. - # - # For example, say `resolve` is received by a level 0 implementation (because a previous call - # or return happened to contain a promise). The level 0 implementation will echo it back as - # `unimplemented`. The original sender can then simply release the cap to which the promise - # had resolved, thus avoiding a leak. - # - # For any message type that introduces a question, if the message comes back unimplemented, - # the original sender may simply treat it as if the question failed with an exception. - # - # In cases where there is no sensible way to react to an `unimplemented` message (without - # resource leaks or other serious problems), the connection may need to be aborted. This is - # a gray area; different implementations may take different approaches. - - abort @1 :Exception; - # Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. - # because the sender received an invalid or nonsensical message (`isCallersFault` is true) or - # because the sender had an internal error (`isCallersFault` is false). The sender will shut - # down the outgoing half of the connection after `abort` and will completely close the - # connection shortly thereafter (it's up to the sender how much of a time buffer they want to - # offer for the client to receive the `abort` before the connection is reset). - - # Level 0 features ----------------------------------------------- - - bootstrap @8 :Bootstrap; # Request the peer's bootstrap interface. - call @2 :Call; # Begin a method call. - return @3 :Return; # Complete a method call. - finish @4 :Finish; # Release a returned answer / cancel a call. - - # Level 1 features ----------------------------------------------- - - resolve @5 :Resolve; # Resolve a previously-sent promise. - release @6 :Release; # Release a capability so that the remote object can be deallocated. - disembargo @13 :Disembargo; # Lift an embargo used to enforce E-order over promise resolution. - - # Level 2 features ----------------------------------------------- - - obsoleteSave @7 :AnyPointer; - # Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced - # by the `Persistent` interface defined in `persistent.capnp`. This operation was never - # implemented. - - obsoleteDelete @9 :AnyPointer; - # Obsolete way to delete a SturdyRef. This operation was never implemented. - - # Level 3 features ----------------------------------------------- - - provide @10 :Provide; # Provide a capability to a third party. - accept @11 :Accept; # Accept a capability provided by a third party. - - # Level 4 features ----------------------------------------------- - - join @12 :Join; # Directly connect to the common root of two or more proxied caps. - } -} - -# Level 0 message types ---------------------------------------------- - -struct Bootstrap { - # **(level 0)** - # - # Get the "bootstrap" interface exported by the remote vat. - # - # For level 0, 1, and 2 implementations, the "bootstrap" interface is simply the main interface - # exported by a vat. If the vat acts as a server fielding connections from clients, then the - # bootstrap interface defines the basic functionality available to a client when it connects. - # The exact interface definition obviously depends on the application. - # - # We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would - # never be used. In such a world, any time you connect to a new vat, you do so because you - # received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message - # you send is `Accept`, and further communications derive from there. `Bootstrap` is not used. - # - # In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would - # actually return a new Cap'n Proto capability, thus introducing you to the target system via - # level 3 RPC. Applications would receive the capability to talk to DNS in the first place as - # an initial endowment or part of a Powerbox interaction. Therefore, an app can form arbitrary - # connections without ever using `Bootstrap`. - # - # Of course, in the real world, DNS is not Cap'n-Proto-based, and we don't want Cap'n Proto to - # require a whole new internet infrastructure to be useful. Therefore, we offer bootstrap - # interfaces as a way to get up and running without a level 3 introduction. Thus, bootstrap - # interfaces are used to "bootstrap" from other, non-Cap'n-Proto-based means of service discovery, - # such as legacy DNS. - # - # Note that a vat need not provide a bootstrap interface, and in fact many vats (especially those - # acting as clients) do not. In this case, the vat should either reply to `Bootstrap` with a - # `Return` indicating an exception, or should return a dummy capability with no methods. - - questionId @0 :QuestionId; - # A new question ID identifying this request, which will eventually receive a Return message - # containing the restored capability. - - deprecatedObjectId @1 :AnyPointer; - # ** DEPRECATED ** - # - # A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies - # which one to return. If this pointer is null, then the default bootstrap interface is returned. - # - # As of verison 0.5, use of this field is deprecated. If a service wants to export multiple - # bootstrap interfaces, it should instead define a single bootstarp interface that has methods - # that return each of the other interfaces. - # - # **History** - # - # In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. - # At the time, it was thought that this would eventually serve as the way to restore SturdyRefs - # (level 2). Meanwhile, an application could offer its "main" interface on a well-known - # (non-secret) SturdyRef. - # - # Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only - # used to obtain the main interface. Since most applications had only one main interface that - # they wanted to restore, they tended to designate this with a null `objectId`. - # - # Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting - # multiple main interfaces by allowing them to be exported under string names. In this case, - # `objectId` was a Text value specifying the name. - # - # All of this proved problematic for several reasons: - # - # - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what - # machine to connect to and would be able to immediately restore a SturdyRef on connection. - # However, in practice, the ability to restore SturdyRefs is itself a capability that may - # require going through an authentication process to obtain. Thus, it makes more sense to - # define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is - # offered as the vat's bootstrap interface, then this is equivalent to the old arrangement. - # - # - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the - # practice of exporting singleton services with string names. If singleton services are desired, - # it is better to have one main interface that has methods that can be used to obtain each - # service, in order to get all the usual benefits of schemas and type checking. - # - # - Overloading "Restore" also had a security problem: Often, "main" or "well-known" - # capabilities exported by a vat are in fact not public: they are intended to be accessed only - # by clients who are capable of forming a connection to the vat. This can lead to trouble if - # the client itself has other clients and wishes to foward some `Restore` requests from those - # external clients -- it has to be very careful not to allow through `Restore` requests - # addressing the default capability. - # - # For example, consider the case of a sandboxed Sandstorm application and its supervisor. The - # application exports a default capability to its supervisor that provides access to - # functionality that only the supervisor is supposed to access. Meanwhile, though, applications - # may publish other capabilities that may be persistent, in which case the application needs - # to field `Restore` requests that could come from anywhere. These requests of course have to - # pass through the supervisor, as all communications with the outside world must. But, the - # supervisor has to be careful not to honor an external request addressing the application's - # default capability, since this capability is privileged. Unfortunately, the default - # capability cannot be given an unguessable name, because then the supervisor itself would not - # be able to address it! - # - # As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for - # use in restoring SturdyRefs. - # - # Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a - # SturdyRef, but indicated that the client would not restore the ref again in the future. This - # operation was never implemented, so it was removed entirely. If a "delete" operation is desired, - # it should exist as a method on the same interface that handles restoring SturdyRefs. However, - # the utility of such an operation is questionable. You wouldn't be able to rely on it for - # garbage collection since a client could always disappear permanently without remembering to - # delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to - # design systems such that SturdyRefs never represent "owned" pointers. - # - # For example, say a SturdyRef points to an image file hosted on some server. That image file - # should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by - # a user who can delete the image at any time. If the user deletes the image, the SturdyRef - # stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the - # existence of the image in its collection. -} - -struct Call { - # **(level 0)** - # - # Message type initiating a method call on a capability. - - questionId @0 :QuestionId; - # A number, chosen by the caller, that identifies this call in future messages. This number - # must be different from all other calls originating from the same end of the connection (but - # may overlap with question IDs originating from the opposite end). A fine strategy is to use - # sequential question IDs, but the recipient should not assume this. - # - # A question ID can be reused once both: - # - A matching Return has been received from the callee. - # - A matching Finish has been sent from the caller. - - target @1 :MessageTarget; - # The object that should receive this call. - - interfaceId @2 :UInt64; - # The type ID of the interface being called. Each capability may implement multiple interfaces. - - methodId @3 :UInt16; - # The ordinal number of the method to call within the requested interface. - - allowThirdPartyTailCall @8 :Bool = false; - # Indicates whether or not the receiver is allowed to send a `Return` containing - # `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee - # will have to proxy the return in the case of a tail call to a third-party vat. - - params @4 :Payload; - # The call parameters. `params.content` is a struct whose fields correspond to the parameters of - # the method. - - sendResultsTo :union { - # Where should the return message be sent? - - caller @5 :Void; - # Send the return message back to the caller (the usual). - - yourself @6 :Void; - # **(level 1)** - # - # Don't actually return the results to the sender. Instead, hold on to them and await - # instructions from the sender regarding what to do with them. In particular, the sender - # may subsequently send a `Return` for some other call (which the receiver had previously made - # to the sender) with `takeFromOtherQuestion` set. The results from this call are then used - # as the results of the other call. - # - # When `yourself` is used, the receiver must still send a `Return` for the call, but sets the - # field `resultsSentElsewhere` in that `Return` rather than including the results. - # - # This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up - # returning the result of a call from Vat B back to Vat A. - # - # In particular, the most common use case for this feature is when Vat A makes a call to a - # promise in Vat B, and then that promise ends up resolving to a capability back in Vat A. - # Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself` - # in the calls so that the results need not pass back through Vat B. - # - # For example: - # - Alice, in Vat A, call foo() on Bob in Vat B. - # - Alice makes a pipelined call bar() on the promise returned by foo(). - # - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next - # to Alice). - # - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'(). - # Notice that bar() and bar'() are travelling in opposite directions on the same network - # link. - # - The `Call` for bar'() has `sendResultsTo` set to `yourself`, with the value being the - # question ID originally assigned to the bar() call. - # - Vat A receives bar'() and delivers it to Carol. - # - When bar'() returns, Vat A immediately takes the results and returns them from bar(). - # - Meanwhile, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere` set in - # place of results. - # - Vat A sends a `Finish` for that call to Vat B. - # - Vat B receives the `Return` for bar'() and sends a `Return` for bar(), with - # `receivedFromYourself` set in place of the results. - # - Vat B receives the `Finish` for bar() and sends a `Finish` to bar'(). - - thirdParty @7 :RecipientId; - # **(level 3)** - # - # The call's result should be returned to a different vat. The receiver (the callee) expects - # to receive an `Accept` message from the indicated vat, and should return the call's result - # to it, rather than to the sender of the `Call`. - # - # This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` - # messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from - # Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends - # an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C - # also sends a `Return` to Vat B with `resultsSentElsewhere`. - } -} - -struct Return { - # **(level 0)** - # - # Message type sent from callee to caller indicating that the call has completed. - - answerId @0 :AnswerId; - # Equal to the QuestionId of the corresponding `Call` message. - - releaseParamCaps @1 :Bool = true; - # If true, all capabilities that were in the params should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # to set it to false they'll quickly get errors. - - union { - results @2 :Payload; - # The result. - # - # For regular method calls, `results.content` points to the result struct. - # - # For a `Return` in response to an `Accept`, `results` contains a single capability (rather - # than a struct), and `results.content` is just a capability pointer with index 0. A `Finish` - # is still required in this case. - - exception @3 :Exception; - # Indicates that the call failed and explains why. - - canceled @4 :Void; - # Indicates that the call was canceled due to the caller sending a Finish message - # before the call had completed. - - resultsSentElsewhere @5 :Void; - # This is set when returning from a `Call` that had `sendResultsTo` set to something other - # than `caller`. - - takeFromOtherQuestion @6 :QuestionId; - # The sender has also sent (before this message) a `Call` with the given question ID and with - # `sendResultsTo.yourself` set, and the results of that other call should be used as the - # results here. - - acceptFromThirdParty @7 :ThirdPartyCapId; - # **(level 3)** - # - # The caller should contact a third-party vat to pick up the results. An `Accept` message - # sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`. - # It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set. - } -} - -struct Finish { - # **(level 0)** - # - # Message type sent from the caller to the callee to indicate: - # 1) The questionId will no longer be used in any messages sent by the callee (no further - # pipelined requests). - # 2) If the call has not returned yet, the caller no longer cares about the result. If nothing - # else cares about the result either (e.g. there are no other outstanding calls pipelined on - # the result of this one) then the callee may wish to immediately cancel the operation and - # send back a Return message with "canceled" set. However, implementations are not required - # to support premature cancellation -- instead, the implementation may wait until the call - # actually completes and send a normal `Return` message. - # - # TODO(someday): Should we separate (1) and implicitly releasing result capabilities? It would be - # possible and useful to notify the server that it doesn't need to keep around the response to - # service pipeline requests even though the caller still wants to receive it / hasn't yet - # finished processing it. It could also be useful to notify the server that it need not marshal - # the results because the caller doesn't want them anyway, even if the caller is still sending - # pipelined calls, although this seems less useful (just saving some bytes on the wire). - - questionId @0 :QuestionId; - # ID of the call whose result is to be released. - - releaseResultCaps @1 :Bool = true; - # If true, all capabilities that were in the results should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # set it false they'll quickly get errors. -} - -# Level 1 message types ---------------------------------------------- - -struct Resolve { - # **(level 1)** - # - # Message type sent to indicate that a previously-sent promise has now been resolved to some other - # object (possibly another promise) -- or broken, or canceled. - # - # Keep in mind that it's possible for a `Resolve` to be sent to a level 0 implementation that - # doesn't implement it. For example, a method call or return might contain a capability in the - # payload. Normally this is fine even if the receiver is level 0, because they will implicitly - # release all such capabilities on return / finish. But if the cap happens to be a promise, then - # a follow-up `Resolve` may be sent regardless of this release. The level 0 receiver will reply - # with an `unimplemented` message, and the sender (of the `Resolve`) can respond to this as if the - # receiver had immediately released any capability to which the promise resolved. - # - # When implementing promise resolution, it's important to understand how embargos work and the - # tricky case of the Tribble 4-way race condition. See the comments for the Disembargo message, - # below. - - promiseId @0 :ExportId; - # The ID of the promise to be resolved. - # - # Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does - # _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver - # will release the export soon after receiving `Resolve`, and the sender will not send this - # `ExportId` again until it has been released and recycled. - # - # When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise, - # this indicates that the sender will follow up at some point with a `Resolve` message. If the - # same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the - # same ID is sent again later _after_ a `Resolve`, it can only be because the export's - # reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore - # this later promise does _not_ correspond to the earlier `Resolve`. - # - # If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve` - # message may or may not still be sent (the `Resolve` may have already been in-flight when - # `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer - # any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which - # the receiver has no knowledge, because it already released it earlier. In this case, the - # receiver should simply release the capability to which the promise resolved. - - union { - cap @1 :CapDescriptor; - # The object to which the promise resolved. - # - # The sender promises that from this point forth, until `promiseId` is released, it shall - # simply forward all messages to the capability designated by `cap`. This is true even if - # `cap` itself happens to desigate another promise, and that other promise later resolves -- - # messages sent to `promiseId` shall still go to that other promise, not to its resolution. - # This is important in the case that the receiver of the `Resolve` ends up sending a - # `Disembargo` message towards `promiseId` in order to control message ordering -- that - # `Disembargo` really needs to reflect back to exactly the object designated by `cap` even - # if that object is itself a promise. - - exception @2 :Exception; - # Indicates that the promise was broken. - } -} - -struct Release { - # **(level 1)** - # - # Message type sent to indicate that the sender is done with the given capability and the receiver - # can free resources allocated to it. - - id @0 :ImportId; - # What to release. - - referenceCount @1 :UInt32; - # The amount by which to decrement the reference count. The export is only actually released - # when the reference count reaches zero. -} - -struct Disembargo { - # **(level 1)** - # - # Message sent to indicate that an embargo on a recently-resolved promise may now be lifted. - # - # Embargos are used to enforce E-order in the presence of promise resolution. That is, if an - # application makes two calls foo() and bar() on the same capability reference, in that order, - # the calls should be delivered in the order in which they were made. But if foo() is called - # on a promise, and that promise happens to resolve before bar() is called, then the two calls - # may travel different paths over the network, and thus could arrive in the wrong order. In - # this case, the call to `bar()` must be embargoed, and a `Disembargo` message must be sent along - # the same path as `foo()` to ensure that the `Disembargo` arrives after `foo()`. Once the - # `Disembargo` arrives, `bar()` can then be delivered. - # - # There are two particular cases where embargos are important. Consider object Alice, in Vat A, - # who holds a promise P, pointing towards Vat B, that eventually resolves to Carol. The two - # cases are: - # - Carol lives in Vat A, i.e. next to Alice. In this case, Vat A needs to send a `Disembargo` - # message that echos through Vat B and back, to ensure that all pipelined calls on the promise - # have been delivered. - # - Carol lives in a different Vat C. When the promise resolves, a three-party handoff occurs - # (see `Provide` and `Accept`, which constitute level 3 of the protocol). In this case, we - # piggyback on the state that has already been set up to handle the handoff: the `Accept` - # message (from Vat A to Vat C) is embargoed, as are all pipelined messages sent to it, while - # a `Disembargo` message is sent from Vat A through Vat B to Vat C. See `Accept.embargo` for - # an example. - # - # Note that in the case where Carol actually lives in Vat B (i.e., the same vat that the promise - # already pointed at), no embargo is needed, because the pipelined calls are delivered over the - # same path as the later direct calls. - # - # Keep in mind that promise resolution happens both in the form of Resolve messages as well as - # Return messages (which resolve PromisedAnswers). Embargos apply in both cases. - # - # An alternative strategy for enforcing E-order over promise resolution could be for Vat A to - # implement the embargo internally. When Vat A is notified of promise resolution, it could - # send a dummy no-op call to promise P and wait for it to complete. Until that call completes, - # all calls to the capability are queued locally. This strategy works, but is pessimistic: - # in the three-party case, it requires an A -> B -> C -> B -> A round trip before calls can start - # being delivered directly to from Vat A to Vat C. The `Disembargo` message allows latency to be - # reduced. (In the two-party loopback case, the `Disembargo` message is just a more explicit way - # of accomplishing the same thing as a no-op call, but isn't any faster.) - # - # *The Tribble 4-way Race Condition* - # - # Any implementation of promise resolution and embargos must be aware of what we call the - # "Tribble 4-way race condition", after Dean Tribble, who explained the problem in a lively - # Friam meeting. - # - # Embargos are designed to work in the case where a two-hop path is being shortened to one hop. - # But sometimes there are more hops. Imagine that Alice has a reference to a remote promise P1 - # that eventually resolves to _another_ remote promise P2 (in a third vat), which _at the same - # time_ happens to resolve to Bob (in a fourth vat). In this case, we're shortening from a 3-hop - # path (with four parties) to a 1-hop path (Alice -> Bob). - # - # Extending the embargo/disembargo protocol to be able to shorted multiple hops at once seems - # difficult. Instead, we make a rule that prevents this case from coming up: - # - # One a promise P has been resolved to a remove object reference R, then all further messages - # received addressed to P will be forwarded strictly to R. Even if it turns out later that R is - # itself a promise, and has resolved to some other object Q, messages sent to P will still be - # forwarded to R, not directly to Q (R will of course further forward the messages to Q). - # - # This rule does not cause a significant performance burden because once P has resolved to R, it - # is expected that people sending messages to P will shortly start sending them to R instead and - # drop P. P is at end-of-life anyway, so it doesn't matter if it ignores chances to further - # optimize its path. - - target @0 :MessageTarget; - # What is to be disembargoed. - - using EmbargoId = UInt32; - # Used in `senderLoopback` and `receiverLoopback`, below. - - context :union { - senderLoopback @1 :EmbargoId; - # The sender is requesting a disembargo on a promise that is known to resolve back to a - # capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls - # on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback` - # set to the same value as `senderLoopback`. This value is chosen by the sender, and since - # it is also consumed be the sender, the sender can use whatever strategy it wants to make sure - # the value is unambiguous. - # - # The receiver must verify that the target capability actually resolves back to the sender's - # vat. Otherwise, the sender has committed a protocol error and should be disconnected. - - receiverLoopback @2 :EmbargoId; - # The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to - # this capability, and that Disembargo is now being echoed back. - - accept @3 :Void; - # **(level 3)** - # - # The sender is requesting a disembargo on a promise that is known to resolve to a third-party - # capability that the sender is currently in the process of accepting (using `Accept`). - # The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The - # receiver should now send a `Disembargo` with `provide` set to the question ID of that - # `Provide` message. - # - # See `Accept.embargo` for an example. - - provide @4 :QuestionId; - # **(level 3)** - # - # The sender is requesting a disembargo on a capability currently being provided to a third - # party. The question ID identifies the `Provide` message previously sent by the sender to - # this capability. On receipt, the receiver (the capability host) shall release the embargo - # on the `Accept` message that it has received from the third party. See `Accept.embargo` for - # an example. - } -} - -# Level 2 message types ---------------------------------------------- - -# See persistent.capnp. - -# Level 3 message types ---------------------------------------------- - -struct Provide { - # **(level 3)** - # - # Message type sent to indicate that the sender wishes to make a particular capability implemented - # by the receiver available to a third party for direct access (without the need for the third - # party to proxy through the sender). - # - # (In CapTP, `Provide` and `Accept` are methods of the global `NonceLocator` object exported by - # every vat. In Cap'n Proto, we bake this into the core protocol.) - - questionId @0 :QuestionId; - # Question ID to be held open until the recipient has received the capability. A result will be - # returned once the third party has successfully received the capability. The sender must at some - # point send a `Finish` message as with any other call, and that message can be used to cancel the - # whole operation. - - target @1 :MessageTarget; - # What is to be provided to the third party. - - recipient @2 :RecipientId; - # Identity of the third party that is expected to pick up the capability. -} - -struct Accept { - # **(level 3)** - # - # Message type sent to pick up a capability hosted by the receiving vat and provided by a third - # party. The third party previously designated the capability using `Provide`. - # - # This message is also used to pick up a redirected return -- see `Return.redirect`. - - questionId @0 :QuestionId; - # A new question ID identifying this accept message, which will eventually receive a Return - # message containing the provided capability (or the call result in the case of a redirected - # return). - - provision @1 :ProvisionId; - # Identifies the provided object to be picked up. - - embargo @2 :Bool; - # If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent, - # and any pipelined calls will not be delivered, until the embargo is released. The receiver - # (the capability host) will expect the provider (the vat that sent the `Provide` message) to - # eventually send a `Disembargo` message with the field `context.provide` set to the question ID - # of the original `Provide` message. At that point, the embargo is released and the queued - # messages are delivered. - # - # For example: - # - Alice, in Vat A, holds a promise P, which currently points toward Vat B. - # - Alice calls foo() on P. The `Call` message is sent to Vat B. - # - The promise P in Vat B ends up resolving to Carol, in Vat C. - # - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient. - # - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a - # `ThirdPartyCapId` identifying Carol in Vat C. - # - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that - # it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept` - # message. - # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set. - # - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't - # know anything about the mechanics of promise resolution happening under the hood, but she - # expects that bar() will be delivered after foo() because that is the order in which she - # initiated the calls. - # - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which - # hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability - # are embargoed, Vat C does not deliver the call yet. - # - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C. - # - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the - # question ID of the `Provide` message it had sent previously. - # - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo() - # before delivering bar(). - # - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from - # Vat A, as well as deliver bar(). -} - -# Level 4 message types ---------------------------------------------- - -struct Join { - # **(level 4)** - # - # Message type sent to implement E.join(), which, given a number of capabilities that are - # expected to be equivalent, finds the underlying object upon which they all agree and forms a - # direct connection to it, skipping any proxies that may have been constructed by other vats - # while transmitting the capability. See: - # http://erights.org/elib/equality/index.html - # - # Note that this should only serve to bypass fully-transparent proxies -- proxies that were - # created merely for convenience, without any intention of hiding the underlying object. - # - # For example, say Bob holds two capabilities hosted by Alice and Carol, but he expects that both - # are simply proxies for a capability hosted elsewhere. He then issues a join request, which - # operates as follows: - # - Bob issues Join requests on both Alice and Carol. Each request contains a different piece - # of the JoinKey. - # - Alice is proxying a capability hosted by Dana, so forwards the request to Dana's cap. - # - Dana receives the first request and sees that the JoinKeyPart is one of two. She notes that - # she doesn't have the other part yet, so she records the request and responds with a - # JoinResult. - # - Alice relays the JoinAswer back to Bob. - # - Carol is also proxying a capability from Dana, and so forwards her Join request to Dana as - # well. - # - Dana receives Carol's request and notes that she now has both parts of a JoinKey. She - # combines them in order to form information needed to form a secure connection to Bob. She - # also responds with another JoinResult. - # - Bob receives the responses from Alice and Carol. He uses the returned JoinResults to - # determine how to connect to Dana and attempts to form the connection. Since Bob and Dana now - # agree on a secret key that neither Alice nor Carol ever saw, this connection can be made - # securely even if Alice or Carol is conspiring against the other. (If Alice and Carol are - # conspiring _together_, they can obviously reproduce the key, but this doesn't matter because - # the whole point of the join is to verify that Alice and Carol agree on what capability they - # are proxying.) - # - # If the two capabilities aren't actually proxies of the same object, then the join requests - # will come back with conflicting `hostId`s and the join will fail before attempting to form any - # connection. - - questionId @0 :QuestionId; - # Question ID used to respond to this Join. (Note that this ID only identifies one part of the - # request for one hop; each part has a different ID and relayed copies of the request have - # (probably) different IDs still.) - # - # The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult` - # is relayed from the joined object's host, possibly with transformation applied as needed - # by the network. - # - # Like any return, the result must be released using a `Finish`. However, this release - # should not occur until the joiner has either successfully connected to the joined object. - # Vats relaying a `Join` message similarly must not release the result they receive until the - # return they relayed back towards the joiner has itself been released. This allows the - # joined object's host to detect when the Join operation is canceled before completing -- if - # it receives a `Finish` for one of the join results before the joiner successfully - # connects. It can then free any resources it had allocated as part of the join. - - target @1 :MessageTarget; - # The capability to join. - - keyPart @2 :JoinKeyPart; - # A part of the join key. These combine to form the complete join key, which is used to establish - # a direct connection. - - # TODO(before implementing): Change this so that multiple parts can be sent in a single Join - # message, so that if multiple join parts are going to cross the same connection they can be sent - # together, so that the receive can potentially optimize its handling of them. In the case where - # all parts are bundled together, should the recipient be expected to simply return a cap, so - # that the caller can immediately start pipelining to it? -} - -# ======================================================================================== -# Common structures used in messages - -struct MessageTarget { - # The target of a `Call` or other messages that target a capability. - - union { - importedCap @0 :ImportId; - # This message is to a capability or promise previously imported by the caller (exported by - # the receiver). - - promisedAnswer @1 :PromisedAnswer; - # This message is to a capability that is expected to be returned by another call that has not - # yet been completed. - # - # At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so - # that initial startup doesn't require a round trip. - } -} - -struct Payload { - # Represents some data structure that might contain capabilities. - - content @0 :AnyPointer; - # Some Cap'n Proto data structure. Capability pointers embedded in this structure index into - # `capTable`. - - capTable @1 :List(CapDescriptor); - # Descriptors corresponding to the cap pointers in `content`. -} - -struct CapDescriptor { - # **(level 1)** - # - # When an application-defined type contains an interface pointer, that pointer contains an index - # into the message's capability table -- i.e. the `capTable` part of the `Payload`. Each - # capability in the table is represented as a `CapDescriptor`. The runtime API should not reveal - # the CapDescriptor directly to the application, but should instead wrap it in some kind of - # callable object with methods corresponding to the interface that the capability implements. - # - # Keep in mind that `ExportIds` in a `CapDescriptor` are subject to reference counting. See the - # description of `ExportId`. - - union { - none @0 :Void; - # There is no capability here. This `CapDescriptor` should not appear in the payload content. - # A `none` CapDescriptor can be generated when an application inserts a capability into a - # message and then later changes its mind and removes it -- rewriting all of the other - # capability pointers may be hard, so instead a tombstone is left, similar to the way a removed - # struct or list instance is zeroed out of the message but the space is not reclaimed. - # Hopefully this is unusual. - - senderHosted @1 :ExportId; - # A capability newly exported by the sender. This is the ID of the new capability in the - # sender's export table (receiver's import table). - - senderPromise @2 :ExportId; - # A promise that the sender will resolve later. The sender will send exactly one Resolve - # message at a future point in time to replace this promise. Note that even if the same - # `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of - # them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this - # `CapDescriptor`) may choose not to send the `Resolve` at all. - - receiverHosted @3 :ImportId; - # A capability (or promise) previously exported by the receiver (imported by the sender). - - receiverAnswer @4 :PromisedAnswer; - # A capability expected to be returned in the results of a currently-outstanding call posed - # by the sender. - - thirdPartyHosted @5 :ThirdPartyCapDescriptor; - # **(level 3)** - # - # A capability that lives in neither the sender's nor the receiver's vat. The sender needs - # to form a direct connection to a third party to pick up the capability. - # - # Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its - # `vine` instead. - } -} - -struct PromisedAnswer { - # **(mostly level 1)** - # - # Specifies how to derive a promise from an unanswered question, by specifying the path of fields - # to follow from the root of the eventual result struct to get to the desired capability. Used - # to address method calls to a not-yet-returned capability or to pass such a capability as an - # input to some other method call. - # - # Level 0 implementations must support `PromisedAnswer` only for the case where the answer is - # to a `Bootstrap` message. In this case, `path` is always empty since `Bootstrap` always returns - # a raw capability. - - questionId @0 :QuestionId; - # ID of the question (in the sender's question table / receiver's answer table) whose answer is - # expected to contain the capability. - - transform @1 :List(Op); - # Operations / transformations to apply to the result in order to get the capability actually - # being addressed. E.g. if the result is a struct and you want to call a method on a capability - # pointed to by a field of the struct, you need a `getPointerField` op. - - struct Op { - union { - noop @0 :Void; - # Does nothing. This member is mostly defined so that we can make `Op` a union even - # though (as of this writing) only one real operation is defined. - - getPointerField @1 :UInt16; - # Get a pointer field within a struct. The number is an index into the pointer section, NOT - # a field ordinal, so that the receiver does not need to understand the schema. - - # TODO(someday): We could add: - # - For lists, the ability to address every member of the list, or a slice of the list, the - # result of which would be another list. This is useful for implementing the equivalent of - # a SQL table join (not to be confused with the `Join` message type). - # - Maybe some ability to test a union. - # - Probably not a good idea: the ability to specify an arbitrary script to run on the - # result. We could define a little stack-based language where `Op` specifies one - # "instruction" or transformation to apply. Although this is not a good idea - # (over-engineered), any narrower additions to `Op` should be designed as if this - # were the eventual goal. - } - } -} - -struct ThirdPartyCapDescriptor { - # **(level 3)** - # - # Identifies a capability in a third-party vat that the sender wants the receiver to pick up. - - id @0 :ThirdPartyCapId; - # Identifies the third-party host and the specific capability to accept from it. - - vineId @1 :ExportId; - # A proxy for the third-party object exported by the sender. In CapTP terminology this is called - # a "vine", because it is an indirect reference to the third-party object that snakes through the - # sender vat. This serves two purposes: - # - # * Level 1 and 2 implementations that don't understand how to connect to a third party may - # simply send calls to the vine. Such calls will be forwarded to the third-party by the - # sender. - # - # * Level 3 implementations must release the vine once they have successfully picked up the - # object from the third party. This ensures that the capability is not released by the sender - # prematurely. - # - # The sender will close the `Provide` request that it has sent to the third party as soon as - # it receives either a `Call` or a `Release` message directed at the vine. -} - -struct Exception { - # **(level 0)** - # - # Describes an arbitrary error that prevented an operation (e.g. a call) from completing. - # - # Cap'n Proto exceptions always indicate that something went wrong. In other words, in a fantasy - # world where everything always works as expected, no exceptions would ever be thrown. Clients - # should only ever catch exceptions as a means to implement fault-tolerance, where "fault" can - # mean: - # - Bugs. - # - Invalid input. - # - Configuration errors. - # - Network problems. - # - Insufficient resources. - # - Version skew (unimplemented functionality). - # - Other logistical problems. - # - # Exceptions should NOT be used to flag application-specific conditions that a client is expected - # to handle in an application-specific way. Put another way, in the Cap'n Proto world, - # "checked exceptions" (where an interface explicitly defines the exceptions it throws and - # clients are forced by the type system to handle those exceptions) do NOT make sense. - - reason @0 :Text; - # Human-readable failure description. - - type @3 :Type; - # The type of the error. The purpose of this enum is not to describe the error itself, but - # rather to describe how the client might want to respond to the error. - - enum Type { - failed @0; - # A generic problem occurred, and it is believed that if the operation were repeated without - # any change in the state of the world, the problem would occur again. - # - # A client might respond to this error by logging it for investigation by the developer and/or - # displaying it to the user. - - overloaded @1; - # The request was rejected due to a temporary lack of resources. - # - # Examples include: - # - There's not enough CPU time to keep up with incoming requests, so some are rejected. - # - The server ran out of RAM or disk space during the request. - # - The operation timed out (took significantly longer than it should have). - # - # A client might respond to this error by scheduling to retry the operation much later. The - # client should NOT retry again immediately since this would likely exacerbate the problem. - - disconnected @2; - # The method failed because a connection to some necessary capability was lost. - # - # Examples include: - # - The client introduced the server to a third-party capability, the connection to that third - # party was subsequently lost, and then the client requested that the server use the dead - # capability for something. - # - The client previously requested that the server obtain a capability from some third party. - # The server returned a capability to an object wrapping the third-party capability. Later, - # the server's connection to the third party was lost. - # - The capability has been revoked. Revocation does not necessarily mean that the client is - # no longer authorized to use the capability; it is often used simply as a way to force the - # client to repeat the setup process, perhaps to efficiently move them to a new back-end or - # get them to recognize some other change that has occurred. - # - # A client should normally respond to this error by releasing all capabilities it is currently - # holding related to the one it called and then re-creating them by restoring SturdyRefs and/or - # repeating the method calls used to create them originally. In other words, disconnect and - # start over. This should in turn cause the server to obtain a new copy of the capability that - # it lost, thus making everything work. - # - # If the client receives another `disconnencted` error in the process of rebuilding the - # capability and retrying the call, it should treat this as an `overloaded` error: the network - # is currently unreliable, possibly due to load or other temporary issues. - - unimplemented @3; - # The server doesn't implement the requested method. If there is some other method that the - # client could call (perhaps an older and/or slower interface), it should try that instead. - # Otherwise, this should be treated like `failed`. - } - - obsoleteIsCallersFault @1 :Bool; - # OBSOLETE. Ignore. - - obsoleteDurability @2 :UInt16; - # OBSOLETE. See `type` instead. -} - -# ======================================================================================== -# Network-specific Parameters -# -# Some parts of the Cap'n Proto RPC protocol are not specified here because different vat networks -# may wish to use different approaches to solving them. For example, on the public internet, you -# may want to authenticate vats using public-key cryptography, but on a local intranet with trusted -# infrastructure, you may be happy to authenticate based on network address only, or some other -# lightweight mechanism. -# -# To accommodate this, we specify several "parameter" types. Each type is defined here as an -# alias for `AnyPointer`, but a specific network will want to define a specific set of types to use. -# All vats in a vat network must agree on these parameters in order to be able to communicate. -# Inter-network communication can be accomplished through "gateways" that perform translation -# between the primitives used on each network; these gateways may need to be deeply stateful, -# depending on the translations they perform. -# -# For interaction over the global internet between parties with no other prior arrangement, a -# particular set of bindings for these types is defined elsewhere. (TODO(someday): Specify where -# these common definitions live.) -# -# Another common network type is the two-party network, in which one of the parties typically -# interacts with the outside world entirely through the other party. In such a connection between -# Alice and Bob, all objects that exist on Bob's other networks appear to Alice as if they were -# hosted by Bob himself, and similarly all objects on Alice's network (if she even has one) appear -# to Bob as if they were hosted by Alice. This network type is interesting because from the point -# of view of a simple application that communicates with only one other party via the two-party -# protocol, there are no three-party interactions at all, and joins are unusually simple to -# implement, so implementing at level 4 is barely more complicated than implementing at level 1. -# Moreover, if you pair an app implementing the two-party network with a container that implements -# some other network, the app can then participate on the container's network just as if it -# implemented that network directly. The types used by the two-party network are defined in -# `rpc-twoparty.capnp`. -# -# The things that we need to parameterize are: -# - How to store capabilities long-term without holding a connection open (mostly level 2). -# - How to authenticate vats in three-party introductions (level 3). -# - How to implement `Join` (level 4). -# -# Persistent references -# --------------------- -# -# **(mostly level 2)** -# -# We want to allow some capabilities to be stored long-term, even if a connection is lost and later -# recreated. ExportId is a short-term identifier that is specific to a connection, so it doesn't -# help here. We need a way to specify long-term identifiers, as well as a strategy for -# reconnecting to a referenced capability later. -# -# Three-party interactions -# ------------------------ -# -# **(level 3)** -# -# In cases where more than two vats are interacting, we have situations where VatA holds a -# capability hosted by VatB and wants to send that capability to VatC. This can be accomplished -# by VatA proxying requests on the new capability, but doing so has two big problems: -# - It's inefficient, requiring an extra network hop. -# - If VatC receives another capability to the same object from VatD, it is difficult for VatC to -# detect that the two capabilities are really the same and to implement the E "join" operation, -# which is necessary for certain four-or-more-party interactions, such as the escrow pattern. -# See: http://www.erights.org/elib/equality/grant-matcher/index.html -# -# Instead, we want a way for VatC to form a direct, authenticated connection to VatB. -# -# Join -# ---- -# -# **(level 4)** -# -# The `Join` message type and corresponding operation arranges for a direct connection to be formed -# between the joiner and the host of the joined object, and this connection must be authenticated. -# Thus, the details are network-dependent. - -using SturdyRef = AnyPointer; -# **(level 2)** -# -# Identifies a persisted capability that can be restored in the future. How exactly a SturdyRef -# is restored to a live object is specified along with the SturdyRef definition (i.e. not by -# rpc.capnp). -# -# Generally a SturdyRef needs to specify three things: -# - How to reach the vat that can restore the ref (e.g. a hostname or IP address). -# - How to authenticate the vat after connecting (e.g. a public key fingerprint). -# - The identity of a specific object hosted by the vat. Generally, this is an opaque pointer whose -# format is defined by the specific vat -- the client has no need to inspect the object ID. -# It is important that the objec ID be unguessable if the object is not public (and objects -# should almost never be public). -# -# The above are only suggestions. Some networks might work differently. For example, a private -# network might employ a special restorer service whose sole purpose is to restore SturdyRefs. -# In this case, the entire contents of SturdyRef might be opaque, because they are intended only -# to be forwarded to the restorer service. - -using ProvisionId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in an `Accept` message to identify the object being accepted. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the provider vat along with the question ID used in the `Provide` message sent from -# that provider. - -using RecipientId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in a `Provide` message to identify the recipient of the -# capability. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the recipient. (CapTP also calls for a nonce to identify the object. In our -# case, the `Provide` message's `questionId` can serve as the nonce.) - -using ThirdPartyCapId = AnyPointer; -# **(level 3)** -# -# The information needed to connect to a third party and accept a capability from it. -# -# In a network where each vat has a public/private key pair, this could be a combination of the -# third party's public key fingerprint, hints on how to connect to the third party (e.g. an IP -# address), and the question ID used in the corresponding `Provide` message sent to that third party -# (used to identify which capability to pick up). - -using JoinKeyPart = AnyPointer; -# **(level 4)** -# -# A piece of a secret key. One piece is sent along each path that is expected to lead to the same -# place. Once the pieces are combined, a direct connection may be formed between the sender and -# the receiver, bypassing any men-in-the-middle along the paths. See the `Join` message type. -# -# The motivation for Joins is discussed under "Supporting Equality" in the "Unibus" protocol -# sketch: http://www.erights.org/elib/distrib/captp/unibus.html -# -# In a network where each vat has a public/private key pair and each vat forms no more than one -# connection to each other vat, Joins will rarely -- perhaps never -- be needed, as objects never -# need to be transparently proxied and references to the same object sent over the same connection -# have the same export ID. Thus, a successful join requires only checking that the two objects -# come from the same connection and have the same ID, and then completes immediately. -# -# However, in networks where two vats may form more than one connection between each other, or -# where proxying of objects occurs, joins are necessary. -# -# Typically, each JoinKeyPart would include a fixed-length data value such that all value parts -# XOR'd together forms a shared secret that can be used to form an encrypted connection between -# the joiner and the joined object's host. Each JoinKeyPart should also include an indication of -# how many parts to expect and a hash of the shared secret (used to match up parts). - -using JoinResult = AnyPointer; -# **(level 4)** -# -# Information returned as the result to a `Join` message, needed by the joiner in order to form a -# direct connection to a joined object. This might simply be the address of the joined object's -# host vat, since the `JoinKey` has already been communicated so the two vats already have a shared -# secret to use to authenticate each other. -# -# The `JoinResult` should also contain information that can be used to detect when the Join -# requests ended up reaching different objects, so that this situation can be detected easily. -# This could be a simple matter of including a sequence number -- if the joiner receives two -# `JoinResult`s with sequence number 0, then they must have come from different objects and the -# whole join is a failure. - -# ======================================================================================== -# Network interface sketch -# -# The interfaces below are meant to be pseudo-code to illustrate how the details of a particular -# vat network might be abstracted away. They are written like Cap'n Proto interfaces, but in -# practice you'd probably define these interfaces manually in the target programming language. A -# Cap'n Proto RPC implementation should be able to use these interfaces without knowing the -# definitions of the various network-specific parameters defined above. - -# interface VatNetwork { -# # Represents a vat network, with the ability to connect to particular vats and receive -# # connections from vats. -# # -# # Note that methods returning a `Connection` may return a pre-existing `Connection`, and the -# # caller is expected to find and share state with existing users of the connection. -# -# # Level 0 features ----------------------------------------------- -# -# connect(vatId :VatId) :Connection; -# # Connect to the given vat. The transport should return a promise that does not -# # resolve until authentication has completed, but allows messages to be pipelined in before -# # that; the transport either queues these messages until authenticated, or sends them encrypted -# # such that only the authentic vat would be able to decrypt them. The latter approach avoids a -# # round trip for authentication. -# -# accept() :Connection; -# # Wait for the next incoming connection and return it. Only connections formed by -# # connect() are returned by this method. -# -# # Level 4 features ----------------------------------------------- -# -# newJoiner(count :UInt32) :NewJoinerResponse; -# # Prepare a new Join operation, which will eventually lead to forming a new direct connection -# # to the host of the joined capability. `count` is the number of capabilities to join. -# -# struct NewJoinerResponse { -# joinKeyParts :List(JoinKeyPart); -# # Key parts to send in Join messages to each capability. -# -# joiner :Joiner; -# # Used to establish the final connection. -# } -# -# interface Joiner { -# addJoinResult(result :JoinResult) :Void; -# # Add a JoinResult received in response to one of the `Join` messages. All `JoinResult`s -# # returned from all paths must be added before trying to connect. -# -# connect() :ConnectionAndProvisionId; -# # Try to form a connection to the joined capability's host, verifying that it has received -# # all of the JoinKeyParts. Once the connection is formed, the caller should send an `Accept` -# # message on it with the specified `ProvisionId` in order to receive the final capability. -# } -# -# acceptConnectionFromJoiner(parts :List(JoinKeyPart), paths :List(VatPath)) -# :ConnectionAndProvisionId; -# # Called on a joined capability's host to receive the connection from the joiner, once all -# # key parts have arrived. The caller should expect to receive an `Accept` message over the -# # connection with the given ProvisionId. -# } -# -# interface Connection { -# # Level 0 features ----------------------------------------------- -# -# send(message :Message) :Void; -# # Send the message. Returns successfully when the message (and all preceding messages) has -# # been acknowledged by the recipient. -# -# receive() :Message; -# # Receive the next message, and acknowledges receipt to the sender. Messages are received in -# # the order in which they are sent. -# -# # Level 3 features ----------------------------------------------- -# -# introduceTo(recipient :Connection) :IntroductionInfo; -# # Call before starting a three-way introduction, assuming a `Provide` message is to be sent on -# # this connection and a `ThirdPartyCapId` is to be sent to `recipient`. -# -# struct IntroductionInfo { -# sendToRecipient :ThirdPartyCapId; -# sendToTarget :RecipientId; -# } -# -# connectToIntroduced(capId :ThirdPartyCapId) :ConnectionAndProvisionId; -# # Given a ThirdPartyCapId received over this connection, connect to the third party. The -# # caller should then send an `Accept` message over the new connection. -# -# acceptIntroducedConnection(recipientId :RecipientId) :Connection; -# # Given a RecipientId received in a `Provide` message on this `Connection`, wait for the -# # recipient to connect, and return the connection formed. Usually, the first message received -# # on the new connection will be an `Accept` message. -# } -# -# struct ConnectionAndProvisionId { -# # **(level 3)** -# -# connection :Connection; -# # Connection on which to issue `Accept` message. -# -# provision :ProvisionId; -# # `ProvisionId` to send in the `Accept` message. -# } diff --git a/phonelibs/capnp-cpp/include/capnp/rpc.capnp.h b/phonelibs/capnp-cpp/include/capnp/rpc.capnp.h deleted file mode 100644 index 0a440397fc..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc.capnp.h +++ /dev/null @@ -1,4898 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc.capnp - -#ifndef CAPNP_INCLUDED_b312981b2552a250_ -#define CAPNP_INCLUDED_b312981b2552a250_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(91b79f1f808db032); -CAPNP_DECLARE_SCHEMA(e94ccf8031176ec4); -CAPNP_DECLARE_SCHEMA(836a53ce789d4cd4); -CAPNP_DECLARE_SCHEMA(dae8b0f61aab5f99); -CAPNP_DECLARE_SCHEMA(9e19b28d3db3573a); -CAPNP_DECLARE_SCHEMA(d37d2eb2c2f80e63); -CAPNP_DECLARE_SCHEMA(bbc29655fa89086e); -CAPNP_DECLARE_SCHEMA(ad1a6c0d7dd07497); -CAPNP_DECLARE_SCHEMA(f964368b0fbd3711); -CAPNP_DECLARE_SCHEMA(d562b4df655bdd4d); -CAPNP_DECLARE_SCHEMA(9c6a046bfbc1ac5a); -CAPNP_DECLARE_SCHEMA(d4c9b56290554016); -CAPNP_DECLARE_SCHEMA(fbe1980490e001af); -CAPNP_DECLARE_SCHEMA(95bc14545813fbc1); -CAPNP_DECLARE_SCHEMA(9a0e61223d96743b); -CAPNP_DECLARE_SCHEMA(8523ddc40b86b8b0); -CAPNP_DECLARE_SCHEMA(d800b1d6cd6f1ca0); -CAPNP_DECLARE_SCHEMA(f316944415569081); -CAPNP_DECLARE_SCHEMA(d37007fde1f0027d); -CAPNP_DECLARE_SCHEMA(d625b7063acf691a); -CAPNP_DECLARE_SCHEMA(b28c96e23f4cbd58); -enum class Type_b28c96e23f4cbd58: uint16_t { - FAILED, - OVERLOADED, - DISCONNECTED, - UNIMPLEMENTED, -}; -CAPNP_DECLARE_ENUM(Type, b28c96e23f4cbd58); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { - -struct Message { - Message() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNIMPLEMENTED, - ABORT, - CALL, - RETURN, - FINISH, - RESOLVE, - RELEASE, - OBSOLETE_SAVE, - BOOTSTRAP, - OBSOLETE_DELETE, - PROVIDE, - ACCEPT, - JOIN, - DISEMBARGO, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(91b79f1f808db032, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Bootstrap { - Bootstrap() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e94ccf8031176ec4, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - struct SendResultsTo; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(836a53ce789d4cd4, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call::SendResultsTo { - SendResultsTo() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CALLER, - YOURSELF, - THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(dae8b0f61aab5f99, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Return { - Return() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - RESULTS, - EXCEPTION, - CANCELED, - RESULTS_SENT_ELSEWHERE, - TAKE_FROM_OTHER_QUESTION, - ACCEPT_FROM_THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e19b28d3db3573a, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Finish { - Finish() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37d2eb2c2f80e63, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Resolve { - Resolve() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CAP, - EXCEPTION, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bbc29655fa89086e, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Release { - Release() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ad1a6c0d7dd07497, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo { - Disembargo() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Context; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f964368b0fbd3711, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo::Context { - Context() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SENDER_LOOPBACK, - RECEIVER_LOOPBACK, - ACCEPT, - PROVIDE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d562b4df655bdd4d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Provide { - Provide() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9c6a046bfbc1ac5a, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Accept { - Accept() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d4c9b56290554016, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Join { - Join() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(fbe1980490e001af, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct MessageTarget { - MessageTarget() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPORTED_CAP, - PROMISED_ANSWER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95bc14545813fbc1, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Payload { - Payload() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9a0e61223d96743b, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CapDescriptor { - CapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NONE, - SENDER_HOSTED, - SENDER_PROMISE, - RECEIVER_HOSTED, - RECEIVER_ANSWER, - THIRD_PARTY_HOSTED, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8523ddc40b86b8b0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer { - PromisedAnswer() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Op; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d800b1d6cd6f1ca0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer::Op { - Op() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NOOP, - GET_POINTER_FIELD, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f316944415569081, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapDescriptor { - ThirdPartyCapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37007fde1f0027d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Exception { - Exception() = delete; - - class Reader; - class Builder; - class Pipeline; - typedef ::capnp::schemas::Type_b28c96e23f4cbd58 Type; - - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d625b7063acf691a, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Message::Reader { -public: - typedef Message Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnimplemented() const; - inline bool hasUnimplemented() const; - inline ::capnp::rpc::Message::Reader getUnimplemented() const; - - inline bool isAbort() const; - inline bool hasAbort() const; - inline ::capnp::rpc::Exception::Reader getAbort() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::rpc::Call::Reader getCall() const; - - inline bool isReturn() const; - inline bool hasReturn() const; - inline ::capnp::rpc::Return::Reader getReturn() const; - - inline bool isFinish() const; - inline bool hasFinish() const; - inline ::capnp::rpc::Finish::Reader getFinish() const; - - inline bool isResolve() const; - inline bool hasResolve() const; - inline ::capnp::rpc::Resolve::Reader getResolve() const; - - inline bool isRelease() const; - inline bool hasRelease() const; - inline ::capnp::rpc::Release::Reader getRelease() const; - - inline bool isObsoleteSave() const; - inline bool hasObsoleteSave() const; - inline ::capnp::AnyPointer::Reader getObsoleteSave() const; - - inline bool isBootstrap() const; - inline bool hasBootstrap() const; - inline ::capnp::rpc::Bootstrap::Reader getBootstrap() const; - - inline bool isObsoleteDelete() const; - inline bool hasObsoleteDelete() const; - inline ::capnp::AnyPointer::Reader getObsoleteDelete() const; - - inline bool isProvide() const; - inline bool hasProvide() const; - inline ::capnp::rpc::Provide::Reader getProvide() const; - - inline bool isAccept() const; - inline bool hasAccept() const; - inline ::capnp::rpc::Accept::Reader getAccept() const; - - inline bool isJoin() const; - inline bool hasJoin() const; - inline ::capnp::rpc::Join::Reader getJoin() const; - - inline bool isDisembargo() const; - inline bool hasDisembargo() const; - inline ::capnp::rpc::Disembargo::Reader getDisembargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Message::Builder { -public: - typedef Message Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnimplemented(); - inline bool hasUnimplemented(); - inline ::capnp::rpc::Message::Builder getUnimplemented(); - inline void setUnimplemented( ::capnp::rpc::Message::Reader value); - inline ::capnp::rpc::Message::Builder initUnimplemented(); - inline void adoptUnimplemented(::capnp::Orphan< ::capnp::rpc::Message>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Message> disownUnimplemented(); - - inline bool isAbort(); - inline bool hasAbort(); - inline ::capnp::rpc::Exception::Builder getAbort(); - inline void setAbort( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initAbort(); - inline void adoptAbort(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownAbort(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::rpc::Call::Builder getCall(); - inline void setCall( ::capnp::rpc::Call::Reader value); - inline ::capnp::rpc::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::rpc::Call>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Call> disownCall(); - - inline bool isReturn(); - inline bool hasReturn(); - inline ::capnp::rpc::Return::Builder getReturn(); - inline void setReturn( ::capnp::rpc::Return::Reader value); - inline ::capnp::rpc::Return::Builder initReturn(); - inline void adoptReturn(::capnp::Orphan< ::capnp::rpc::Return>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Return> disownReturn(); - - inline bool isFinish(); - inline bool hasFinish(); - inline ::capnp::rpc::Finish::Builder getFinish(); - inline void setFinish( ::capnp::rpc::Finish::Reader value); - inline ::capnp::rpc::Finish::Builder initFinish(); - inline void adoptFinish(::capnp::Orphan< ::capnp::rpc::Finish>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Finish> disownFinish(); - - inline bool isResolve(); - inline bool hasResolve(); - inline ::capnp::rpc::Resolve::Builder getResolve(); - inline void setResolve( ::capnp::rpc::Resolve::Reader value); - inline ::capnp::rpc::Resolve::Builder initResolve(); - inline void adoptResolve(::capnp::Orphan< ::capnp::rpc::Resolve>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Resolve> disownResolve(); - - inline bool isRelease(); - inline bool hasRelease(); - inline ::capnp::rpc::Release::Builder getRelease(); - inline void setRelease( ::capnp::rpc::Release::Reader value); - inline ::capnp::rpc::Release::Builder initRelease(); - inline void adoptRelease(::capnp::Orphan< ::capnp::rpc::Release>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Release> disownRelease(); - - inline bool isObsoleteSave(); - inline bool hasObsoleteSave(); - inline ::capnp::AnyPointer::Builder getObsoleteSave(); - inline ::capnp::AnyPointer::Builder initObsoleteSave(); - - inline bool isBootstrap(); - inline bool hasBootstrap(); - inline ::capnp::rpc::Bootstrap::Builder getBootstrap(); - inline void setBootstrap( ::capnp::rpc::Bootstrap::Reader value); - inline ::capnp::rpc::Bootstrap::Builder initBootstrap(); - inline void adoptBootstrap(::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> disownBootstrap(); - - inline bool isObsoleteDelete(); - inline bool hasObsoleteDelete(); - inline ::capnp::AnyPointer::Builder getObsoleteDelete(); - inline ::capnp::AnyPointer::Builder initObsoleteDelete(); - - inline bool isProvide(); - inline bool hasProvide(); - inline ::capnp::rpc::Provide::Builder getProvide(); - inline void setProvide( ::capnp::rpc::Provide::Reader value); - inline ::capnp::rpc::Provide::Builder initProvide(); - inline void adoptProvide(::capnp::Orphan< ::capnp::rpc::Provide>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Provide> disownProvide(); - - inline bool isAccept(); - inline bool hasAccept(); - inline ::capnp::rpc::Accept::Builder getAccept(); - inline void setAccept( ::capnp::rpc::Accept::Reader value); - inline ::capnp::rpc::Accept::Builder initAccept(); - inline void adoptAccept(::capnp::Orphan< ::capnp::rpc::Accept>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Accept> disownAccept(); - - inline bool isJoin(); - inline bool hasJoin(); - inline ::capnp::rpc::Join::Builder getJoin(); - inline void setJoin( ::capnp::rpc::Join::Reader value); - inline ::capnp::rpc::Join::Builder initJoin(); - inline void adoptJoin(::capnp::Orphan< ::capnp::rpc::Join>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Join> disownJoin(); - - inline bool isDisembargo(); - inline bool hasDisembargo(); - inline ::capnp::rpc::Disembargo::Builder getDisembargo(); - inline void setDisembargo( ::capnp::rpc::Disembargo::Reader value); - inline ::capnp::rpc::Disembargo::Builder initDisembargo(); - inline void adoptDisembargo(::capnp::Orphan< ::capnp::rpc::Disembargo>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Disembargo> disownDisembargo(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Message::Pipeline { -public: - typedef Message Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Bootstrap::Reader { -public: - typedef Bootstrap Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasDeprecatedObjectId() const; - inline ::capnp::AnyPointer::Reader getDeprecatedObjectId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Bootstrap::Builder { -public: - typedef Bootstrap Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder getDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder initDeprecatedObjectId(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Bootstrap::Pipeline { -public: - typedef Bootstrap Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline ::uint64_t getInterfaceId() const; - - inline ::uint16_t getMethodId() const; - - inline bool hasParams() const; - inline ::capnp::rpc::Payload::Reader getParams() const; - - inline typename SendResultsTo::Reader getSendResultsTo() const; - - inline bool getAllowThirdPartyTailCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline ::uint64_t getInterfaceId(); - inline void setInterfaceId( ::uint64_t value); - - inline ::uint16_t getMethodId(); - inline void setMethodId( ::uint16_t value); - - inline bool hasParams(); - inline ::capnp::rpc::Payload::Builder getParams(); - inline void setParams( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initParams(); - inline void adoptParams(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownParams(); - - inline typename SendResultsTo::Builder getSendResultsTo(); - inline typename SendResultsTo::Builder initSendResultsTo(); - - inline bool getAllowThirdPartyTailCall(); - inline void setAllowThirdPartyTailCall(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline ::capnp::rpc::Payload::Pipeline getParams(); - inline typename SendResultsTo::Pipeline getSendResultsTo(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::SendResultsTo::Reader { -public: - typedef SendResultsTo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isCaller() const; - inline ::capnp::Void getCaller() const; - - inline bool isYourself() const; - inline ::capnp::Void getYourself() const; - - inline bool isThirdParty() const; - inline bool hasThirdParty() const; - inline ::capnp::AnyPointer::Reader getThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::SendResultsTo::Builder { -public: - typedef SendResultsTo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isCaller(); - inline ::capnp::Void getCaller(); - inline void setCaller( ::capnp::Void value = ::capnp::VOID); - - inline bool isYourself(); - inline ::capnp::Void getYourself(); - inline void setYourself( ::capnp::Void value = ::capnp::VOID); - - inline bool isThirdParty(); - inline bool hasThirdParty(); - inline ::capnp::AnyPointer::Builder getThirdParty(); - inline ::capnp::AnyPointer::Builder initThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::SendResultsTo::Pipeline { -public: - typedef SendResultsTo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Return::Reader { -public: - typedef Return Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getAnswerId() const; - - inline bool getReleaseParamCaps() const; - - inline bool isResults() const; - inline bool hasResults() const; - inline ::capnp::rpc::Payload::Reader getResults() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - - inline bool isCanceled() const; - inline ::capnp::Void getCanceled() const; - - inline bool isResultsSentElsewhere() const; - inline ::capnp::Void getResultsSentElsewhere() const; - - inline bool isTakeFromOtherQuestion() const; - inline ::uint32_t getTakeFromOtherQuestion() const; - - inline bool isAcceptFromThirdParty() const; - inline bool hasAcceptFromThirdParty() const; - inline ::capnp::AnyPointer::Reader getAcceptFromThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Return::Builder { -public: - typedef Return Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getAnswerId(); - inline void setAnswerId( ::uint32_t value); - - inline bool getReleaseParamCaps(); - inline void setReleaseParamCaps(bool value); - - inline bool isResults(); - inline bool hasResults(); - inline ::capnp::rpc::Payload::Builder getResults(); - inline void setResults( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initResults(); - inline void adoptResults(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownResults(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - - inline bool isCanceled(); - inline ::capnp::Void getCanceled(); - inline void setCanceled( ::capnp::Void value = ::capnp::VOID); - - inline bool isResultsSentElsewhere(); - inline ::capnp::Void getResultsSentElsewhere(); - inline void setResultsSentElsewhere( ::capnp::Void value = ::capnp::VOID); - - inline bool isTakeFromOtherQuestion(); - inline ::uint32_t getTakeFromOtherQuestion(); - inline void setTakeFromOtherQuestion( ::uint32_t value); - - inline bool isAcceptFromThirdParty(); - inline bool hasAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder getAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder initAcceptFromThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Return::Pipeline { -public: - typedef Return Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Finish::Reader { -public: - typedef Finish Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool getReleaseResultCaps() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Finish::Builder { -public: - typedef Finish Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool getReleaseResultCaps(); - inline void setReleaseResultCaps(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Finish::Pipeline { -public: - typedef Finish Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Resolve::Reader { -public: - typedef Resolve Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getPromiseId() const; - - inline bool isCap() const; - inline bool hasCap() const; - inline ::capnp::rpc::CapDescriptor::Reader getCap() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Resolve::Builder { -public: - typedef Resolve Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getPromiseId(); - inline void setPromiseId( ::uint32_t value); - - inline bool isCap(); - inline bool hasCap(); - inline ::capnp::rpc::CapDescriptor::Builder getCap(); - inline void setCap( ::capnp::rpc::CapDescriptor::Reader value); - inline ::capnp::rpc::CapDescriptor::Builder initCap(); - inline void adoptCap(::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> disownCap(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Resolve::Pipeline { -public: - typedef Resolve Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Release::Reader { -public: - typedef Release Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getId() const; - - inline ::uint32_t getReferenceCount() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Release::Builder { -public: - typedef Release Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getId(); - inline void setId( ::uint32_t value); - - inline ::uint32_t getReferenceCount(); - inline void setReferenceCount( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Release::Pipeline { -public: - typedef Release Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Reader { -public: - typedef Disembargo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline typename Context::Reader getContext() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Builder { -public: - typedef Disembargo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline typename Context::Builder getContext(); - inline typename Context::Builder initContext(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Pipeline { -public: - typedef Disembargo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline typename Context::Pipeline getContext(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Context::Reader { -public: - typedef Context Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isSenderLoopback() const; - inline ::uint32_t getSenderLoopback() const; - - inline bool isReceiverLoopback() const; - inline ::uint32_t getReceiverLoopback() const; - - inline bool isAccept() const; - inline ::capnp::Void getAccept() const; - - inline bool isProvide() const; - inline ::uint32_t getProvide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Context::Builder { -public: - typedef Context Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isSenderLoopback(); - inline ::uint32_t getSenderLoopback(); - inline void setSenderLoopback( ::uint32_t value); - - inline bool isReceiverLoopback(); - inline ::uint32_t getReceiverLoopback(); - inline void setReceiverLoopback( ::uint32_t value); - - inline bool isAccept(); - inline ::capnp::Void getAccept(); - inline void setAccept( ::capnp::Void value = ::capnp::VOID); - - inline bool isProvide(); - inline ::uint32_t getProvide(); - inline void setProvide( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Context::Pipeline { -public: - typedef Context Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Provide::Reader { -public: - typedef Provide Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasRecipient() const; - inline ::capnp::AnyPointer::Reader getRecipient() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Provide::Builder { -public: - typedef Provide Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasRecipient(); - inline ::capnp::AnyPointer::Builder getRecipient(); - inline ::capnp::AnyPointer::Builder initRecipient(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Provide::Pipeline { -public: - typedef Provide Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Accept::Reader { -public: - typedef Accept Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasProvision() const; - inline ::capnp::AnyPointer::Reader getProvision() const; - - inline bool getEmbargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Accept::Builder { -public: - typedef Accept Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasProvision(); - inline ::capnp::AnyPointer::Builder getProvision(); - inline ::capnp::AnyPointer::Builder initProvision(); - - inline bool getEmbargo(); - inline void setEmbargo(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Accept::Pipeline { -public: - typedef Accept Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Join::Reader { -public: - typedef Join Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasKeyPart() const; - inline ::capnp::AnyPointer::Reader getKeyPart() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Join::Builder { -public: - typedef Join Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasKeyPart(); - inline ::capnp::AnyPointer::Builder getKeyPart(); - inline ::capnp::AnyPointer::Builder initKeyPart(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Join::Pipeline { -public: - typedef Join Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class MessageTarget::Reader { -public: - typedef MessageTarget Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImportedCap() const; - inline ::uint32_t getImportedCap() const; - - inline bool isPromisedAnswer() const; - inline bool hasPromisedAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getPromisedAnswer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class MessageTarget::Builder { -public: - typedef MessageTarget Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImportedCap(); - inline ::uint32_t getImportedCap(); - inline void setImportedCap( ::uint32_t value); - - inline bool isPromisedAnswer(); - inline bool hasPromisedAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getPromisedAnswer(); - inline void setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initPromisedAnswer(); - inline void adoptPromisedAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownPromisedAnswer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class MessageTarget::Pipeline { -public: - typedef MessageTarget Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Payload::Reader { -public: - typedef Payload Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasContent() const; - inline ::capnp::AnyPointer::Reader getContent() const; - - inline bool hasCapTable() const; - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader getCapTable() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Payload::Builder { -public: - typedef Payload Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasContent(); - inline ::capnp::AnyPointer::Builder getContent(); - inline ::capnp::AnyPointer::Builder initContent(); - - inline bool hasCapTable(); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder getCapTable(); - inline void setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder initCapTable(unsigned int size); - inline void adoptCapTable(::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> disownCapTable(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Payload::Pipeline { -public: - typedef Payload Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapDescriptor::Reader { -public: - typedef CapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNone() const; - inline ::capnp::Void getNone() const; - - inline bool isSenderHosted() const; - inline ::uint32_t getSenderHosted() const; - - inline bool isSenderPromise() const; - inline ::uint32_t getSenderPromise() const; - - inline bool isReceiverHosted() const; - inline ::uint32_t getReceiverHosted() const; - - inline bool isReceiverAnswer() const; - inline bool hasReceiverAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getReceiverAnswer() const; - - inline bool isThirdPartyHosted() const; - inline bool hasThirdPartyHosted() const; - inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader getThirdPartyHosted() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapDescriptor::Builder { -public: - typedef CapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNone(); - inline ::capnp::Void getNone(); - inline void setNone( ::capnp::Void value = ::capnp::VOID); - - inline bool isSenderHosted(); - inline ::uint32_t getSenderHosted(); - inline void setSenderHosted( ::uint32_t value); - - inline bool isSenderPromise(); - inline ::uint32_t getSenderPromise(); - inline void setSenderPromise( ::uint32_t value); - - inline bool isReceiverHosted(); - inline ::uint32_t getReceiverHosted(); - inline void setReceiverHosted( ::uint32_t value); - - inline bool isReceiverAnswer(); - inline bool hasReceiverAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getReceiverAnswer(); - inline void setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initReceiverAnswer(); - inline void adoptReceiverAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownReceiverAnswer(); - - inline bool isThirdPartyHosted(); - inline bool hasThirdPartyHosted(); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder getThirdPartyHosted(); - inline void setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder initThirdPartyHosted(); - inline void adoptThirdPartyHosted(::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> disownThirdPartyHosted(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapDescriptor::Pipeline { -public: - typedef CapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Reader { -public: - typedef PromisedAnswer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTransform() const; - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader getTransform() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Builder { -public: - typedef PromisedAnswer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTransform(); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder getTransform(); - inline void setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder initTransform(unsigned int size); - inline void adoptTransform(::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> disownTransform(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Pipeline { -public: - typedef PromisedAnswer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Op::Reader { -public: - typedef Op Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNoop() const; - inline ::capnp::Void getNoop() const; - - inline bool isGetPointerField() const; - inline ::uint16_t getGetPointerField() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Op::Builder { -public: - typedef Op Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNoop(); - inline ::capnp::Void getNoop(); - inline void setNoop( ::capnp::Void value = ::capnp::VOID); - - inline bool isGetPointerField(); - inline ::uint16_t getGetPointerField(); - inline void setGetPointerField( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Op::Pipeline { -public: - typedef Op Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapDescriptor::Reader { -public: - typedef ThirdPartyCapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasId() const; - inline ::capnp::AnyPointer::Reader getId() const; - - inline ::uint32_t getVineId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapDescriptor::Builder { -public: - typedef ThirdPartyCapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasId(); - inline ::capnp::AnyPointer::Builder getId(); - inline ::capnp::AnyPointer::Builder initId(); - - inline ::uint32_t getVineId(); - inline void setVineId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapDescriptor::Pipeline { -public: - typedef ThirdPartyCapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Exception::Reader { -public: - typedef Exception Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasReason() const; - inline ::capnp::Text::Reader getReason() const; - - inline bool getObsoleteIsCallersFault() const; - - inline ::uint16_t getObsoleteDurability() const; - - inline ::capnp::rpc::Exception::Type getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Exception::Builder { -public: - typedef Exception Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasReason(); - inline ::capnp::Text::Builder getReason(); - inline void setReason( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initReason(unsigned int size); - inline void adoptReason(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownReason(); - - inline bool getObsoleteIsCallersFault(); - inline void setObsoleteIsCallersFault(bool value); - - inline ::uint16_t getObsoleteDurability(); - inline void setObsoleteDurability( ::uint16_t value); - - inline ::capnp::rpc::Exception::Type getType(); - inline void setType( ::capnp::rpc::Exception::Type value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Exception::Pipeline { -public: - typedef Exception Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::Message::Which Message::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Message::Which Message::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Message::Reader::isUnimplemented() const { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Builder::isUnimplemented() { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Reader::hasUnimplemented() const { - if (which() != Message::UNIMPLEMENTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasUnimplemented() { - if (which() != Message::UNIMPLEMENTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Message::Reader Message::Reader::getUnimplemented() const { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Message::Builder Message::Builder::getUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setUnimplemented( ::capnp::rpc::Message::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Message::Builder Message::Builder::initUnimplemented() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptUnimplemented( - ::capnp::Orphan< ::capnp::rpc::Message>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Message> Message::Builder::disownUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAbort() const { - return which() == Message::ABORT; -} -inline bool Message::Builder::isAbort() { - return which() == Message::ABORT; -} -inline bool Message::Reader::hasAbort() const { - if (which() != Message::ABORT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAbort() { - if (which() != Message::ABORT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Message::Reader::getAbort() const { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::getAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAbort( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::initAbort() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAbort( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Message::Builder::disownAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isCall() const { - return which() == Message::CALL; -} -inline bool Message::Builder::isCall() { - return which() == Message::CALL; -} -inline bool Message::Reader::hasCall() const { - if (which() != Message::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasCall() { - if (which() != Message::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Call::Reader Message::Reader::getCall() const { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Call::Builder Message::Builder::getCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setCall( ::capnp::rpc::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Call::Builder Message::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptCall( - ::capnp::Orphan< ::capnp::rpc::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Call> Message::Builder::disownCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isReturn() const { - return which() == Message::RETURN; -} -inline bool Message::Builder::isReturn() { - return which() == Message::RETURN; -} -inline bool Message::Reader::hasReturn() const { - if (which() != Message::RETURN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasReturn() { - if (which() != Message::RETURN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Return::Reader Message::Reader::getReturn() const { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Return::Builder Message::Builder::getReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setReturn( ::capnp::rpc::Return::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Return::Builder Message::Builder::initReturn() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptReturn( - ::capnp::Orphan< ::capnp::rpc::Return>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Return> Message::Builder::disownReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isFinish() const { - return which() == Message::FINISH; -} -inline bool Message::Builder::isFinish() { - return which() == Message::FINISH; -} -inline bool Message::Reader::hasFinish() const { - if (which() != Message::FINISH) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasFinish() { - if (which() != Message::FINISH) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Finish::Reader Message::Reader::getFinish() const { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::getFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setFinish( ::capnp::rpc::Finish::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::initFinish() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptFinish( - ::capnp::Orphan< ::capnp::rpc::Finish>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Finish> Message::Builder::disownFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isResolve() const { - return which() == Message::RESOLVE; -} -inline bool Message::Builder::isResolve() { - return which() == Message::RESOLVE; -} -inline bool Message::Reader::hasResolve() const { - if (which() != Message::RESOLVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasResolve() { - if (which() != Message::RESOLVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Resolve::Reader Message::Reader::getResolve() const { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::getResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setResolve( ::capnp::rpc::Resolve::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::initResolve() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptResolve( - ::capnp::Orphan< ::capnp::rpc::Resolve>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Resolve> Message::Builder::disownResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isRelease() const { - return which() == Message::RELEASE; -} -inline bool Message::Builder::isRelease() { - return which() == Message::RELEASE; -} -inline bool Message::Reader::hasRelease() const { - if (which() != Message::RELEASE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasRelease() { - if (which() != Message::RELEASE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Release::Reader Message::Reader::getRelease() const { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Release::Builder Message::Builder::getRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setRelease( ::capnp::rpc::Release::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Release::Builder Message::Builder::initRelease() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptRelease( - ::capnp::Orphan< ::capnp::rpc::Release>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Release> Message::Builder::disownRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteSave() const { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Builder::isObsoleteSave() { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Reader::hasObsoleteSave() const { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteSave() { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteSave() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteSave() { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteSave() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_SAVE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isBootstrap() const { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Builder::isBootstrap() { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Reader::hasBootstrap() const { - if (which() != Message::BOOTSTRAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasBootstrap() { - if (which() != Message::BOOTSTRAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Bootstrap::Reader Message::Reader::getBootstrap() const { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::getBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setBootstrap( ::capnp::rpc::Bootstrap::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::initBootstrap() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptBootstrap( - ::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> Message::Builder::disownBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteDelete() const { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Builder::isObsoleteDelete() { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Reader::hasObsoleteDelete() const { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteDelete() { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteDelete() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteDelete() { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteDelete() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_DELETE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isProvide() const { - return which() == Message::PROVIDE; -} -inline bool Message::Builder::isProvide() { - return which() == Message::PROVIDE; -} -inline bool Message::Reader::hasProvide() const { - if (which() != Message::PROVIDE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasProvide() { - if (which() != Message::PROVIDE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Provide::Reader Message::Reader::getProvide() const { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::getProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setProvide( ::capnp::rpc::Provide::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::initProvide() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptProvide( - ::capnp::Orphan< ::capnp::rpc::Provide>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Provide> Message::Builder::disownProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAccept() const { - return which() == Message::ACCEPT; -} -inline bool Message::Builder::isAccept() { - return which() == Message::ACCEPT; -} -inline bool Message::Reader::hasAccept() const { - if (which() != Message::ACCEPT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAccept() { - if (which() != Message::ACCEPT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Accept::Reader Message::Reader::getAccept() const { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::getAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAccept( ::capnp::rpc::Accept::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::initAccept() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAccept( - ::capnp::Orphan< ::capnp::rpc::Accept>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Accept> Message::Builder::disownAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isJoin() const { - return which() == Message::JOIN; -} -inline bool Message::Builder::isJoin() { - return which() == Message::JOIN; -} -inline bool Message::Reader::hasJoin() const { - if (which() != Message::JOIN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasJoin() { - if (which() != Message::JOIN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Join::Reader Message::Reader::getJoin() const { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Join::Builder Message::Builder::getJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setJoin( ::capnp::rpc::Join::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Join::Builder Message::Builder::initJoin() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptJoin( - ::capnp::Orphan< ::capnp::rpc::Join>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Join> Message::Builder::disownJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isDisembargo() const { - return which() == Message::DISEMBARGO; -} -inline bool Message::Builder::isDisembargo() { - return which() == Message::DISEMBARGO; -} -inline bool Message::Reader::hasDisembargo() const { - if (which() != Message::DISEMBARGO) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasDisembargo() { - if (which() != Message::DISEMBARGO) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Disembargo::Reader Message::Reader::getDisembargo() const { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::getDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setDisembargo( ::capnp::rpc::Disembargo::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::initDisembargo() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptDisembargo( - ::capnp::Orphan< ::capnp::rpc::Disembargo>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Disembargo> Message::Builder::disownDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Bootstrap::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Bootstrap::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Bootstrap::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Bootstrap::Reader::hasDeprecatedObjectId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Bootstrap::Builder::hasDeprecatedObjectId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Bootstrap::Reader::getDeprecatedObjectId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::getDeprecatedObjectId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::initDeprecatedObjectId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Call::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Call::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Call::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Call::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Call::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Call::Reader::getInterfaceId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Call::Builder::getInterfaceId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setInterfaceId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Call::Reader::getMethodId() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Call::Builder::getMethodId() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setMethodId( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::Payload::Pipeline Call::Pipeline::getParams() { - return ::capnp::rpc::Payload::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setParams( ::capnp::rpc::Payload::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::initParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline typename Call::SendResultsTo::Reader Call::Reader::getSendResultsTo() const { - return typename Call::SendResultsTo::Reader(_reader); -} -inline typename Call::SendResultsTo::Builder Call::Builder::getSendResultsTo() { - return typename Call::SendResultsTo::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Call::SendResultsTo::Pipeline Call::Pipeline::getSendResultsTo() { - return typename Call::SendResultsTo::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Call::SendResultsTo::Builder Call::Builder::initSendResultsTo() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<3>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - return typename Call::SendResultsTo::Builder(_builder); -} -inline bool Call::Reader::getAllowThirdPartyTailCall() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Call::Builder::getAllowThirdPartyTailCall() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setAllowThirdPartyTailCall(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline bool Call::SendResultsTo::Reader::isCaller() const { - return which() == Call::SendResultsTo::CALLER; -} -inline bool Call::SendResultsTo::Builder::isCaller() { - return which() == Call::SendResultsTo::CALLER; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getCaller() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getCaller() { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setCaller( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::CALLER); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isYourself() const { - return which() == Call::SendResultsTo::YOURSELF; -} -inline bool Call::SendResultsTo::Builder::isYourself() { - return which() == Call::SendResultsTo::YOURSELF; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getYourself() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getYourself() { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setYourself( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::YOURSELF); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isThirdParty() const { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Builder::isThirdParty() { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Reader::hasThirdParty() const { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::SendResultsTo::Builder::hasThirdParty() { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Call::SendResultsTo::Reader::getThirdParty() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::getThirdParty() { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::initThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::Return::Which Return::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Return::Which Return::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Reader::getAnswerId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getAnswerId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setAnswerId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::getReleaseParamCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Return::Builder::getReleaseParamCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Return::Builder::setReleaseParamCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline bool Return::Reader::isResults() const { - return which() == Return::RESULTS; -} -inline bool Return::Builder::isResults() { - return which() == Return::RESULTS; -} -inline bool Return::Reader::hasResults() const { - if (which() != Return::RESULTS) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasResults() { - if (which() != Return::RESULTS) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Return::Reader::getResults() const { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::getResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setResults( ::capnp::rpc::Payload::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::initResults() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptResults( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Return::Builder::disownResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isException() const { - return which() == Return::EXCEPTION; -} -inline bool Return::Builder::isException() { - return which() == Return::EXCEPTION; -} -inline bool Return::Reader::hasException() const { - if (which() != Return::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasException() { - if (which() != Return::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Return::Reader::getException() const { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::getException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Return::Builder::disownException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isCanceled() const { - return which() == Return::CANCELED; -} -inline bool Return::Builder::isCanceled() { - return which() == Return::CANCELED; -} -inline ::capnp::Void Return::Reader::getCanceled() const { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getCanceled() { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setCanceled( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::CANCELED); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isResultsSentElsewhere() const { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline bool Return::Builder::isResultsSentElsewhere() { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline ::capnp::Void Return::Reader::getResultsSentElsewhere() const { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getResultsSentElsewhere() { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setResultsSentElsewhere( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS_SENT_ELSEWHERE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isTakeFromOtherQuestion() const { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline bool Return::Builder::isTakeFromOtherQuestion() { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline ::uint32_t Return::Reader::getTakeFromOtherQuestion() const { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getTakeFromOtherQuestion() { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setTakeFromOtherQuestion( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::TAKE_FROM_OTHER_QUESTION); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isAcceptFromThirdParty() const { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Builder::isAcceptFromThirdParty() { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Reader::hasAcceptFromThirdParty() const { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasAcceptFromThirdParty() { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Return::Reader::getAcceptFromThirdParty() const { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::getAcceptFromThirdParty() { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::initAcceptFromThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::ACCEPT_FROM_THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Finish::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Finish::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Finish::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Finish::Reader::getReleaseResultCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Finish::Builder::getReleaseResultCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Finish::Builder::setReleaseResultCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline ::capnp::rpc::Resolve::Which Resolve::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Resolve::Which Resolve::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Reader::getPromiseId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Builder::getPromiseId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Resolve::Builder::setPromiseId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Resolve::Reader::isCap() const { - return which() == Resolve::CAP; -} -inline bool Resolve::Builder::isCap() { - return which() == Resolve::CAP; -} -inline bool Resolve::Reader::hasCap() const { - if (which() != Resolve::CAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasCap() { - if (which() != Resolve::CAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::CapDescriptor::Reader Resolve::Reader::getCap() const { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::getCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setCap( ::capnp::rpc::CapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::initCap() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptCap( - ::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> Resolve::Builder::disownCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Resolve::Reader::isException() const { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Builder::isException() { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Reader::hasException() const { - if (which() != Resolve::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasException() { - if (which() != Resolve::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Resolve::Reader::getException() const { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::getException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Resolve::Builder::disownException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Release::Reader::getId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Release::Reader::getReferenceCount() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getReferenceCount() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setReferenceCount( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Disembargo::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Disembargo::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Disembargo::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Disembargo::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Disembargo::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Disembargo::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline typename Disembargo::Context::Reader Disembargo::Reader::getContext() const { - return typename Disembargo::Context::Reader(_reader); -} -inline typename Disembargo::Context::Builder Disembargo::Builder::getContext() { - return typename Disembargo::Context::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Disembargo::Context::Pipeline Disembargo::Pipeline::getContext() { - return typename Disembargo::Context::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Disembargo::Context::Builder Disembargo::Builder::initContext() { - _builder.setDataField< ::uint32_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Disembargo::Context::Builder(_builder); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool Disembargo::Context::Reader::isSenderLoopback() const { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isSenderLoopback() { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getSenderLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getSenderLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setSenderLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::SENDER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isReceiverLoopback() const { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isReceiverLoopback() { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getReceiverLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getReceiverLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setReceiverLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::RECEIVER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isAccept() const { - return which() == Disembargo::Context::ACCEPT; -} -inline bool Disembargo::Context::Builder::isAccept() { - return which() == Disembargo::Context::ACCEPT; -} -inline ::capnp::Void Disembargo::Context::Reader::getAccept() const { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Disembargo::Context::Builder::getAccept() { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setAccept( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::ACCEPT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isProvide() const { - return which() == Disembargo::Context::PROVIDE; -} -inline bool Disembargo::Context::Builder::isProvide() { - return which() == Disembargo::Context::PROVIDE; -} -inline ::uint32_t Disembargo::Context::Reader::getProvide() const { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getProvide() { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setProvide( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::PROVIDE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Provide::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Provide::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Provide::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Provide::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Provide::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Provide::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Provide::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Provide::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Provide::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Provide::Reader::hasRecipient() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasRecipient() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Provide::Reader::getRecipient() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::getRecipient() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::initRecipient() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Accept::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Accept::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Accept::Reader::hasProvision() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Accept::Builder::hasProvision() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Accept::Reader::getProvision() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::getProvision() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::initProvision() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Accept::Reader::getEmbargo() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool Accept::Builder::getEmbargo() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setEmbargo(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Join::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Join::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Join::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Join::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Join::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Join::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Join::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Join::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Join::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Join::Reader::hasKeyPart() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasKeyPart() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Join::Reader::getKeyPart() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::getKeyPart() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::initKeyPart() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool MessageTarget::Reader::isImportedCap() const { - return which() == MessageTarget::IMPORTED_CAP; -} -inline bool MessageTarget::Builder::isImportedCap() { - return which() == MessageTarget::IMPORTED_CAP; -} -inline ::uint32_t MessageTarget::Reader::getImportedCap() const { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t MessageTarget::Builder::getImportedCap() { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void MessageTarget::Builder::setImportedCap( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::IMPORTED_CAP); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool MessageTarget::Reader::isPromisedAnswer() const { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Builder::isPromisedAnswer() { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Reader::hasPromisedAnswer() const { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool MessageTarget::Builder::hasPromisedAnswer() { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader MessageTarget::Reader::getPromisedAnswer() const { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::getPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::initPromisedAnswer() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::adoptPromisedAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> MessageTarget::Builder::disownPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Payload::Reader::hasContent() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasContent() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Payload::Reader::getContent() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::getContent() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::initContent() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Payload::Reader::hasCapTable() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasCapTable() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader Payload::Reader::getCapTable() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::getCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Payload::Builder::setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::initCapTable(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Payload::Builder::adoptCapTable( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> Payload::Builder::disownCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool CapDescriptor::Reader::isNone() const { - return which() == CapDescriptor::NONE; -} -inline bool CapDescriptor::Builder::isNone() { - return which() == CapDescriptor::NONE; -} -inline ::capnp::Void CapDescriptor::Reader::getNone() const { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void CapDescriptor::Builder::getNone() { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setNone( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::NONE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderHosted() const { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline bool CapDescriptor::Builder::isSenderHosted() { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getSenderHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderHosted() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderPromise() const { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline bool CapDescriptor::Builder::isSenderPromise() { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline ::uint32_t CapDescriptor::Reader::getSenderPromise() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderPromise() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderPromise( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_PROMISE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverHosted() const { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline bool CapDescriptor::Builder::isReceiverHosted() { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getReceiverHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getReceiverHosted() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setReceiverHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverAnswer() const { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Builder::isReceiverAnswer() { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Reader::hasReceiverAnswer() const { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasReceiverAnswer() { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader CapDescriptor::Reader::getReceiverAnswer() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::getReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::initReceiverAnswer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptReceiverAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> CapDescriptor::Builder::disownReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CapDescriptor::Reader::isThirdPartyHosted() const { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Builder::isThirdPartyHosted() { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Reader::hasThirdPartyHosted() const { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasThirdPartyHosted() { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader CapDescriptor::Reader::getThirdPartyHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::getThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::initThirdPartyHosted() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptThirdPartyHosted( - ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> CapDescriptor::Builder::disownThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t PromisedAnswer::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t PromisedAnswer::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Reader::hasTransform() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool PromisedAnswer::Builder::hasTransform() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader PromisedAnswer::Reader::getTransform() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::getTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void PromisedAnswer::Builder::setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::initTransform(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void PromisedAnswer::Builder::adoptTransform( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> PromisedAnswer::Builder::disownTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool PromisedAnswer::Op::Reader::isNoop() const { - return which() == PromisedAnswer::Op::NOOP; -} -inline bool PromisedAnswer::Op::Builder::isNoop() { - return which() == PromisedAnswer::Op::NOOP; -} -inline ::capnp::Void PromisedAnswer::Op::Reader::getNoop() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void PromisedAnswer::Op::Builder::getNoop() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setNoop( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::NOOP); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Op::Reader::isGetPointerField() const { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline bool PromisedAnswer::Op::Builder::isGetPointerField() { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline ::uint16_t PromisedAnswer::Op::Reader::getGetPointerField() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t PromisedAnswer::Op::Builder::getGetPointerField() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setGetPointerField( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::GET_POINTER_FIELD); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool ThirdPartyCapDescriptor::Reader::hasId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool ThirdPartyCapDescriptor::Builder::hasId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader ThirdPartyCapDescriptor::Reader::getId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::getId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::initId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t ThirdPartyCapDescriptor::Reader::getVineId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ThirdPartyCapDescriptor::Builder::getVineId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ThirdPartyCapDescriptor::Builder::setVineId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Exception::Reader::hasReason() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Exception::Builder::hasReason() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Exception::Reader::getReason() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Exception::Builder::getReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Exception::Builder::setReason( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Exception::Builder::initReason(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Exception::Builder::adoptReason( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Exception::Builder::disownReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Exception::Reader::getObsoleteIsCallersFault() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Exception::Builder::getObsoleteIsCallersFault() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteIsCallersFault(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Exception::Reader::getObsoleteDurability() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Exception::Builder::getObsoleteDurability() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteDurability( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Exception::Type Exception::Reader::getType() const { - return _reader.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::Exception::Type Exception::Builder::getType() { - return _builder.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setType( ::capnp::rpc::Exception::Type value) { - _builder.setDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_b312981b2552a250_ diff --git a/phonelibs/capnp-cpp/include/capnp/rpc.h b/phonelibs/capnp-cpp/include/capnp/rpc.h deleted file mode 100644 index d84ed982e7..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/rpc.h +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_H_ -#define CAPNP_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "rpc-prelude.h" - -namespace capnp { - -template -class VatNetwork; -template -class SturdyRefRestorer; - -template -class BootstrapFactory: public _::BootstrapFactoryBase { - // Interface that constructs per-client bootstrap interfaces. Use this if you want each client - // who connects to see a different bootstrap interface based on their (authenticated) VatId. - // This allows an application to bootstrap off of the authentication performed at the VatNetwork - // level. (Typically VatId is some sort of public key.) - // - // This is only useful for multi-party networks. For TwoPartyVatNetwork, there's no reason to - // use a BootstrapFactory; just specify a single bootstrap capability in this case. - -public: - virtual Capability::Client createFor(typename VatId::Reader clientId) = 0; - // Create a bootstrap capability appropriate for exposing to the given client. VatNetwork will - // have authenticated the client VatId before this is called. - -private: - Capability::Client baseCreateFor(AnyStruct::Reader clientId) override; -}; - -template -class RpcSystem: public _::RpcSystemBase { - // Represents the RPC system, which is the portal to objects available on the network. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // See `makeRpcServer()` and `makeRpcClient()` below for convenient syntax for setting up an - // `RpcSystem` given a `VatNetwork`. - // - // See `ez-rpc.h` for an even simpler interface for setting up RPC in a typical two-party - // client/server scenario. - -public: - template - RpcSystem( - VatNetwork& network, - kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer); - - RpcSystem(RpcSystem&& other) = default; - - Capability::Client bootstrap(typename VatId::Reader vatId); - // Connect to the given vat and return its bootstrap interface. - - Capability::Client restore(typename VatId::Reader hostId, AnyPointer::Reader objectId) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); - // ** DEPRECATED ** - // - // Restores the given SturdyRef from the network and return the capability representing it. - // - // `hostId` identifies the host from which to request the ref, in the format specified by the - // `VatNetwork` in use. `objectId` is the object ID in whatever format is expected by said host. - // - // This method will be removed in a future version of Cap'n Proto. Instead, please transition - // to using bootstrap(), which is equivalent to calling restore() with a null `objectId`. - // You may emulate the old concept of object IDs by exporting a bootstrap interface which has - // methods that can be used to obtain other capabilities by ID. - - void setFlowLimit(size_t words); - // Sets the incoming call flow limit. If more than `words` worth of call messages have not yet - // received responses, the RpcSystem will not read further messages from the stream. This can be - // used as a crude way to prevent a resource exhaustion attack (or bug) in which a peer makes an - // excessive number of simultaneous calls that consume the receiver's RAM. - // - // There are some caveats. When over the flow limit, all messages are blocked, including returns. - // If the outstanding calls are themselves waiting on calls going in the opposite direction, the - // flow limit may prevent those calls from completing, leading to deadlock. However, a - // sufficiently high limit should make this unlikely. - // - // Note that a call's parameter size counts against the flow limit until the call returns, even - // if the recipient calls releaseParams() to free the parameter memory early. This is because - // releaseParams() may simply indicate that the parameters have been forwarded to another - // machine, but are still in-memory there. For illustration, say that Alice made a call to Bob - // who forwarded the call to Carol. Bob has imposed a flow limit on Alice. Alice's calls are - // being forwarded to Carol, so Bob never keeps the parameters in-memory for more than a brief - // period. However, the flow limit counts all calls that haven't returned, even if Bob has - // already freed the memory they consumed. You might argue that the right solution here is - // instead for Carol to impose her own flow limit on Bob. This has a serious problem, though: - // Bob might be forwarding requests to Carol on behalf of many different parties, not just Alice. - // If Alice can pump enough data to hit the Bob -> Carol flow limit, then those other parties - // will be disrupted. Thus, we can only really impose the limit on the Alice -> Bob link, which - // only affects Alice. We need that one flow limit to limit Alice's impact on the whole system, - // so it has to count all in-flight calls. - // - // In Sandstorm, flow limits are imposed by the supervisor on calls coming out of a grain, in - // order to prevent a grain from inundating the system with in-flight calls. In practice, the - // main time this happens is when a grain is pushing a large file download and doesn't implement - // proper cooperative flow control. -}; - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface); -// Make an RPC server. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// MyMainInterface::Client bootstrap = makeMain(); -// auto server = makeRpcServer(network, bootstrap); -// kj::NEVER_DONE.wait(waitScope); // run forever -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway); -// Make an RPC server for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface and communicates with a different realm than the application is in via a -// RealmGateway. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); -// ** DEPRECATED ** -// -// Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object -// can be used to look up objects by ID. -// -// Please transition to exporting only one interface, which is known as the "bootstrap" interface. -// For backwards-compatibility with old clients, continue to implement SturdyRefRestorer, but -// return the new bootstrap interface when the request object ID is null. When new clients connect -// and request the bootstrap interface, they will get that interface. Eventually, once all clients -// are updated to request only the bootstrap interface, stop implementing SturdyRefRestorer and -// switch to passing the bootstrap capability itself as the second parameter to `makeRpcServer()`. - -template -RpcSystem makeRpcClient( - VatNetwork& network); -// Make an RPC client. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// auto client = makeRpcClient(network); -// MyCapability::Client cap = client.restore(hostId, objId).castAs(); -// auto response = cap.fooRequest().send().wait(waitScope); -// handleMyResponse(response); -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway); -// Make an RPC client for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -class SturdyRefRestorer: public _::SturdyRefRestorerBase { - // ** DEPRECATED ** - // - // In Cap'n Proto 0.4.x, applications could export multiple main interfaces identified by - // object IDs. The callback used to map object IDs to objects was `SturdyRefRestorer`, as we - // imagined this would eventually be used for restoring SturdyRefs as well. In practice, it was - // never used for real SturdyRefs, only for exporting singleton objects under well-known names. - // - // The new preferred strategy is to export only a _single_ such interface, called the - // "bootstrap interface". That interface can itself have methods for obtaining other objects, of - // course, but that is up to the app. `SturdyRefRestorer` exists for backwards-compatibility. - // - // Hint: Use SturdyRefRestorer to define a server that exports services under - // string names. - -public: - virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) - KJ_DEPRECATED( - "Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0; - // Restore the given object, returning a capability representing it. - -private: - Capability::Client baseRestore(AnyPointer::Reader ref) override final; -}; - -// ======================================================================================= -// VatNetwork - -class OutgoingRpcMessage { - // A message to be sent by a `VatNetwork`. - -public: - virtual AnyPointer::Builder getBody() = 0; - // Get the message body, which the caller may fill in any way it wants. (The standard RPC - // implementation initializes it as a Message as defined in rpc.capnp.) - - virtual void send() = 0; - // Send the message, or at least put it in a queue to be sent later. Note that the builder - // returned by `getBody()` remains valid at least until the `OutgoingRpcMessage` is destroyed. -}; - -class IncomingRpcMessage { - // A message received from a `VatNetwork`. - -public: - virtual AnyPointer::Reader getBody() = 0; - // Get the message body, to be interpreted by the caller. (The standard RPC implementation - // interprets it as a Message as defined in rpc.capnp.) -}; - -template -class VatNetwork: public _::VatNetworkBase { - // Cap'n Proto RPC operates between vats, where a "vat" is some sort of host of objects. - // Typically one Cap'n Proto process (in the Unix sense) is one vat. The RPC system is what - // allows calls between objects hosted in different vats. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // The most common implementation of VatNetwork is TwoPartyVatNetwork (rpc-twoparty.h). Most - // simple client-server apps will want to use it. (You may even want to use the EZ RPC - // interfaces in `ez-rpc.h` and avoid all of this.) - // - // TODO(someday): Provide a standard implementation for the public internet. - -public: - class Connection; - - struct ConnectionAndProvisionId { - // Result of connecting to a vat introduced by another vat. - - kj::Own connection; - // Connection to the new vat. - - kj::Own firstMessage; - // An already-allocated `OutgoingRpcMessage` associated with `connection`. The RPC system will - // construct this as an `Accept` message and send it. - - Orphan provisionId; - // A `ProvisionId` already allocated inside `firstMessage`, which the RPC system will use to - // build the `Accept` message. - }; - - class Connection: public _::VatNetworkBase::Connection { - // A two-way RPC connection. - // - // This object may represent a connection that doesn't exist yet, but is expected to exist - // in the future. In this case, sent messages will automatically be queued and sent once the - // connection is ready, so that the caller doesn't need to know the difference. - - public: - // Level 0 features ---------------------------------------------- - - virtual typename VatId::Reader getPeerVatId() = 0; - // Returns the connected vat's authenticated VatId. It is the VatNetwork's responsibility to - // authenticate this, so that the caller can be assured that they are really talking to the - // identified vat and not an imposter. - - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) override = 0; - // Allocate a new message to be sent on this connection. - // - // If `firstSegmentWordSize` is non-zero, it should be treated as a hint suggesting how large - // to make the first segment. This is entirely a hint and the connection may adjust it up or - // down. If it is zero, the connection should choose the size itself. - - virtual kj::Promise>> receiveIncomingMessage() override = 0; - // Wait for a message to be received and return it. If the read stream cleanly terminates, - // return null. If any other problem occurs, throw an exception. - - virtual kj::Promise shutdown() override KJ_WARN_UNUSED_RESULT = 0; - // Waits until all outgoing messages have been sent, then shuts down the outgoing stream. The - // returned promise resolves after shutdown is complete. - - private: - AnyStruct::Reader baseGetPeerVatId() override; - }; - - // Level 0 features ------------------------------------------------ - - virtual kj::Maybe> connect(typename VatId::Reader hostId) = 0; - // Connect to a VatId. Note that this method immediately returns a `Connection`, even - // if the network connection has not yet been established. Messages can be queued to this - // connection and will be delivered once it is open. The caller must attempt to read from the - // connection to verify that it actually succeeded; the read will fail if the connection - // couldn't be opened. Some network implementations may actually start sending messages before - // hearing back from the server at all, to avoid a round trip. - // - // Returns nullptr if `hostId` refers to the local host. - - virtual kj::Promise> accept() = 0; - // Wait for the next incoming connection and return it. - - // Level 4 features ------------------------------------------------ - // TODO(someday) - -private: - kj::Maybe> - baseConnect(AnyStruct::Reader hostId) override final; - kj::Promise> baseAccept() override final; -}; - -// ======================================================================================= -// *************************************************************************************** -// Inline implementation details start here -// *************************************************************************************** -// ======================================================================================= - -template -Capability::Client BootstrapFactory::baseCreateFor(AnyStruct::Reader clientId) { - return createFor(clientId.as()); -} - -template -kj::Maybe> - VatNetwork:: - baseConnect(AnyStruct::Reader ref) { - auto maybe = connect(ref.as()); - return maybe.map([](kj::Own& conn) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(conn); - }); -} - -template -kj::Promise> - VatNetwork::baseAccept() { - return accept().then( - [](kj::Own&& connection) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(connection); - }); -} - -template -AnyStruct::Reader VatNetwork< - SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>:: - Connection::baseGetPeerVatId() { - return getPeerVatId(); -} - -template -Capability::Client SturdyRefRestorer::baseRestore(AnyPointer::Reader ref) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return restore(ref.getAs()); -#pragma GCC diagnostic pop -} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - kj::Maybe bootstrap, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, kj::mv(bootstrap), kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, bootstrapFactory, kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer) - : _::RpcSystemBase(network, restorer) {} - -template -Capability::Client RpcSystem::bootstrap(typename VatId::Reader vatId) { - return baseBootstrap(_::PointerHelpers::getInternalReader(vatId)); -} - -template -Capability::Client RpcSystem::restore( - typename VatId::Reader hostId, AnyPointer::Reader objectId) { - return baseRestore(_::PointerHelpers::getInternalReader(hostId), objectId); -} - -template -inline void RpcSystem::setFlowLimit(size_t words) { - baseSetFlowLimit(words); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface) { - return RpcSystem(network, kj::mv(bootstrapInterface)); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway) { - return RpcSystem(network, kj::mv(bootstrapInterface), - gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory) { - return RpcSystem(network, bootstrapFactory); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway) { - return RpcSystem(network, bootstrapFactory, gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) { - return RpcSystem(network, restorer); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network) { - return RpcSystem(network, nullptr); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway) { - return RpcSystem(network, nullptr, gateway.template castAs>()); -} - -} // namespace capnp - -#endif // CAPNP_RPC_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/schema-lite.h b/phonelibs/capnp-cpp/include/capnp/schema-lite.h deleted file mode 100644 index 58a8c14c05..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema-lite.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LITE_H_ -#define CAPNP_SCHEMA_LITE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -template -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(CapnpPrivate::encodedSchema()); -} - -template ::typeId> -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(schemas::EnumInfo::encodedSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LITE_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/schema-loader.h b/phonelibs/capnp-cpp/include/capnp/schema-loader.h deleted file mode 100644 index 0e34cba77f..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema-loader.h +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LOADER_H_ -#define CAPNP_SCHEMA_LOADER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include -#include - -namespace capnp { - -class SchemaLoader { - // Class which can be used to construct Schema objects from schema::Nodes as defined in - // schema.capnp. - // - // It is a bad idea to use this class on untrusted input with exceptions disabled -- you may - // be exposing yourself to denial-of-service attacks, as attackers can easily construct schemas - // that are subtly inconsistent in a way that causes exceptions to be thrown either by - // SchemaLoader or by the dynamic API when the schemas are subsequently used. If you enable and - // properly catch exceptions, you should be OK -- assuming no bugs in the Cap'n Proto - // implementation, of course. - -public: - class LazyLoadCallback { - public: - virtual void load(const SchemaLoader& loader, uint64_t id) const = 0; - // Request that the schema node with the given ID be loaded into the given SchemaLoader. If - // the callback is able to find a schema for this ID, it should invoke `loadOnce()` on - // `loader` to load it. If no such node exists, it should simply do nothing and return. - // - // The callback is allowed to load schema nodes other than the one requested, e.g. because it - // expects they will be needed soon. - // - // If the `SchemaLoader` is used from multiple threads, the callback must be thread-safe. - // In particular, it's possible for multiple threads to invoke `load()` with the same ID. - // If the callback performs a large amount of work to look up IDs, it should be sure to - // de-dup these requests. - }; - - SchemaLoader(); - - SchemaLoader(const LazyLoadCallback& callback); - // Construct a SchemaLoader which will invoke the given callback when a schema node is requested - // that isn't already loaded. - - ~SchemaLoader() noexcept(false); - KJ_DISALLOW_COPY(SchemaLoader); - - Schema get(uint64_t id, schema::Brand::Reader brand = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Gets the schema for the given ID, throwing an exception if it isn't present. - // - // The returned schema may be invalidated if load() is called with a new schema for the same ID. - // In general, you should not call load() while a schema from this loader is in-use. - // - // `brand` and `scope` are used to determine brand bindings where relevant. `brand` gives - // parameter bindings for the target type's brand parameters that were specified at the reference - // site. `scope` specifies the scope in which the type ID appeared -- if `brand` itself contains - // parameter references or indicates that some parameters will be inherited, these will be - // interpreted within / inherited from `scope`. - - kj::Maybe tryGet(uint64_t id, schema::Brand::Reader bindings = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Like get() but doesn't throw. - - Schema getUnbound(uint64_t id) const; - // Gets a special version of the schema in which all brand parameters are "unbound". This means - // that if you look up a type via the Schema API, and it resolves to a brand parameter, the - // returned Type's getBrandParameter() method will return info about that parameter. Otherwise, - // normally, all brand parameters that aren't otherwise bound are assumed to simply be - // "AnyPointer". - - Type getType(schema::Type::Reader type, Schema scope = Schema()) const; - // Convenience method which interprets a schema::Type to produce a Type object. Implemented in - // terms of get(). - - Schema load(const schema::Node::Reader& reader); - // Loads the given schema node. Validates the node and throws an exception if invalid. This - // makes a copy of the schema, so the object passed in can be destroyed after this returns. - // - // If the node has any dependencies which are not already loaded, they will be initialized as - // stubs -- empty schemas of whichever kind is expected. - // - // If another schema for the given reader has already been seen, the loader will inspect both - // schemas to determine which one is newer, and use that that one. If the two versions are - // found to be incompatible, an exception is thrown. If the two versions differ but are - // compatible and the loader cannot determine which is newer (e.g., the only changes are renames), - // the existing schema will be preferred. Note that in any case, the loader will end up keeping - // around copies of both schemas, so you shouldn't repeatedly reload schemas into the same loader. - // - // The following properties of the schema node are validated: - // - Struct size and preferred list encoding are valid and consistent. - // - Struct members are fields or unions. - // - Union members are fields. - // - Field offsets are in-bounds. - // - Ordinals and codeOrders are sequential starting from zero. - // - Values are of the right union case to match their types. - // - // You should assume anything not listed above is NOT validated. In particular, things that are - // not validated now, but could be in the future, include but are not limited to: - // - Names. - // - Annotation values. (This is hard because the annotation declaration is not always - // available.) - // - Content of default/constant values of pointer type. (Validating these would require knowing - // their schema, but even if the schemas are available at validation time, they could be - // updated by a subsequent load(), invalidating existing values. Instead, these values are - // validated at the time they are used, as usual for Cap'n Proto objects.) - // - // Also note that unknown types are not considered invalid. Instead, the dynamic API returns - // a DynamicValue with type UNKNOWN for these. - - Schema loadOnce(const schema::Node::Reader& reader) const; - // Like `load()` but does nothing if a schema with the same ID is already loaded. In contrast, - // `load()` would attempt to compare the schemas and take the newer one. `loadOnce()` is safe - // to call even while concurrently using schemas from this loader. It should be considered an - // error to call `loadOnce()` with two non-identical schemas that share the same ID, although - // this error may or may not actually be detected by the implementation. - - template - void loadCompiledTypeAndDependencies(); - // Load the schema for the given compiled-in type and all of its dependencies. - // - // If you want to be able to cast a DynamicValue built from this SchemaLoader to the compiled-in - // type using as(), you must call this method before constructing the DynamicValue. Otherwise, - // as() will throw an exception complaining about type mismatch. - - kj::Array getAllLoaded() const; - // Get a complete list of all loaded schema nodes. It is particularly useful to call this after - // loadCompiledTypeAndDependencies() in order to get a flat list of all of T's transitive - // dependencies. - -private: - class Validator; - class CompatibilityChecker; - class Impl; - class InitializerImpl; - class BrandedInitializerImpl; - kj::MutexGuarded> impl; - - void loadNative(const _::RawSchema* nativeSchema); -}; - -template -inline void SchemaLoader::loadCompiledTypeAndDependencies() { - loadNative(&_::rawSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LOADER_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/schema-parser.h b/phonelibs/capnp-cpp/include/capnp/schema-parser.h deleted file mode 100644 index 3322bbfbfb..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema-parser.h +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_PARSER_H_ -#define CAPNP_SCHEMA_PARSER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema-loader.h" -#include - -namespace capnp { - -class ParsedSchema; -class SchemaFile; - -class SchemaParser { - // Parses `.capnp` files to produce `Schema` objects. - // - // This class is thread-safe, hence all its methods are const. - -public: - SchemaParser(); - ~SchemaParser() noexcept(false); - - ParsedSchema parseDiskFile(kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath) const; - // Parse a file located on disk. Throws an exception if the file dosen't exist. - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. (If the file has - // already been parsed, this will be ignored and the display name from the first time it was - // parsed will be kept.) - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). Must remain valid until the SchemaParser is destroyed. - // (If the file has already been parsed, this will be ignored and the import path from the - // first time it was parsed will be kept.) - // - // This method is a shortcut, equivalent to: - // parser.parseFile(SchemaFile::newDiskFile(displayName, diskPath, importPath))`; - // - // This method throws an exception if any errors are encountered in the file or in anything the - // file depends on. Note that merely importing another file does not count as a dependency on - // anything in the imported file -- only the imported types which are actually used are - // "dependencies". - - ParsedSchema parseFile(kj::Own&& file) const; - // Advanced interface for parsing a file that may or may not be located in any global namespace. - // Most users will prefer `parseDiskFile()`. - // - // If the file has already been parsed (that is, a SchemaFile that compares equal to this one - // was parsed previously), the existing schema will be returned again. - // - // This method reports errors by calling SchemaFile::reportError() on the file where the error - // is located. If that call does not throw an exception, `parseFile()` may in fact return - // normally. In this case, the result is a best-effort attempt to compile the schema, but it - // may be invalid or corrupt, and using it for anything may cause exceptions to be thrown. - - template - inline void loadCompiledTypeAndDependencies() { - // See SchemaLoader::loadCompiledTypeAndDependencies(). - getLoader().loadCompiledTypeAndDependencies(); - } - -private: - struct Impl; - class ModuleImpl; - kj::Own impl; - mutable bool hadErrors = false; - - ModuleImpl& getModuleImpl(kj::Own&& file) const; - SchemaLoader& getLoader(); - - friend class ParsedSchema; -}; - -class ParsedSchema: public Schema { - // ParsedSchema is an extension of Schema which also has the ability to look up nested nodes - // by name. See `SchemaParser`. - -public: - inline ParsedSchema(): parser(nullptr) {} - - kj::Maybe findNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or returns null if there is no such nested - // declaration. - - ParsedSchema getNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or throws an exception if there is no such nested - // declaration. - -private: - inline ParsedSchema(Schema inner, const SchemaParser& parser): Schema(inner), parser(&parser) {} - - const SchemaParser* parser; - friend class SchemaParser; -}; - -// ======================================================================================= -// Advanced API - -class SchemaFile { - // Abstract interface representing a schema file. You can implement this yourself in order to - // gain more control over how the compiler resolves imports and reads files. For the - // common case of files on disk or other global filesystem-like namespaces, use - // `SchemaFile::newDiskFile()`. - -public: - class FileReader { - public: - virtual bool exists(kj::StringPtr path) const = 0; - virtual kj::Array read(kj::StringPtr path) const = 0; - }; - - class DiskFileReader final: public FileReader { - // Implementation of FileReader that uses the local disk. Files are read using mmap() if - // possible. - - public: - static const DiskFileReader instance; - - bool exists(kj::StringPtr path) const override; - kj::Array read(kj::StringPtr path) const override; - }; - - static kj::Own newDiskFile( - kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath, - const FileReader& fileReader = DiskFileReader::instance); - // Construct a SchemaFile representing a file on disk (or located in the filesystem-like - // namespace represented by `fileReader`). - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). The array content must remain valid as long as the - // SchemaFile exists (which is at least as long as the SchemaParser that parses it exists). - // * `fileReader`: Allows you to use a filesystem other than the actual local disk. Although, - // if you find yourself using this, it may make more sense for you to implement SchemaFile - // yourself. - // - // The SchemaFile compares equal to any other SchemaFile that has exactly the same disk path, - // after canonicalization. - // - // The SchemaFile will throw an exception if any errors are reported. - - // ----------------------------------------------------------------- - // For more control, you can implement this interface. - - virtual kj::StringPtr getDisplayName() const = 0; - // Get the file's name, as it should appear in the schema. - - virtual kj::Array readContent() const = 0; - // Read the file's entire content and return it as a byte array. - - virtual kj::Maybe> import(kj::StringPtr path) const = 0; - // Resolve an import, relative to this file. - // - // `path` is exactly what appears between quotes after the `import` keyword in the source code. - // It is entirely up to the `SchemaFile` to decide how to map this to another file. Typically, - // a leading '/' means that the file is an "absolute" path and is searched for in some list of - // schema file repositories. On the other hand, a path that doesn't start with '/' is relative - // to the importing file. - - virtual bool operator==(const SchemaFile& other) const = 0; - virtual bool operator!=(const SchemaFile& other) const = 0; - virtual size_t hashCode() const = 0; - // Compare two SchemaFiles to see if they refer to the same underlying file. This is an - // optimization used to avoid the need to re-parse a file to check its ID. - - struct SourcePos { - uint byte; - uint line; - uint column; - }; - virtual void reportError(SourcePos start, SourcePos end, kj::StringPtr message) const = 0; - // Report that the file contains an error at the given interval. - -private: - class DiskSchemaFile; -}; - -} // namespace capnp - -#endif // CAPNP_SCHEMA_PARSER_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/schema.capnp b/phonelibs/capnp-cpp/include/capnp/schema.capnp deleted file mode 100644 index 4bef693f6c..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema.capnp +++ /dev/null @@ -1,498 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -using Cxx = import "/capnp/c++.capnp"; - -@0xa93fc509624c72d9; -$Cxx.namespace("capnp::schema"); - -using Id = UInt64; -# The globally-unique ID of a file, type, or annotation. - -struct Node { - id @0 :Id; - - displayName @1 :Text; - # Name to present to humans to identify this Node. You should not attempt to parse this. Its - # format could change. It is not guaranteed to be unique. - # - # (On Zooko's triangle, this is the node's nickname.) - - displayNamePrefixLength @2 :UInt32; - # If you want a shorter version of `displayName` (just naming this node, without its surrounding - # scope), chop off this many characters from the beginning of `displayName`. - - scopeId @3 :Id; - # ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back - # at this node, but robust code should avoid relying on this (and, in fact, group nodes are not - # listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is - # zero if the node has no parent, which is normally only the case with files, but should be - # allowed for any kind of node (in order to make runtime type generation easier). - - parameters @32 :List(Parameter); - # If this node is parameterized (generic), the list of parameters. Empty for non-generic types. - - isGeneric @33 :Bool; - # True if this node is generic, meaning that it or one of its parent scopes has a non-empty - # `parameters`. - - struct Parameter { - # Information about one of the node's parameters. - - name @0 :Text; - } - - nestedNodes @4 :List(NestedNode); - # List of nodes nested within this node, along with the names under which they were declared. - - struct NestedNode { - name @0 :Text; - # Unqualified symbol name. Unlike Node.displayName, this *can* be used programmatically. - # - # (On Zooko's triangle, this is the node's petname according to its parent scope.) - - id @1 :Id; - # ID of the nested node. Typically, the target node's scopeId points back to this node, but - # robust code should avoid relying on this. - } - - annotations @5 :List(Annotation); - # Annotations applied to this node. - - union { - # Info specific to each kind of node. - - file @6 :Void; - - struct :group { - dataWordCount @7 :UInt16; - # Size of the data section, in words. - - pointerCount @8 :UInt16; - # Size of the pointer section, in pointers (which are one word each). - - preferredListEncoding @9 :ElementSize; - # The preferred element size to use when encoding a list of this struct. If this is anything - # other than `inlineComposite` then the struct is one word or less in size and is a candidate - # for list packing optimization. - - isGroup @10 :Bool; - # If true, then this "struct" node is actually not an independent node, but merely represents - # some named union or group within a particular parent struct. This node's scopeId refers - # to the parent struct, which may itself be a union/group in yet another struct. - # - # All group nodes share the same dataWordCount and pointerCount as the top-level - # struct, and their fields live in the same ordinal and offset spaces as all other fields in - # the struct. - # - # Note that a named union is considered a special kind of group -- in fact, a named union - # is exactly equivalent to a group that contains nothing but an unnamed union. - - discriminantCount @11 :UInt16; - # Number of fields in this struct which are members of an anonymous union, and thus may - # overlap. If this is non-zero, then a 16-bit discriminant is present indicating which - # of the overlapping fields is active. This can never be 1 -- if it is non-zero, it must be - # two or more. - # - # Note that the fields of an unnamed union are considered fields of the scope containing the - # union -- an unnamed union is not its own group. So, a top-level struct may contain a - # non-zero discriminant count. Named unions, on the other hand, are equivalent to groups - # containing unnamed unions. So, a named union has its own independent schema node, with - # `isGroup` = true. - - discriminantOffset @12 :UInt32; - # If `discriminantCount` is non-zero, this is the offset of the union discriminant, in - # multiples of 16 bits. - - fields @13 :List(Field); - # Fields defined within this scope (either the struct's top-level fields, or the fields of - # a particular group; see `isGroup`). - # - # The fields are sorted by ordinal number, but note that because groups share the same - # ordinal space, the field's index in this list is not necessarily exactly its ordinal. - # On the other hand, the field's position in this list does remain the same even as the - # protocol evolves, since it is not possible to insert or remove an earlier ordinal. - # Therefore, for most use cases, if you want to identify a field by number, it may make the - # most sense to use the field's index in this list rather than its ordinal. - } - - enum :group { - enumerants@14 :List(Enumerant); - # Enumerants ordered by numeric value (ordinal). - } - - interface :group { - methods @15 :List(Method); - # Methods ordered by ordinal. - - superclasses @31 :List(Superclass); - # Superclasses of this interface. - } - - const :group { - type @16 :Type; - value @17 :Value; - } - - annotation :group { - type @18 :Type; - - targetsFile @19 :Bool; - targetsConst @20 :Bool; - targetsEnum @21 :Bool; - targetsEnumerant @22 :Bool; - targetsStruct @23 :Bool; - targetsField @24 :Bool; - targetsUnion @25 :Bool; - targetsGroup @26 :Bool; - targetsInterface @27 :Bool; - targetsMethod @28 :Bool; - targetsParam @29 :Bool; - targetsAnnotation @30 :Bool; - } - } -} - -struct Field { - # Schema for a field of a struct. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Indicates where this member appeared in the code, relative to other members. - # Code ordering may have semantic relevance -- programmers tend to place related fields - # together. So, using code ordering makes sense in human-readable formats where ordering is - # otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum - # value is count(members) - 1. Fields that are members of a union are only ordered relative to - # the other members of that union, so the maximum value there is count(union.members). - - annotations @2 :List(Annotation); - - const noDiscriminant :UInt16 = 0xffff; - - discriminantValue @3 :UInt16 = Field.noDiscriminant; - # If the field is in a union, this is the value which the union's discriminant should take when - # the field is active. If the field is not in a union, this is 0xffff. - - union { - slot :group { - # A regular, non-group, non-fixed-list field. - - offset @4 :UInt32; - # Offset, in units of the field's size, from the beginning of the section in which the field - # resides. E.g. for a UInt32 field, multiply this by 4 to get the byte offset from the - # beginning of the data section. - - type @5 :Type; - defaultValue @6 :Value; - - hadExplicitDefault @10 :Bool; - # Whether the default value was specified explicitly. Non-explicit default values are always - # zero or empty values. Usually, whether the default value was explicit shouldn't matter. - # The main use case for this flag is for structs representing method parameters: - # explicitly-defaulted parameters may be allowed to be omitted when calling the method. - } - - group :group { - # A group. - - typeId @7 :Id; - # The ID of the group's node. - } - } - - ordinal :union { - implicit @8 :Void; - explicit @9 :UInt16; - # The original ordinal number given to the field. You probably should NOT use this; if you need - # a numeric identifier for a field, use its position within the field array for its scope. - # The ordinal is given here mainly just so that the original schema text can be reproduced given - # the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. - } -} - -struct Enumerant { - # Schema for member of an enum. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the enumerants were declared in the code. - # Like Struct.Field.codeOrder. - - annotations @2 :List(Annotation); -} - -struct Superclass { - id @0 :Id; - brand @1 :Brand; -} - -struct Method { - # Schema for method of an interface. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the methods were declared in the code. - # Like Struct.Field.codeOrder. - - implicitParameters @7 :List(Node.Parameter); - # The parameters listed in [] (typically, type / generic parameters), whose bindings are intended - # to be inferred rather than specified explicitly, although not all languages support this. - - paramStructType @2 :Id; - # ID of the parameter struct type. If a named parameter list was specified in the method - # declaration (rather than a single struct parameter type) then a corresponding struct type is - # auto-generated. Such an auto-generated type will not be listed in the interface's - # `nestedNodes` and its `scopeId` will be zero -- it is completely detached from the namespace. - # (Awkwardly, it does of course inherit generic parameters from the method's scope, which makes - # this a situation where you can't just climb the scope chain to find where a particular - # generic parameter was introduced. Making the `scopeId` zero was a mistake.) - - paramBrand @5 :Brand; - # Brand of param struct type. - - resultStructType @3 :Id; - # ID of the return struct type; similar to `paramStructType`. - - resultBrand @6 :Brand; - # Brand of result struct type. - - annotations @4 :List(Annotation); -} - -struct Type { - # Represents a type expression. - - union { - # The ordinals intentionally match those of Value. - - void @0 :Void; - bool @1 :Void; - int8 @2 :Void; - int16 @3 :Void; - int32 @4 :Void; - int64 @5 :Void; - uint8 @6 :Void; - uint16 @7 :Void; - uint32 @8 :Void; - uint64 @9 :Void; - float32 @10 :Void; - float64 @11 :Void; - text @12 :Void; - data @13 :Void; - - list :group { - elementType @14 :Type; - } - - enum :group { - typeId @15 :Id; - brand @21 :Brand; - } - struct :group { - typeId @16 :Id; - brand @22 :Brand; - } - interface :group { - typeId @17 :Id; - brand @23 :Brand; - } - - anyPointer :union { - unconstrained :union { - # A regular AnyPointer. - # - # The name "unconstrained" means as opposed to constraining it to match a type parameter. - # In retrospect this name is probably a poor choice given that it may still be constrained - # to be a struct, list, or capability. - - anyKind @18 :Void; # truly AnyPointer - struct @25 :Void; # AnyStruct - list @26 :Void; # AnyList - capability @27 :Void; # Capability - } - - parameter :group { - # This is actually a reference to a type parameter defined within this scope. - - scopeId @19 :Id; - # ID of the generic type whose parameter we're referencing. This should be a parent of the - # current scope. - - parameterIndex @20 :UInt16; - # Index of the parameter within the generic type's parameter list. - } - - implicitMethodParameter :group { - # This is actually a reference to an implicit (generic) parameter of a method. The only - # legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. - - parameterIndex @24 :UInt16; - } - } - } -} - -struct Brand { - # Specifies bindings for parameters of generics. Since these bindings turn a generic into a - # non-generic, we call it the "brand". - - scopes @0 :List(Scope); - # For each of the target type and each of its parent scopes, a parameterization may be included - # in this list. If no parameterization is included for a particular relevant scope, then either - # that scope has no parameters or all parameters should be considered to be `AnyPointer`. - - struct Scope { - scopeId @0 :Id; - # ID of the scope to which these params apply. - - union { - bind @1 :List(Binding); - # List of parameter bindings. - - inherit @2 :Void; - # The place where this Brand appears is actually within this scope or a sub-scope, - # and the bindings for this scope should be inherited from the reference point. - } - } - - struct Binding { - union { - unbound @0 :Void; - type @1 :Type; - - # TODO(someday): Allow non-type parameters? Unsure if useful. - } - } -} - -struct Value { - # Represents a value, e.g. a field default value, constant value, or annotation value. - - union { - # The ordinals intentionally match those of Type. - - void @0 :Void; - bool @1 :Bool; - int8 @2 :Int8; - int16 @3 :Int16; - int32 @4 :Int32; - int64 @5 :Int64; - uint8 @6 :UInt8; - uint16 @7 :UInt16; - uint32 @8 :UInt32; - uint64 @9 :UInt64; - float32 @10 :Float32; - float64 @11 :Float64; - text @12 :Text; - data @13 :Data; - - list @14 :AnyPointer; - - enum @15 :UInt16; - struct @16 :AnyPointer; - - interface @17 :Void; - # The only interface value that can be represented statically is "null", whose methods always - # throw exceptions. - - anyPointer @18 :AnyPointer; - } -} - -struct Annotation { - # Describes an annotation applied to a declaration. Note AnnotationNode describes the - # annotation's declaration, while this describes a use of the annotation. - - id @0 :Id; - # ID of the annotation node. - - brand @2 :Brand; - # Brand of the annotation. - # - # Note that the annotation itself is not allowed to be parameterized, but its scope might be. - - value @1 :Value; -} - -enum ElementSize { - # Possible element sizes for encoded lists. These correspond exactly to the possible values of - # the 3-bit element size component of a list pointer. - - empty @0; # aka "void", but that's a keyword. - bit @1; - byte @2; - twoBytes @3; - fourBytes @4; - eightBytes @5; - pointer @6; - inlineComposite @7; -} - -struct CapnpVersion { - major @0 :UInt16; - minor @1 :UInt8; - micro @2 :UInt8; -} - -struct CodeGeneratorRequest { - capnpVersion @2 :CapnpVersion; - # Version of the `capnp` executable. Generally, code generators should ignore this, but the code - # generators that ship with `capnp` itself will print a warning if this mismatches since that - # probably indicates something is misconfigured. - # - # The first version of 'capnp' to set this was 0.6.0. So, if it's missing, the compiler version - # is older than that. - - nodes @0 :List(Node); - # All nodes parsed by the compiler, including for the files on the command line and their - # imports. - - requestedFiles @1 :List(RequestedFile); - # Files which were listed on the command line. - - struct RequestedFile { - id @0 :Id; - # ID of the file. - - filename @1 :Text; - # Name of the file as it appeared on the command-line (minus the src-prefix). You may use - # this to decide where to write the output. - - imports @2 :List(Import); - # List of all imported paths seen in this file. - - struct Import { - id @0 :Id; - # ID of the imported file. - - name @1 :Text; - # Name which *this* file used to refer to the foreign file. This may be a relative name. - # This information is provided because it might be useful for code generation, e.g. to - # generate #include directives in C++. We don't put this in Node.file because this - # information is only meaningful at compile time anyway. - # - # (On Zooko's triangle, this is the import's petname according to the importing file.) - } - } -} diff --git a/phonelibs/capnp-cpp/include/capnp/schema.capnp.h b/phonelibs/capnp-cpp/include/capnp/schema.capnp.h deleted file mode 100644 index 1f116c9f8f..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema.capnp.h +++ /dev/null @@ -1,7861 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: schema.capnp - -#ifndef CAPNP_INCLUDED_a93fc509624c72d9_ -#define CAPNP_INCLUDED_a93fc509624c72d9_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(e682ab4cf923a417); -CAPNP_DECLARE_SCHEMA(b9521bccf10fa3b1); -CAPNP_DECLARE_SCHEMA(debf55bbfa0fc242); -CAPNP_DECLARE_SCHEMA(9ea0b19b37fb4435); -CAPNP_DECLARE_SCHEMA(b54ab3364333f598); -CAPNP_DECLARE_SCHEMA(e82753cff0c2218f); -CAPNP_DECLARE_SCHEMA(b18aa5ac7a0d9420); -CAPNP_DECLARE_SCHEMA(ec1619d4400a0290); -CAPNP_DECLARE_SCHEMA(9aad50a41f4af45f); -CAPNP_DECLARE_SCHEMA(97b14cbe7cfec712); -CAPNP_DECLARE_SCHEMA(c42305476bb4746f); -CAPNP_DECLARE_SCHEMA(cafccddb68db1d11); -CAPNP_DECLARE_SCHEMA(bb90d5c287870be6); -CAPNP_DECLARE_SCHEMA(978a7cebdc549a4d); -CAPNP_DECLARE_SCHEMA(a9962a9ed0a4d7f8); -CAPNP_DECLARE_SCHEMA(9500cce23b334d80); -CAPNP_DECLARE_SCHEMA(d07378ede1f9cc60); -CAPNP_DECLARE_SCHEMA(87e739250a60ea97); -CAPNP_DECLARE_SCHEMA(9e0e78711a7f87a9); -CAPNP_DECLARE_SCHEMA(ac3a6f60ef4cc6d3); -CAPNP_DECLARE_SCHEMA(ed8bca69f7fb0cbf); -CAPNP_DECLARE_SCHEMA(c2573fe8a23e49f1); -CAPNP_DECLARE_SCHEMA(8e3b5f79fe593656); -CAPNP_DECLARE_SCHEMA(9dd1f724f4614a85); -CAPNP_DECLARE_SCHEMA(baefc9120c56e274); -CAPNP_DECLARE_SCHEMA(903455f06065422b); -CAPNP_DECLARE_SCHEMA(abd73485a9636bc9); -CAPNP_DECLARE_SCHEMA(c863cd16969ee7fc); -CAPNP_DECLARE_SCHEMA(ce23dcd2d7b00c9b); -CAPNP_DECLARE_SCHEMA(f1c8950dab257542); -CAPNP_DECLARE_SCHEMA(d1958f7dba521926); -enum class ElementSize_d1958f7dba521926: uint16_t { - EMPTY, - BIT, - BYTE, - TWO_BYTES, - FOUR_BYTES, - EIGHT_BYTES, - POINTER, - INLINE_COMPOSITE, -}; -CAPNP_DECLARE_ENUM(ElementSize, d1958f7dba521926); -CAPNP_DECLARE_SCHEMA(d85d305b7d839963); -CAPNP_DECLARE_SCHEMA(bfc546f6210ad7ce); -CAPNP_DECLARE_SCHEMA(cfea0eb02e810062); -CAPNP_DECLARE_SCHEMA(ae504193122357e5); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace schema { - -struct Node { - Node() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - FILE, - STRUCT, - ENUM, - INTERFACE, - CONST, - ANNOTATION, - }; - struct Parameter; - struct NestedNode; - struct Struct; - struct Enum; - struct Interface; - struct Const; - struct Annotation; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e682ab4cf923a417, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b9521bccf10fa3b1, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::NestedNode { - NestedNode() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(debf55bbfa0fc242, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9ea0b19b37fb4435, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b54ab3364333f598, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e82753cff0c2218f, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Const { - Const() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b18aa5ac7a0d9420, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ec1619d4400a0290, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SLOT, - GROUP, - }; - static constexpr ::uint16_t NO_DISCRIMINANT = 65535u; - struct Slot; - struct Group; - struct Ordinal; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9aad50a41f4af45f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Slot { - Slot() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c42305476bb4746f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Group { - Group() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cafccddb68db1d11, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Ordinal { - Ordinal() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPLICIT, - EXPLICIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bb90d5c287870be6, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Enumerant { - Enumerant() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(978a7cebdc549a4d, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Superclass { - Superclass() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(a9962a9ed0a4d7f8, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Method { - Method() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9500cce23b334d80, 3, 5) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type { - Type() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - struct List; - struct Enum; - struct Struct; - struct Interface; - struct AnyPointer; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d07378ede1f9cc60, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::List { - List() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(87e739250a60ea97, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e0e78711a7f87a9, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ac3a6f60ef4cc6d3, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ed8bca69f7fb0cbf, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer { - AnyPointer() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNCONSTRAINED, - PARAMETER, - IMPLICIT_METHOD_PARAMETER, - }; - struct Unconstrained; - struct Parameter; - struct ImplicitMethodParameter; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c2573fe8a23e49f1, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Unconstrained { - Unconstrained() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - ANY_KIND, - STRUCT, - LIST, - CAPABILITY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8e3b5f79fe593656, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9dd1f724f4614a85, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::ImplicitMethodParameter { - ImplicitMethodParameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(baefc9120c56e274, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand { - Brand() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Scope; - struct Binding; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(903455f06065422b, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Scope { - Scope() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - BIND, - INHERIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(abd73485a9636bc9, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Binding { - Binding() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNBOUND, - TYPE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c863cd16969ee7fc, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Value { - Value() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ce23dcd2d7b00c9b, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f1c8950dab257542, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -typedef ::capnp::schemas::ElementSize_d1958f7dba521926 ElementSize; - -struct CapnpVersion { - CapnpVersion() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d85d305b7d839963, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest { - CodeGeneratorRequest() = delete; - - class Reader; - class Builder; - class Pipeline; - struct RequestedFile; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bfc546f6210ad7ce, 0, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile { - RequestedFile() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Import; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cfea0eb02e810062, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile::Import { - Import() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ae504193122357e5, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Node::Reader { -public: - typedef Node Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getId() const; - - inline bool hasDisplayName() const; - inline ::capnp::Text::Reader getDisplayName() const; - - inline ::uint32_t getDisplayNamePrefixLength() const; - - inline ::uint64_t getScopeId() const; - - inline bool hasNestedNodes() const; - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader getNestedNodes() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool isFile() const; - inline ::capnp::Void getFile() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isConst() const; - inline typename Const::Reader getConst() const; - - inline bool isAnnotation() const; - inline typename Annotation::Reader getAnnotation() const; - - inline bool hasParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getParameters() const; - - inline bool getIsGeneric() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Builder { -public: - typedef Node Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasDisplayName(); - inline ::capnp::Text::Builder getDisplayName(); - inline void setDisplayName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initDisplayName(unsigned int size); - inline void adoptDisplayName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownDisplayName(); - - inline ::uint32_t getDisplayNamePrefixLength(); - inline void setDisplayNamePrefixLength( ::uint32_t value); - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool hasNestedNodes(); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder getNestedNodes(); - inline void setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder initNestedNodes(unsigned int size); - inline void adoptNestedNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> disownNestedNodes(); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool isFile(); - inline ::capnp::Void getFile(); - inline void setFile( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isConst(); - inline typename Const::Builder getConst(); - inline typename Const::Builder initConst(); - - inline bool isAnnotation(); - inline typename Annotation::Builder getAnnotation(); - inline typename Annotation::Builder initAnnotation(); - - inline bool hasParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getParameters(); - inline void setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initParameters(unsigned int size); - inline void adoptParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownParameters(); - - inline bool getIsGeneric(); - inline void setIsGeneric(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Pipeline { -public: - typedef Node Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::NestedNode::Reader { -public: - typedef NestedNode Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint64_t getId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::NestedNode::Builder { -public: - typedef NestedNode Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::NestedNode::Pipeline { -public: - typedef NestedNode Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount() const; - - inline ::uint16_t getPointerCount() const; - - inline ::capnp::schema::ElementSize getPreferredListEncoding() const; - - inline bool getIsGroup() const; - - inline ::uint16_t getDiscriminantCount() const; - - inline ::uint32_t getDiscriminantOffset() const; - - inline bool hasFields() const; - inline ::capnp::List< ::capnp::schema::Field>::Reader getFields() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount(); - inline void setDataWordCount( ::uint16_t value); - - inline ::uint16_t getPointerCount(); - inline void setPointerCount( ::uint16_t value); - - inline ::capnp::schema::ElementSize getPreferredListEncoding(); - inline void setPreferredListEncoding( ::capnp::schema::ElementSize value); - - inline bool getIsGroup(); - inline void setIsGroup(bool value); - - inline ::uint16_t getDiscriminantCount(); - inline void setDiscriminantCount( ::uint16_t value); - - inline ::uint32_t getDiscriminantOffset(); - inline void setDiscriminantOffset( ::uint32_t value); - - inline bool hasFields(); - inline ::capnp::List< ::capnp::schema::Field>::Builder getFields(); - inline void setFields( ::capnp::List< ::capnp::schema::Field>::Reader value); - inline ::capnp::List< ::capnp::schema::Field>::Builder initFields(unsigned int size); - inline void adoptFields(::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> disownFields(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasEnumerants() const; - inline ::capnp::List< ::capnp::schema::Enumerant>::Reader getEnumerants() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasEnumerants(); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder getEnumerants(); - inline void setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder initEnumerants(unsigned int size); - inline void adoptEnumerants(::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> disownEnumerants(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasMethods() const; - inline ::capnp::List< ::capnp::schema::Method>::Reader getMethods() const; - - inline bool hasSuperclasses() const; - inline ::capnp::List< ::capnp::schema::Superclass>::Reader getSuperclasses() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasMethods(); - inline ::capnp::List< ::capnp::schema::Method>::Builder getMethods(); - inline void setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value); - inline ::capnp::List< ::capnp::schema::Method>::Builder initMethods(unsigned int size); - inline void adoptMethods(::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> disownMethods(); - - inline bool hasSuperclasses(); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder getSuperclasses(); - inline void setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder initSuperclasses(unsigned int size); - inline void adoptSuperclasses(::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> disownSuperclasses(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Const::Reader { -public: - typedef Const Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Const::Builder { -public: - typedef Const Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Const::Pipeline { -public: - typedef Const Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool getTargetsFile() const; - - inline bool getTargetsConst() const; - - inline bool getTargetsEnum() const; - - inline bool getTargetsEnumerant() const; - - inline bool getTargetsStruct() const; - - inline bool getTargetsField() const; - - inline bool getTargetsUnion() const; - - inline bool getTargetsGroup() const; - - inline bool getTargetsInterface() const; - - inline bool getTargetsMethod() const; - - inline bool getTargetsParam() const; - - inline bool getTargetsAnnotation() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool getTargetsFile(); - inline void setTargetsFile(bool value); - - inline bool getTargetsConst(); - inline void setTargetsConst(bool value); - - inline bool getTargetsEnum(); - inline void setTargetsEnum(bool value); - - inline bool getTargetsEnumerant(); - inline void setTargetsEnumerant(bool value); - - inline bool getTargetsStruct(); - inline void setTargetsStruct(bool value); - - inline bool getTargetsField(); - inline void setTargetsField(bool value); - - inline bool getTargetsUnion(); - inline void setTargetsUnion(bool value); - - inline bool getTargetsGroup(); - inline void setTargetsGroup(bool value); - - inline bool getTargetsInterface(); - inline void setTargetsInterface(bool value); - - inline bool getTargetsMethod(); - inline void setTargetsMethod(bool value); - - inline bool getTargetsParam(); - inline void setTargetsParam(bool value); - - inline bool getTargetsAnnotation(); - inline void setTargetsAnnotation(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline ::uint16_t getDiscriminantValue() const; - - inline bool isSlot() const; - inline typename Slot::Reader getSlot() const; - - inline bool isGroup() const; - inline typename Group::Reader getGroup() const; - - inline typename Ordinal::Reader getOrdinal() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline ::uint16_t getDiscriminantValue(); - inline void setDiscriminantValue( ::uint16_t value); - - inline bool isSlot(); - inline typename Slot::Builder getSlot(); - inline typename Slot::Builder initSlot(); - - inline bool isGroup(); - inline typename Group::Builder getGroup(); - inline typename Group::Builder initGroup(); - - inline typename Ordinal::Builder getOrdinal(); - inline typename Ordinal::Builder initOrdinal(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename Ordinal::Pipeline getOrdinal(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Slot::Reader { -public: - typedef Slot Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset() const; - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasDefaultValue() const; - inline ::capnp::schema::Value::Reader getDefaultValue() const; - - inline bool getHadExplicitDefault() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Slot::Builder { -public: - typedef Slot Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset(); - inline void setOffset( ::uint32_t value); - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasDefaultValue(); - inline ::capnp::schema::Value::Builder getDefaultValue(); - inline void setDefaultValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initDefaultValue(); - inline void adoptDefaultValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownDefaultValue(); - - inline bool getHadExplicitDefault(); - inline void setHadExplicitDefault(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Slot::Pipeline { -public: - typedef Slot Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getDefaultValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Group::Reader { -public: - typedef Group Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Group::Builder { -public: - typedef Group Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Group::Pipeline { -public: - typedef Group Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Ordinal::Reader { -public: - typedef Ordinal Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImplicit() const; - inline ::capnp::Void getImplicit() const; - - inline bool isExplicit() const; - inline ::uint16_t getExplicit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Ordinal::Builder { -public: - typedef Ordinal Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImplicit(); - inline ::capnp::Void getImplicit(); - inline void setImplicit( ::capnp::Void value = ::capnp::VOID); - - inline bool isExplicit(); - inline ::uint16_t getExplicit(); - inline void setExplicit( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Ordinal::Pipeline { -public: - typedef Ordinal Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Enumerant::Reader { -public: - typedef Enumerant Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Enumerant::Builder { -public: - typedef Enumerant Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Enumerant::Pipeline { -public: - typedef Enumerant Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Superclass::Reader { -public: - typedef Superclass Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Superclass::Builder { -public: - typedef Superclass Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Superclass::Pipeline { -public: - typedef Superclass Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Method::Reader { -public: - typedef Method Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline ::uint64_t getParamStructType() const; - - inline ::uint64_t getResultStructType() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool hasParamBrand() const; - inline ::capnp::schema::Brand::Reader getParamBrand() const; - - inline bool hasResultBrand() const; - inline ::capnp::schema::Brand::Reader getResultBrand() const; - - inline bool hasImplicitParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getImplicitParameters() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Method::Builder { -public: - typedef Method Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline ::uint64_t getParamStructType(); - inline void setParamStructType( ::uint64_t value); - - inline ::uint64_t getResultStructType(); - inline void setResultStructType( ::uint64_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool hasParamBrand(); - inline ::capnp::schema::Brand::Builder getParamBrand(); - inline void setParamBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initParamBrand(); - inline void adoptParamBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownParamBrand(); - - inline bool hasResultBrand(); - inline ::capnp::schema::Brand::Builder getResultBrand(); - inline void setResultBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initResultBrand(); - inline void adoptResultBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownResultBrand(); - - inline bool hasImplicitParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getImplicitParameters(); - inline void setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initImplicitParameters(unsigned int size); - inline void adoptImplicitParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownImplicitParameters(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Method::Pipeline { -public: - typedef Method Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getParamBrand(); - inline ::capnp::schema::Brand::Pipeline getResultBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Reader { -public: - typedef Type Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline ::capnp::Void getBool() const; - - inline bool isInt8() const; - inline ::capnp::Void getInt8() const; - - inline bool isInt16() const; - inline ::capnp::Void getInt16() const; - - inline bool isInt32() const; - inline ::capnp::Void getInt32() const; - - inline bool isInt64() const; - inline ::capnp::Void getInt64() const; - - inline bool isUint8() const; - inline ::capnp::Void getUint8() const; - - inline bool isUint16() const; - inline ::capnp::Void getUint16() const; - - inline bool isUint32() const; - inline ::capnp::Void getUint32() const; - - inline bool isUint64() const; - inline ::capnp::Void getUint64() const; - - inline bool isFloat32() const; - inline ::capnp::Void getFloat32() const; - - inline bool isFloat64() const; - inline ::capnp::Void getFloat64() const; - - inline bool isText() const; - inline ::capnp::Void getText() const; - - inline bool isData() const; - inline ::capnp::Void getData() const; - - inline bool isList() const; - inline typename List::Reader getList() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isAnyPointer() const; - inline typename AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Builder { -public: - typedef Type Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline ::capnp::Void getBool(); - inline void setBool( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt8(); - inline ::capnp::Void getInt8(); - inline void setInt8( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt16(); - inline ::capnp::Void getInt16(); - inline void setInt16( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt32(); - inline ::capnp::Void getInt32(); - inline void setInt32( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt64(); - inline ::capnp::Void getInt64(); - inline void setInt64( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint8(); - inline ::capnp::Void getUint8(); - inline void setUint8( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint16(); - inline ::capnp::Void getUint16(); - inline void setUint16( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint32(); - inline ::capnp::Void getUint32(); - inline void setUint32( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint64(); - inline ::capnp::Void getUint64(); - inline void setUint64( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat32(); - inline ::capnp::Void getFloat32(); - inline void setFloat32( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat64(); - inline ::capnp::Void getFloat64(); - inline void setFloat64( ::capnp::Void value = ::capnp::VOID); - - inline bool isText(); - inline ::capnp::Void getText(); - inline void setText( ::capnp::Void value = ::capnp::VOID); - - inline bool isData(); - inline ::capnp::Void getData(); - inline void setData( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline typename List::Builder getList(); - inline typename List::Builder initList(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isAnyPointer(); - inline typename AnyPointer::Builder getAnyPointer(); - inline typename AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Pipeline { -public: - typedef Type Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::List::Reader { -public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasElementType() const; - inline ::capnp::schema::Type::Reader getElementType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::List::Builder { -public: - typedef List Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasElementType(); - inline ::capnp::schema::Type::Builder getElementType(); - inline void setElementType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initElementType(); - inline void adoptElementType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownElementType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::List::Pipeline { -public: - typedef List Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getElementType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Reader { -public: - typedef AnyPointer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnconstrained() const; - inline typename Unconstrained::Reader getUnconstrained() const; - - inline bool isParameter() const; - inline typename Parameter::Reader getParameter() const; - - inline bool isImplicitMethodParameter() const; - inline typename ImplicitMethodParameter::Reader getImplicitMethodParameter() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Builder { -public: - typedef AnyPointer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnconstrained(); - inline typename Unconstrained::Builder getUnconstrained(); - inline typename Unconstrained::Builder initUnconstrained(); - - inline bool isParameter(); - inline typename Parameter::Builder getParameter(); - inline typename Parameter::Builder initParameter(); - - inline bool isImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder getImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder initImplicitMethodParameter(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Pipeline { -public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Unconstrained::Reader { -public: - typedef Unconstrained Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isAnyKind() const; - inline ::capnp::Void getAnyKind() const; - - inline bool isStruct() const; - inline ::capnp::Void getStruct() const; - - inline bool isList() const; - inline ::capnp::Void getList() const; - - inline bool isCapability() const; - inline ::capnp::Void getCapability() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Unconstrained::Builder { -public: - typedef Unconstrained Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isAnyKind(); - inline ::capnp::Void getAnyKind(); - inline void setAnyKind( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline ::capnp::Void getStruct(); - inline void setStruct( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline ::capnp::Void getList(); - inline void setList( ::capnp::Void value = ::capnp::VOID); - - inline bool isCapability(); - inline ::capnp::Void getCapability(); - inline void setCapability( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Unconstrained::Pipeline { -public: - typedef Unconstrained Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId() const; - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::ImplicitMethodParameter::Reader { -public: - typedef ImplicitMethodParameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::ImplicitMethodParameter::Builder { -public: - typedef ImplicitMethodParameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::ImplicitMethodParameter::Pipeline { -public: - typedef ImplicitMethodParameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Reader { -public: - typedef Brand Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasScopes() const; - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader getScopes() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Builder { -public: - typedef Brand Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasScopes(); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder getScopes(); - inline void setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder initScopes(unsigned int size); - inline void adoptScopes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> disownScopes(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Pipeline { -public: - typedef Brand Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Scope::Reader { -public: - typedef Scope Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getScopeId() const; - - inline bool isBind() const; - inline bool hasBind() const; - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader getBind() const; - - inline bool isInherit() const; - inline ::capnp::Void getInherit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Scope::Builder { -public: - typedef Scope Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool isBind(); - inline bool hasBind(); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder getBind(); - inline void setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder initBind(unsigned int size); - inline void adoptBind(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> disownBind(); - - inline bool isInherit(); - inline ::capnp::Void getInherit(); - inline void setInherit( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Scope::Pipeline { -public: - typedef Scope Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Binding::Reader { -public: - typedef Binding Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnbound() const; - inline ::capnp::Void getUnbound() const; - - inline bool isType() const; - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Binding::Builder { -public: - typedef Binding Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnbound(); - inline ::capnp::Void getUnbound(); - inline void setUnbound( ::capnp::Void value = ::capnp::VOID); - - inline bool isType(); - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Binding::Pipeline { -public: - typedef Binding Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Value::Reader { -public: - typedef Value Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline bool getBool() const; - - inline bool isInt8() const; - inline ::int8_t getInt8() const; - - inline bool isInt16() const; - inline ::int16_t getInt16() const; - - inline bool isInt32() const; - inline ::int32_t getInt32() const; - - inline bool isInt64() const; - inline ::int64_t getInt64() const; - - inline bool isUint8() const; - inline ::uint8_t getUint8() const; - - inline bool isUint16() const; - inline ::uint16_t getUint16() const; - - inline bool isUint32() const; - inline ::uint32_t getUint32() const; - - inline bool isUint64() const; - inline ::uint64_t getUint64() const; - - inline bool isFloat32() const; - inline float getFloat32() const; - - inline bool isFloat64() const; - inline double getFloat64() const; - - inline bool isText() const; - inline bool hasText() const; - inline ::capnp::Text::Reader getText() const; - - inline bool isData() const; - inline bool hasData() const; - inline ::capnp::Data::Reader getData() const; - - inline bool isList() const; - inline bool hasList() const; - inline ::capnp::AnyPointer::Reader getList() const; - - inline bool isEnum() const; - inline ::uint16_t getEnum() const; - - inline bool isStruct() const; - inline bool hasStruct() const; - inline ::capnp::AnyPointer::Reader getStruct() const; - - inline bool isInterface() const; - inline ::capnp::Void getInterface() const; - - inline bool isAnyPointer() const; - inline bool hasAnyPointer() const; - inline ::capnp::AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Value::Builder { -public: - typedef Value Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline bool getBool(); - inline void setBool(bool value); - - inline bool isInt8(); - inline ::int8_t getInt8(); - inline void setInt8( ::int8_t value); - - inline bool isInt16(); - inline ::int16_t getInt16(); - inline void setInt16( ::int16_t value); - - inline bool isInt32(); - inline ::int32_t getInt32(); - inline void setInt32( ::int32_t value); - - inline bool isInt64(); - inline ::int64_t getInt64(); - inline void setInt64( ::int64_t value); - - inline bool isUint8(); - inline ::uint8_t getUint8(); - inline void setUint8( ::uint8_t value); - - inline bool isUint16(); - inline ::uint16_t getUint16(); - inline void setUint16( ::uint16_t value); - - inline bool isUint32(); - inline ::uint32_t getUint32(); - inline void setUint32( ::uint32_t value); - - inline bool isUint64(); - inline ::uint64_t getUint64(); - inline void setUint64( ::uint64_t value); - - inline bool isFloat32(); - inline float getFloat32(); - inline void setFloat32(float value); - - inline bool isFloat64(); - inline double getFloat64(); - inline void setFloat64(double value); - - inline bool isText(); - inline bool hasText(); - inline ::capnp::Text::Builder getText(); - inline void setText( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initText(unsigned int size); - inline void adoptText(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownText(); - - inline bool isData(); - inline bool hasData(); - inline ::capnp::Data::Builder getData(); - inline void setData( ::capnp::Data::Reader value); - inline ::capnp::Data::Builder initData(unsigned int size); - inline void adoptData(::capnp::Orphan< ::capnp::Data>&& value); - inline ::capnp::Orphan< ::capnp::Data> disownData(); - - inline bool isList(); - inline bool hasList(); - inline ::capnp::AnyPointer::Builder getList(); - inline ::capnp::AnyPointer::Builder initList(); - - inline bool isEnum(); - inline ::uint16_t getEnum(); - inline void setEnum( ::uint16_t value); - - inline bool isStruct(); - inline bool hasStruct(); - inline ::capnp::AnyPointer::Builder getStruct(); - inline ::capnp::AnyPointer::Builder initStruct(); - - inline bool isInterface(); - inline ::capnp::Void getInterface(); - inline void setInterface( ::capnp::Void value = ::capnp::VOID); - - inline bool isAnyPointer(); - inline bool hasAnyPointer(); - inline ::capnp::AnyPointer::Builder getAnyPointer(); - inline ::capnp::AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Value::Pipeline { -public: - typedef Value Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Value::Pipeline getValue(); - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapnpVersion::Reader { -public: - typedef CapnpVersion Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor() const; - - inline ::uint8_t getMinor() const; - - inline ::uint8_t getMicro() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapnpVersion::Builder { -public: - typedef CapnpVersion Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor(); - inline void setMajor( ::uint16_t value); - - inline ::uint8_t getMinor(); - inline void setMinor( ::uint8_t value); - - inline ::uint8_t getMicro(); - inline void setMicro( ::uint8_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapnpVersion::Pipeline { -public: - typedef CapnpVersion Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::Reader { -public: - typedef CodeGeneratorRequest Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasNodes() const; - inline ::capnp::List< ::capnp::schema::Node>::Reader getNodes() const; - - inline bool hasRequestedFiles() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader getRequestedFiles() const; - - inline bool hasCapnpVersion() const; - inline ::capnp::schema::CapnpVersion::Reader getCapnpVersion() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::Builder { -public: - typedef CodeGeneratorRequest Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasNodes(); - inline ::capnp::List< ::capnp::schema::Node>::Builder getNodes(); - inline void setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value); - inline ::capnp::List< ::capnp::schema::Node>::Builder initNodes(unsigned int size); - inline void adoptNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> disownNodes(); - - inline bool hasRequestedFiles(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder getRequestedFiles(); - inline void setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder initRequestedFiles(unsigned int size); - inline void adoptRequestedFiles(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> disownRequestedFiles(); - - inline bool hasCapnpVersion(); - inline ::capnp::schema::CapnpVersion::Builder getCapnpVersion(); - inline void setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value); - inline ::capnp::schema::CapnpVersion::Builder initCapnpVersion(); - inline void adoptCapnpVersion(::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value); - inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> disownCapnpVersion(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::Pipeline { -public: - typedef CodeGeneratorRequest Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::CapnpVersion::Pipeline getCapnpVersion(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Reader { -public: - typedef RequestedFile Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasFilename() const; - inline ::capnp::Text::Reader getFilename() const; - - inline bool hasImports() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader getImports() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Builder { -public: - typedef RequestedFile Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasFilename(); - inline ::capnp::Text::Builder getFilename(); - inline void setFilename( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFilename(unsigned int size); - inline void adoptFilename(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFilename(); - - inline bool hasImports(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder getImports(); - inline void setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder initImports(unsigned int size); - inline void adoptImports(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> disownImports(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Pipeline { -public: - typedef RequestedFile Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Import::Reader { -public: - typedef Import Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Import::Builder { -public: - typedef Import Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Import::Pipeline { -public: - typedef Import Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::schema::Node::Which Node::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Node::Which Node::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasDisplayName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasDisplayName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Reader::getDisplayName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Builder::getDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setDisplayName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Builder::initDisplayName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptDisplayName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Builder::disownDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Node::Reader::getDisplayNamePrefixLength() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Builder::getDisplayNamePrefixLength() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setDisplayNamePrefixLength( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Node::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasNestedNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasNestedNodes() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader Node::Reader::getNestedNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::getNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::initNestedNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptNestedNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> Node::Builder::disownNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Node::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Node::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::isFile() const { - return which() == Node::FILE; -} -inline bool Node::Builder::isFile() { - return which() == Node::FILE; -} -inline ::capnp::Void Node::Reader::getFile() const { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Node::Builder::getFile() { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setFile( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::FILE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::isStruct() const { - return which() == Node::STRUCT; -} -inline bool Node::Builder::isStruct() { - return which() == Node::STRUCT; -} -inline typename Node::Struct::Reader Node::Reader::getStruct() const { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Reader(_reader); -} -inline typename Node::Struct::Builder Node::Builder::getStruct() { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Builder(_builder); -} -inline typename Node::Struct::Builder Node::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::STRUCT); - _builder.setDataField< ::uint16_t>(::capnp::bounded<7>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<12>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<13>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<224>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<15>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint32_t>(::capnp::bounded<8>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Struct::Builder(_builder); -} -inline bool Node::Reader::isEnum() const { - return which() == Node::ENUM; -} -inline bool Node::Builder::isEnum() { - return which() == Node::ENUM; -} -inline typename Node::Enum::Reader Node::Reader::getEnum() const { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Reader(_reader); -} -inline typename Node::Enum::Builder Node::Builder::getEnum() { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Builder(_builder); -} -inline typename Node::Enum::Builder Node::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ENUM); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Enum::Builder(_builder); -} -inline bool Node::Reader::isInterface() const { - return which() == Node::INTERFACE; -} -inline bool Node::Builder::isInterface() { - return which() == Node::INTERFACE; -} -inline typename Node::Interface::Reader Node::Reader::getInterface() const { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Reader(_reader); -} -inline typename Node::Interface::Builder Node::Builder::getInterface() { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Builder(_builder); -} -inline typename Node::Interface::Builder Node::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::INTERFACE); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Interface::Builder(_builder); -} -inline bool Node::Reader::isConst() const { - return which() == Node::CONST; -} -inline bool Node::Builder::isConst() { - return which() == Node::CONST; -} -inline typename Node::Const::Reader Node::Reader::getConst() const { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Reader(_reader); -} -inline typename Node::Const::Builder Node::Builder::getConst() { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Builder(_builder); -} -inline typename Node::Const::Builder Node::Builder::initConst() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::CONST); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Const::Builder(_builder); -} -inline bool Node::Reader::isAnnotation() const { - return which() == Node::ANNOTATION; -} -inline bool Node::Builder::isAnnotation() { - return which() == Node::ANNOTATION; -} -inline typename Node::Annotation::Reader Node::Reader::getAnnotation() const { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Reader(_reader); -} -inline typename Node::Annotation::Builder Node::Builder::getAnnotation() { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Builder(_builder); -} -inline typename Node::Annotation::Builder Node::Builder::initAnnotation() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ANNOTATION); - _builder.setDataField(::capnp::bounded<112>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<113>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<114>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<115>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<116>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<117>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<118>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<119>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<120>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<121>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<122>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<123>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Annotation::Builder(_builder); -} -inline bool Node::Reader::hasParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasParameters() { - return !_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Node::Reader::getParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::getParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::initParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Node::Builder::disownParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::getIsGeneric() const { - return _reader.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} - -inline bool Node::Builder::getIsGeneric() { - return _builder.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setIsGeneric(bool value) { - _builder.setDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Parameter::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Parameter::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Parameter::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Parameter::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Parameter::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Parameter::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Node::NestedNode::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::NestedNode::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::NestedNode::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::NestedNode::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::NestedNode::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::NestedNode::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Node::NestedNode::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::NestedNode::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::NestedNode::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDataWordCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDataWordCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDataWordCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getPointerCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getPointerCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPointerCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::ElementSize Node::Struct::Reader::getPreferredListEncoding() const { - return _reader.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} - -inline ::capnp::schema::ElementSize Node::Struct::Builder::getPreferredListEncoding() { - return _builder.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPreferredListEncoding( ::capnp::schema::ElementSize value) { - _builder.setDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::getIsGroup() const { - return _reader.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} - -inline bool Node::Struct::Builder::getIsGroup() { - return _builder.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setIsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDiscriminantCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDiscriminantCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Node::Struct::Reader::getDiscriminantOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Struct::Builder::getDiscriminantOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::hasFields() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Struct::Builder::hasFields() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Field>::Reader Node::Struct::Reader::getFields() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::getFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Struct::Builder::setFields( ::capnp::List< ::capnp::schema::Field>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::initFields(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Struct::Builder::adoptFields( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> Node::Struct::Builder::disownFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Enum::Reader::hasEnumerants() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Enum::Builder::hasEnumerants() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Reader Node::Enum::Reader::getEnumerants() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::getEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Enum::Builder::setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::initEnumerants(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Enum::Builder::adoptEnumerants( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> Node::Enum::Builder::disownEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasMethods() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasMethods() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Method>::Reader Node::Interface::Reader::getMethods() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::getMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::initMethods(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptMethods( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> Node::Interface::Builder::disownMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasSuperclasses() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasSuperclasses() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Reader Node::Interface::Reader::getSuperclasses() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::getSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::initSuperclasses(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptSuperclasses( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> Node::Interface::Builder::disownSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Const::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Const::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Const::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Node::Const::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Node::Const::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(4)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Node::Const::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Annotation::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Annotation::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Annotation::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Annotation::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Annotation::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Annotation::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::getTargetsFile() const { - return _reader.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsFile() { - return _builder.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsFile(bool value) { - _builder.setDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsConst() const { - return _reader.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsConst() { - return _builder.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsConst(bool value) { - _builder.setDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnum() const { - return _reader.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnum() { - return _builder.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnum(bool value) { - _builder.setDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnumerant() const { - return _reader.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnumerant() { - return _builder.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnumerant(bool value) { - _builder.setDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsStruct() const { - return _reader.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsStruct() { - return _builder.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsStruct(bool value) { - _builder.setDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsField() const { - return _reader.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsField() { - return _builder.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsField(bool value) { - _builder.setDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsUnion() const { - return _reader.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsUnion() { - return _builder.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsUnion(bool value) { - _builder.setDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsGroup() const { - return _reader.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsGroup() { - return _builder.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsInterface() const { - return _reader.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsInterface() { - return _builder.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsInterface(bool value) { - _builder.setDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsMethod() const { - return _reader.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsMethod() { - return _builder.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsMethod(bool value) { - _builder.setDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsParam() const { - return _reader.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsParam() { - return _builder.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsParam(bool value) { - _builder.setDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsAnnotation() const { - return _reader.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsAnnotation() { - return _builder.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsAnnotation(bool value) { - _builder.setDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Which Field::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Which Field::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Field::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Field::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getDiscriminantValue() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} - -inline ::uint16_t Field::Builder::getDiscriminantValue() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} -inline void Field::Builder::setDiscriminantValue( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value, 65535u); -} - -inline bool Field::Reader::isSlot() const { - return which() == Field::SLOT; -} -inline bool Field::Builder::isSlot() { - return which() == Field::SLOT; -} -inline typename Field::Slot::Reader Field::Reader::getSlot() const { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Reader(_reader); -} -inline typename Field::Slot::Builder Field::Builder::getSlot() { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Builder(_builder); -} -inline typename Field::Slot::Builder Field::Builder::initSlot() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::SLOT); - _builder.setDataField< ::uint32_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<128>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Field::Slot::Builder(_builder); -} -inline bool Field::Reader::isGroup() const { - return which() == Field::GROUP; -} -inline bool Field::Builder::isGroup() { - return which() == Field::GROUP; -} -inline typename Field::Group::Reader Field::Reader::getGroup() const { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Reader(_reader); -} -inline typename Field::Group::Builder Field::Builder::getGroup() { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Group::Builder Field::Builder::initGroup() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::GROUP); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Ordinal::Reader Field::Reader::getOrdinal() const { - return typename Field::Ordinal::Reader(_reader); -} -inline typename Field::Ordinal::Builder Field::Builder::getOrdinal() { - return typename Field::Ordinal::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Field::Ordinal::Pipeline Field::Pipeline::getOrdinal() { - return typename Field::Ordinal::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Field::Ordinal::Builder Field::Builder::initOrdinal() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); - return typename Field::Ordinal::Builder(_builder); -} -inline ::uint32_t Field::Slot::Reader::getOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Field::Slot::Builder::getOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Slot::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Field::Slot::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Field::Slot::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Field::Slot::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::hasDefaultValue() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasDefaultValue() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Field::Slot::Reader::getDefaultValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::getDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Field::Slot::Pipeline::getDefaultValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setDefaultValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::initDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptDefaultValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Field::Slot::Builder::disownDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::getHadExplicitDefault() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Field::Slot::Builder::getHadExplicitDefault() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setHadExplicitDefault(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Field::Group::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Field::Group::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Field::Group::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Field::Ordinal::Reader::isImplicit() const { - return which() == Field::Ordinal::IMPLICIT; -} -inline bool Field::Ordinal::Builder::isImplicit() { - return which() == Field::Ordinal::IMPLICIT; -} -inline ::capnp::Void Field::Ordinal::Reader::getImplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Field::Ordinal::Builder::getImplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setImplicit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::IMPLICIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Ordinal::Reader::isExplicit() const { - return which() == Field::Ordinal::EXPLICIT; -} -inline bool Field::Ordinal::Builder::isExplicit() { - return which() == Field::Ordinal::EXPLICIT; -} -inline ::uint16_t Field::Ordinal::Reader::getExplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Ordinal::Builder::getExplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setExplicit( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::EXPLICIT); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Enumerant::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Enumerant::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Enumerant::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Enumerant::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Enumerant::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Enumerant::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Enumerant::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Enumerant::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Enumerant::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Superclass::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Superclass::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Superclass::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Superclass::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Superclass::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Superclass::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Superclass::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Superclass::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Superclass::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Superclass::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Method::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Method::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Method::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Method::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Method::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Method::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getParamStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getParamStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setParamStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getResultStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getResultStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setResultStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Method::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Method::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Method::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasParamBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasParamBrand() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getParamBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getParamBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setParamBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptParamBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasResultBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasResultBrand() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getResultBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getResultBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setResultBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptResultBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasImplicitParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasImplicitParameters() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Method::Reader::getImplicitParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::getImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::initImplicitParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptImplicitParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Method::Builder::disownImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::Which Type::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::Which Type::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Type::Reader::isVoid() const { - return which() == Type::VOID; -} -inline bool Type::Builder::isVoid() { - return which() == Type::VOID; -} -inline ::capnp::Void Type::Reader::getVoid() const { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getVoid() { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isBool() const { - return which() == Type::BOOL; -} -inline bool Type::Builder::isBool() { - return which() == Type::BOOL; -} -inline ::capnp::Void Type::Reader::getBool() const { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getBool() { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setBool( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::BOOL); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt8() const { - return which() == Type::INT8; -} -inline bool Type::Builder::isInt8() { - return which() == Type::INT8; -} -inline ::capnp::Void Type::Reader::getInt8() const { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt8() { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt16() const { - return which() == Type::INT16; -} -inline bool Type::Builder::isInt16() { - return which() == Type::INT16; -} -inline ::capnp::Void Type::Reader::getInt16() const { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt16() { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt32() const { - return which() == Type::INT32; -} -inline bool Type::Builder::isInt32() { - return which() == Type::INT32; -} -inline ::capnp::Void Type::Reader::getInt32() const { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt32() { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt64() const { - return which() == Type::INT64; -} -inline bool Type::Builder::isInt64() { - return which() == Type::INT64; -} -inline ::capnp::Void Type::Reader::getInt64() const { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt64() { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint8() const { - return which() == Type::UINT8; -} -inline bool Type::Builder::isUint8() { - return which() == Type::UINT8; -} -inline ::capnp::Void Type::Reader::getUint8() const { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint8() { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint16() const { - return which() == Type::UINT16; -} -inline bool Type::Builder::isUint16() { - return which() == Type::UINT16; -} -inline ::capnp::Void Type::Reader::getUint16() const { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint16() { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint32() const { - return which() == Type::UINT32; -} -inline bool Type::Builder::isUint32() { - return which() == Type::UINT32; -} -inline ::capnp::Void Type::Reader::getUint32() const { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint32() { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint64() const { - return which() == Type::UINT64; -} -inline bool Type::Builder::isUint64() { - return which() == Type::UINT64; -} -inline ::capnp::Void Type::Reader::getUint64() const { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint64() { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat32() const { - return which() == Type::FLOAT32; -} -inline bool Type::Builder::isFloat32() { - return which() == Type::FLOAT32; -} -inline ::capnp::Void Type::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat32() { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat64() const { - return which() == Type::FLOAT64; -} -inline bool Type::Builder::isFloat64() { - return which() == Type::FLOAT64; -} -inline ::capnp::Void Type::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat64() { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isText() const { - return which() == Type::TEXT; -} -inline bool Type::Builder::isText() { - return which() == Type::TEXT; -} -inline ::capnp::Void Type::Reader::getText() const { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getText() { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setText( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::TEXT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isData() const { - return which() == Type::DATA; -} -inline bool Type::Builder::isData() { - return which() == Type::DATA; -} -inline ::capnp::Void Type::Reader::getData() const { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getData() { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setData( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::DATA); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isList() const { - return which() == Type::LIST; -} -inline bool Type::Builder::isList() { - return which() == Type::LIST; -} -inline typename Type::List::Reader Type::Reader::getList() const { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Reader(_reader); -} -inline typename Type::List::Builder Type::Builder::getList() { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Builder(_builder); -} -inline typename Type::List::Builder Type::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::LIST); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::List::Builder(_builder); -} -inline bool Type::Reader::isEnum() const { - return which() == Type::ENUM; -} -inline bool Type::Builder::isEnum() { - return which() == Type::ENUM; -} -inline typename Type::Enum::Reader Type::Reader::getEnum() const { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Reader(_reader); -} -inline typename Type::Enum::Builder Type::Builder::getEnum() { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Builder(_builder); -} -inline typename Type::Enum::Builder Type::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ENUM); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Enum::Builder(_builder); -} -inline bool Type::Reader::isStruct() const { - return which() == Type::STRUCT; -} -inline bool Type::Builder::isStruct() { - return which() == Type::STRUCT; -} -inline typename Type::Struct::Reader Type::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Reader(_reader); -} -inline typename Type::Struct::Builder Type::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Builder(_builder); -} -inline typename Type::Struct::Builder Type::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::STRUCT); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Struct::Builder(_builder); -} -inline bool Type::Reader::isInterface() const { - return which() == Type::INTERFACE; -} -inline bool Type::Builder::isInterface() { - return which() == Type::INTERFACE; -} -inline typename Type::Interface::Reader Type::Reader::getInterface() const { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Reader(_reader); -} -inline typename Type::Interface::Builder Type::Builder::getInterface() { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Builder(_builder); -} -inline typename Type::Interface::Builder Type::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INTERFACE); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Interface::Builder(_builder); -} -inline bool Type::Reader::isAnyPointer() const { - return which() == Type::ANY_POINTER; -} -inline bool Type::Builder::isAnyPointer() { - return which() == Type::ANY_POINTER; -} -inline typename Type::AnyPointer::Reader Type::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Reader(_reader); -} -inline typename Type::AnyPointer::Builder Type::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Builder(_builder); -} -inline typename Type::AnyPointer::Builder Type::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ANY_POINTER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<4>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Builder(_builder); -} -inline bool Type::List::Reader::hasElementType() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::List::Builder::hasElementType() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Type::List::Reader::getElementType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::getElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Type::List::Pipeline::getElementType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::List::Builder::setElementType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::initElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::List::Builder::adoptElementType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Type::List::Builder::disownElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Enum::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Enum::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Enum::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Enum::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Enum::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Enum::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Enum::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Enum::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Enum::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Enum::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Struct::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Struct::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Struct::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Struct::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Struct::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Struct::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Struct::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Struct::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Struct::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Struct::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Interface::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Interface::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Interface::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Interface::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Interface::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Interface::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Interface::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Interface::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Interface::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Interface::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Reader::isUnconstrained() const { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline bool Type::AnyPointer::Builder::isUnconstrained() { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline typename Type::AnyPointer::Unconstrained::Reader Type::AnyPointer::Reader::getUnconstrained() const { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Reader(_reader); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::getUnconstrained() { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::initUnconstrained() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::UNCONSTRAINED); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isParameter() const { - return which() == Type::AnyPointer::PARAMETER; -} -inline bool Type::AnyPointer::Builder::isParameter() { - return which() == Type::AnyPointer::PARAMETER; -} -inline typename Type::AnyPointer::Parameter::Reader Type::AnyPointer::Reader::getParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Reader(_reader); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::getParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::initParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isImplicitMethodParameter() const { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline bool Type::AnyPointer::Builder::isImplicitMethodParameter() { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Reader Type::AnyPointer::Reader::getImplicitMethodParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Reader(_reader); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::getImplicitMethodParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::initImplicitMethodParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::IMPLICIT_METHOD_PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isAnyKind() const { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isAnyKind() { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getAnyKind() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getAnyKind() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setAnyKind( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::ANY_KIND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isStruct() const { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isStruct() { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setStruct( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::STRUCT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isList() const { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isList() { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getList() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getList() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setList( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::LIST); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isCapability() const { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isCapability() { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getCapability() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getCapability() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setCapability( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::CAPABILITY); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::ImplicitMethodParameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Reader::hasScopes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Builder::hasScopes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader Brand::Reader::getScopes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::getScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Builder::setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::initScopes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Builder::adoptScopes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> Brand::Builder::disownScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Scope::Reader::isBind() const { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Builder::isBind() { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Reader::hasBind() const { - if (which() != Brand::Scope::BIND) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Scope::Builder::hasBind() { - if (which() != Brand::Scope::BIND) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader Brand::Scope::Reader::getBind() const { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::getBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Scope::Builder::setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::initBind(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Scope::Builder::adoptBind( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> Brand::Scope::Builder::disownBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Brand::Scope::Reader::isInherit() const { - return which() == Brand::Scope::INHERIT; -} -inline bool Brand::Scope::Builder::isInherit() { - return which() == Brand::Scope::INHERIT; -} -inline ::capnp::Void Brand::Scope::Reader::getInherit() const { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Scope::Builder::getInherit() { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setInherit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::INHERIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Brand::Binding::Reader::isUnbound() const { - return which() == Brand::Binding::UNBOUND; -} -inline bool Brand::Binding::Builder::isUnbound() { - return which() == Brand::Binding::UNBOUND; -} -inline ::capnp::Void Brand::Binding::Reader::getUnbound() const { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Binding::Builder::getUnbound() { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Binding::Builder::setUnbound( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::UNBOUND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Binding::Reader::isType() const { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Builder::isType() { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Reader::hasType() const { - if (which() != Brand::Binding::TYPE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Binding::Builder::hasType() { - if (which() != Brand::Binding::TYPE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Brand::Binding::Reader::getType() const { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::getType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::setType( ::capnp::schema::Type::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::initType() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Brand::Binding::Builder::disownType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Value::Which Value::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Value::Which Value::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Value::Reader::isVoid() const { - return which() == Value::VOID; -} -inline bool Value::Builder::isVoid() { - return which() == Value::VOID; -} -inline ::capnp::Void Value::Reader::getVoid() const { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getVoid() { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isBool() const { - return which() == Value::BOOL; -} -inline bool Value::Builder::isBool() { - return which() == Value::BOOL; -} -inline bool Value::Reader::getBool() const { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool Value::Builder::getBool() { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setBool(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::BOOL); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt8() const { - return which() == Value::INT8; -} -inline bool Value::Builder::isInt8() { - return which() == Value::INT8; -} -inline ::int8_t Value::Reader::getInt8() const { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::int8_t Value::Builder::getInt8() { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt8( ::int8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT8); - _builder.setDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt16() const { - return which() == Value::INT16; -} -inline bool Value::Builder::isInt16() { - return which() == Value::INT16; -} -inline ::int16_t Value::Reader::getInt16() const { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int16_t Value::Builder::getInt16() { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt16( ::int16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT16); - _builder.setDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt32() const { - return which() == Value::INT32; -} -inline bool Value::Builder::isInt32() { - return which() == Value::INT32; -} -inline ::int32_t Value::Reader::getInt32() const { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int32_t Value::Builder::getInt32() { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt32( ::int32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT32); - _builder.setDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt64() const { - return which() == Value::INT64; -} -inline bool Value::Builder::isInt64() { - return which() == Value::INT64; -} -inline ::int64_t Value::Reader::getInt64() const { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int64_t Value::Builder::getInt64() { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt64( ::int64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT64); - _builder.setDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint8() const { - return which() == Value::UINT8; -} -inline bool Value::Builder::isUint8() { - return which() == Value::UINT8; -} -inline ::uint8_t Value::Reader::getUint8() const { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t Value::Builder::getUint8() { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint8( ::uint8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT8); - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint16() const { - return which() == Value::UINT16; -} -inline bool Value::Builder::isUint16() { - return which() == Value::UINT16; -} -inline ::uint16_t Value::Reader::getUint16() const { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getUint16() { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint16( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT16); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint32() const { - return which() == Value::UINT32; -} -inline bool Value::Builder::isUint32() { - return which() == Value::UINT32; -} -inline ::uint32_t Value::Reader::getUint32() const { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Value::Builder::getUint32() { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint32( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT32); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint64() const { - return which() == Value::UINT64; -} -inline bool Value::Builder::isUint64() { - return which() == Value::UINT64; -} -inline ::uint64_t Value::Reader::getUint64() const { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Value::Builder::getUint64() { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint64( ::uint64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT64); - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat32() const { - return which() == Value::FLOAT32; -} -inline bool Value::Builder::isFloat32() { - return which() == Value::FLOAT32; -} -inline float Value::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline float Value::Builder::getFloat32() { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat32(float value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT32); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat64() const { - return which() == Value::FLOAT64; -} -inline bool Value::Builder::isFloat64() { - return which() == Value::FLOAT64; -} -inline double Value::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double Value::Builder::getFloat64() { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat64(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT64); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isText() const { - return which() == Value::TEXT; -} -inline bool Value::Builder::isText() { - return which() == Value::TEXT; -} -inline bool Value::Reader::hasText() const { - if (which() != Value::TEXT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasText() { - if (which() != Value::TEXT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Value::Reader::getText() const { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Value::Builder::getText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setText( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Value::Builder::initText(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptText( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Value::Builder::disownText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isData() const { - return which() == Value::DATA; -} -inline bool Value::Builder::isData() { - return which() == Value::DATA; -} -inline bool Value::Reader::hasData() const { - if (which() != Value::DATA) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasData() { - if (which() != Value::DATA) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Data::Reader Value::Reader::getData() const { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Data::Builder Value::Builder::getData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setData( ::capnp::Data::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Data::Builder Value::Builder::initData(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - return ::capnp::_::PointerHelpers< ::capnp::Data>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptData( - ::capnp::Orphan< ::capnp::Data>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Data> Value::Builder::disownData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isList() const { - return which() == Value::LIST; -} -inline bool Value::Builder::isList() { - return which() == Value::LIST; -} -inline bool Value::Reader::hasList() const { - if (which() != Value::LIST) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasList() { - if (which() != Value::LIST) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getList() const { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getList() { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::LIST); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isEnum() const { - return which() == Value::ENUM; -} -inline bool Value::Builder::isEnum() { - return which() == Value::ENUM; -} -inline ::uint16_t Value::Reader::getEnum() const { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getEnum() { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setEnum( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ENUM); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isStruct() const { - return which() == Value::STRUCT; -} -inline bool Value::Builder::isStruct() { - return which() == Value::STRUCT; -} -inline bool Value::Reader::hasStruct() const { - if (which() != Value::STRUCT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasStruct() { - if (which() != Value::STRUCT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getStruct() const { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getStruct() { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::STRUCT); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isInterface() const { - return which() == Value::INTERFACE; -} -inline bool Value::Builder::isInterface() { - return which() == Value::INTERFACE; -} -inline ::capnp::Void Value::Reader::getInterface() const { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getInterface() { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInterface( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INTERFACE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isAnyPointer() const { - return which() == Value::ANY_POINTER; -} -inline bool Value::Builder::isAnyPointer() { - return which() == Value::ANY_POINTER; -} -inline bool Value::Reader::hasAnyPointer() const { - if (which() != Value::ANY_POINTER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasAnyPointer() { - if (which() != Value::ANY_POINTER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ANY_POINTER); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint64_t Annotation::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Annotation::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Annotation::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Annotation::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Annotation::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Annotation::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Annotation::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Annotation::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Annotation::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Annotation::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Annotation::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t CapnpVersion::Reader::getMajor() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t CapnpVersion::Builder::getMajor() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMajor( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMinor() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMinor() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMinor( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMicro() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMicro() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMicro( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::Reader::hasNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasNodes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node>::Reader CodeGeneratorRequest::Reader::getNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::getNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::initNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> CodeGeneratorRequest::Builder::disownNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasRequestedFiles() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasRequestedFiles() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader CodeGeneratorRequest::Reader::getRequestedFiles() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::getRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::initRequestedFiles(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptRequestedFiles( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> CodeGeneratorRequest::Builder::disownRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasCapnpVersion() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasCapnpVersion() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::CapnpVersion::Reader CodeGeneratorRequest::Reader::getCapnpVersion() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::getCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::CapnpVersion::Pipeline CodeGeneratorRequest::Pipeline::getCapnpVersion() { - return ::capnp::schema::CapnpVersion::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void CodeGeneratorRequest::Builder::setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::initCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::adoptCapnpVersion( - ::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> CodeGeneratorRequest::Builder::disownCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasFilename() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasFilename() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Reader::getFilename() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::getFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setFilename( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::initFilename(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptFilename( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Builder::disownFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasImports() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasImports() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader CodeGeneratorRequest::RequestedFile::Reader::getImports() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::getImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::initImports(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptImports( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> CodeGeneratorRequest::RequestedFile::Builder::disownImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Import::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Import::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Import::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Import::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a93fc509624c72d9_ diff --git a/phonelibs/capnp-cpp/include/capnp/schema.h b/phonelibs/capnp-cpp/include/capnp/schema.h deleted file mode 100644 index d59fa75236..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/schema.h +++ /dev/null @@ -1,934 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_H_ -#define CAPNP_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "Reflection APIs, including this header, are not available in lite mode." -#endif - -#include - -namespace capnp { - -class Schema; -class StructSchema; -class EnumSchema; -class InterfaceSchema; -class ConstSchema; -class ListSchema; -class Type; - -template ()> struct SchemaType_ { typedef Schema Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef EnumSchema Type; }; -template struct SchemaType_ { typedef StructSchema Type; }; -template struct SchemaType_ { typedef InterfaceSchema Type; }; -template struct SchemaType_ { typedef ListSchema Type; }; - -template -using SchemaType = typename SchemaType_::Type; -// SchemaType is the type of T's schema, e.g. StructSchema if T is a struct. - -namespace _ { // private -extern const RawSchema NULL_SCHEMA; -extern const RawSchema NULL_STRUCT_SCHEMA; -extern const RawSchema NULL_ENUM_SCHEMA; -extern const RawSchema NULL_INTERFACE_SCHEMA; -extern const RawSchema NULL_CONST_SCHEMA; -// The schema types default to these null (empty) schemas in case of error, especially when -// exceptions are disabled. -} // namespace _ (private) - -class Schema { - // Convenience wrapper around capnp::schema::Node. - -public: - inline Schema(): raw(&_::NULL_SCHEMA.defaultBrand) {} - - template - static inline SchemaType from() { return SchemaType::template fromImpl(); } - // Get the Schema for a particular compiled-in type. - - schema::Node::Reader getProto() const; - // Get the underlying Cap'n Proto representation of the schema node. (Note that this accessor - // has performance comparable to accessors of struct-typed fields on Reader classes.) - - kj::ArrayPtr asUncheckedMessage() const; - // Get the encoded schema node content as a single message segment. It is safe to read as an - // unchecked message. - - Schema getDependency(uint64_t id) const KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the dependency. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Gets the Schema for one of this Schema's dependencies. For example, if this Schema is for a - // struct, you could look up the schema for one of its fields' types. Throws an exception if this - // schema doesn't actually depend on the given id. - // - // Note that not all type IDs found in the schema node are considered "dependencies" -- only the - // ones that are needed to implement the dynamic API are. That includes: - // - Field types. - // - Group types. - // - scopeId for group nodes, but NOT otherwise. - // - Method parameter and return types. - // - // The following are NOT considered dependencies: - // - Nested nodes. - // - scopeId for a non-group node. - // - Annotations. - // - // To obtain schemas for those, you would need a SchemaLoader. - - bool isBranded() const; - // Returns true if this schema represents a non-default parameterization of this type. - - Schema getGeneric() const; - // Get the version of this schema with any brands removed. - - class BrandArgumentList; - BrandArgumentList getBrandArgumentsAtScope(uint64_t scopeId) const; - // Gets the values bound to the brand parameters at the given scope. - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ConstSchema asConst() const; - // Cast the Schema to a specific type. Throws an exception if the type doesn't match. Use - // getProto() to determine type, e.g. getProto().isStruct(). - - inline bool operator==(const Schema& other) const { return raw == other.raw; } - inline bool operator!=(const Schema& other) const { return raw != other.raw; } - // Determine whether two Schemas are wrapping the exact same underlying data, by identity. If - // you want to check if two Schemas represent the same type (but possibly different versions of - // it), compare their IDs instead. - - template - void requireUsableAs() const; - // Throws an exception if a value with this Schema cannot safely be cast to a native value of - // the given type. This passes if either: - // - *this == from() - // - This schema was loaded with SchemaLoader, the type ID matches typeId(), and - // loadCompiledTypeAndDependencies() was called on the SchemaLoader. - - kj::StringPtr getShortDisplayName() const; - // Get the short version of the node's display name. - -private: - const _::RawBrandedSchema* raw; - - inline explicit Schema(const _::RawBrandedSchema* raw): raw(raw) { - KJ_IREQUIRE(raw->lazyInitializer == nullptr, - "Must call ensureInitialized() on RawSchema before constructing Schema."); - } - - template static inline Schema fromImpl() { - return Schema(&_::rawSchema()); - } - - void requireUsableAs(const _::RawSchema* expected) const; - - uint32_t getSchemaOffset(const schema::Value::Reader& value) const; - - Type getBrandBinding(uint64_t scopeId, uint index) const; - // Look up the binding for a brand parameter used by this Schema. Returns `AnyPointer` if the - // parameter is not bound. - // - // TODO(someday): Public interface for iterating over all bindings? - - Schema getDependency(uint64_t id, uint location) const; - // Look up schema for a particular dependency of this schema. `location` is the dependency - // location number as defined in _::RawBrandedSchema. - - Type interpretType(schema::Type::Reader proto, uint location) const; - // Interpret a schema::Type in the given location within the schema, compiling it into a - // Type object. - - friend class StructSchema; - friend class EnumSchema; - friend class InterfaceSchema; - friend class ConstSchema; - friend class ListSchema; - friend class SchemaLoader; - friend class Type; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend kj::String _::enumString(uint16_t value, const _::RawBrandedSchema& schema); -}; - -kj::StringPtr KJ_STRINGIFY(const Schema& schema); - -class Schema::BrandArgumentList { - // A list of generic parameter bindings for parameters of some particular type. Note that since - // parameters on an outer type apply to all inner types as well, a deeply-nested type can have - // multiple BrandArgumentLists that apply to it. - // - // A BrandArgumentList only represents the arguments that the client of the type specified. Since - // new parameters can be added over time, this list may not cover all defined parameters for the - // type. Missing parameters should be treated as AnyPointer. This class's implementation of - // operator[] already does this for you; out-of-bounds access will safely return AnyPointer. - -public: - inline BrandArgumentList(): scopeId(0), size_(0), bindings(nullptr) {} - - inline uint size() const { return size_; } - Type operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - uint64_t scopeId; - uint size_; - bool isUnbound; - const _::RawBrandedSchema::Binding* bindings; - - inline BrandArgumentList(uint64_t scopeId, bool isUnbound) - : scopeId(scopeId), size_(0), isUnbound(isUnbound), bindings(nullptr) {} - inline BrandArgumentList(uint64_t scopeId, uint size, - const _::RawBrandedSchema::Binding* bindings) - : scopeId(scopeId), size_(size), isUnbound(false), bindings(bindings) {} - - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class StructSchema: public Schema { -public: - inline StructSchema(): Schema(&_::NULL_STRUCT_SCHEMA.defaultBrand) {} - - class Field; - class FieldList; - class FieldSubset; - - FieldList getFields() const; - // List top-level fields of this struct. This list will contain top-level groups (including - // named unions) but not the members of those groups. The list does, however, contain the - // members of the unnamed union, if there is one. - - FieldSubset getUnionFields() const; - // If the field contains an unnamed union, get a list of fields in the union, ordered by - // ordinal. Since discriminant values are assigned sequentially by ordinal, you may index this - // list by discriminant value. - - FieldSubset getNonUnionFields() const; - // Get the fields of this struct which are not in an unnamed union, ordered by ordinal. - - kj::Maybe findFieldByName(kj::StringPtr name) const; - // Find the field with the given name, or return null if there is no such field. If the struct - // contains an unnamed union, then this will find fields of that union in addition to fields - // of the outer struct, since they exist in the same namespace. It will not, however, find - // members of groups (including named unions) -- you must first look up the group itself, - // then dig into its type. - - Field getFieldByName(kj::StringPtr name) const; - // Like findFieldByName() but throws an exception on failure. - - kj::Maybe getFieldByDiscriminant(uint16_t discriminant) const; - // Finds the field whose `discriminantValue` is equal to the given value, or returns null if - // there is no such field. (If the schema does not represent a union or a struct containing - // an unnamed union, then this always returns null.) - -private: - StructSchema(Schema base): Schema(base) {} - template static inline StructSchema fromImpl() { - return StructSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class StructSchema::Field { -public: - Field() = default; - - inline schema::Field::Reader getProto() const { return proto; } - inline StructSchema getContainingStruct() const { return parent; } - - inline uint getIndex() const { return index; } - // Get the index of this field within the containing struct or union. - - Type getType() const; - // Get the type of this field. Note that this is preferred over getProto().getType() as this - // method will apply generics. - - uint32_t getDefaultValueSchemaOffset() const; - // For struct, list, and object fields, returns the offset, in words, within the first segment of - // the struct's schema, where this field's default value pointer is located. The schema is - // always stored as a single-segment unchecked message, which in turn means that the default - // value pointer itself can be treated as the root of an unchecked message -- if you know where - // to find it, which is what this method helps you with. - // - // For blobs, returns the offset of the beginning of the blob's content within the first segment - // of the struct's schema. - // - // This is primarily useful for code generators. The C++ code generator, for example, embeds - // the entire schema as a raw word array within the generated code. Of course, to implement - // field accessors, it needs access to those fields' default values. Embedding separate copies - // of those default values would be redundant since they are already included in the schema, but - // seeking through the schema at runtime to find the default values would be ugly. Instead, - // the code generator can use getDefaultValueSchemaOffset() to find the offset of the default - // value within the schema, and can simply apply that offset at runtime. - // - // If the above does not make sense, you probably don't need this method. - - inline bool operator==(const Field& other) const; - inline bool operator!=(const Field& other) const { return !(*this == other); } - -private: - StructSchema parent; - uint index; - schema::Field::Reader proto; - - inline Field(StructSchema parent, uint index, schema::Field::Reader proto) - : parent(parent), index(index), proto(proto) {} - - friend class StructSchema; -}; - -kj::StringPtr KJ_STRINGIFY(const StructSchema::Field& field); - -class StructSchema::FieldList { -public: - FieldList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Field operator[](uint index) const { return Field(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - - inline FieldList(StructSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class StructSchema; -}; - -class StructSchema::FieldSubset { -public: - FieldSubset() = default; // empty list - - inline uint size() const { return size_; } - inline Field operator[](uint index) const { - return Field(parent, indices[index], list[indices[index]]); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - const uint16_t* indices; - uint size_; - - inline FieldSubset(StructSchema parent, List::Reader list, - const uint16_t* indices, uint size) - : parent(parent), list(list), indices(indices), size_(size) {} - - friend class StructSchema; -}; - -// ------------------------------------------------------------------- - -class EnumSchema: public Schema { -public: - inline EnumSchema(): Schema(&_::NULL_ENUM_SCHEMA.defaultBrand) {} - - class Enumerant; - class EnumerantList; - - EnumerantList getEnumerants() const; - - kj::Maybe findEnumerantByName(kj::StringPtr name) const; - - Enumerant getEnumerantByName(kj::StringPtr name) const; - // Like findEnumerantByName() but throws an exception on failure. - -private: - EnumSchema(Schema base): Schema(base) {} - template static inline EnumSchema fromImpl() { - return EnumSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class EnumSchema::Enumerant { -public: - Enumerant() = default; - - inline schema::Enumerant::Reader getProto() const { return proto; } - inline EnumSchema getContainingEnum() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - inline bool operator==(const Enumerant& other) const; - inline bool operator!=(const Enumerant& other) const { return !(*this == other); } - -private: - EnumSchema parent; - uint16_t ordinal; - schema::Enumerant::Reader proto; - - inline Enumerant(EnumSchema parent, uint16_t ordinal, schema::Enumerant::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class EnumSchema; -}; - -class EnumSchema::EnumerantList { -public: - EnumerantList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Enumerant operator[](uint index) const { return Enumerant(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - EnumSchema parent; - List::Reader list; - - inline EnumerantList(EnumSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class EnumSchema; -}; - -// ------------------------------------------------------------------- - -class InterfaceSchema: public Schema { -public: - inline InterfaceSchema(): Schema(&_::NULL_INTERFACE_SCHEMA.defaultBrand) {} - - class Method; - class MethodList; - - MethodList getMethods() const; - - kj::Maybe findMethodByName(kj::StringPtr name) const; - - Method getMethodByName(kj::StringPtr name) const; - // Like findMethodByName() but throws an exception on failure. - - class SuperclassList; - - SuperclassList getSuperclasses() const; - // Get the immediate superclasses of this type, after applying generics. - - bool extends(InterfaceSchema other) const; - // Returns true if `other` is a superclass of this interface (including if `other == *this`). - - kj::Maybe findSuperclass(uint64_t typeId) const; - // Find the superclass of this interface with the given type ID. Returns null if the interface - // extends no such type. - -private: - InterfaceSchema(Schema base): Schema(base) {} - template static inline InterfaceSchema fromImpl() { - return InterfaceSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; - - kj::Maybe findMethodByName(kj::StringPtr name, uint& counter) const; - bool extends(InterfaceSchema other, uint& counter) const; - kj::Maybe findSuperclass(uint64_t typeId, uint& counter) const; - // We protect against malicious schemas with large or cyclic hierarchies by cutting off the - // search when the counter reaches a threshold. -}; - -class InterfaceSchema::Method { -public: - Method() = default; - - inline schema::Method::Reader getProto() const { return proto; } - inline InterfaceSchema getContainingInterface() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - StructSchema getParamType() const; - StructSchema getResultType() const; - // Get the parameter and result types, including substituting generic parameters. - - inline bool operator==(const Method& other) const; - inline bool operator!=(const Method& other) const { return !(*this == other); } - -private: - InterfaceSchema parent; - uint16_t ordinal; - schema::Method::Reader proto; - - inline Method(InterfaceSchema parent, uint16_t ordinal, - schema::Method::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::MethodList { -public: - MethodList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Method operator[](uint index) const { return Method(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline MethodList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::SuperclassList { -public: - SuperclassList() = default; // empty list - - inline uint size() const { return list.size(); } - InterfaceSchema operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline SuperclassList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -// ------------------------------------------------------------------- - -class ConstSchema: public Schema { - // Represents a constant declaration. - // - // `ConstSchema` can be implicitly cast to DynamicValue to read its value. - -public: - inline ConstSchema(): Schema(&_::NULL_CONST_SCHEMA.defaultBrand) {} - - template - ReaderFor as() const; - // Read the constant's value. This is a convenience method equivalent to casting the ConstSchema - // to a DynamicValue and then calling its `as()` method. For dependency reasons, this method - // is defined in , which you must #include explicitly. - - uint32_t getValueSchemaOffset() const; - // Much like StructSchema::Field::getDefaultValueSchemaOffset(), if the constant has pointer - // type, this gets the offset from the beginning of the constant's schema node to a pointer - // representing the constant value. - - Type getType() const; - -private: - ConstSchema(Schema base): Schema(base) {} - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class Type { -public: - struct BrandParameter { - uint64_t scopeId; - uint index; - }; - struct ImplicitParameter { - uint index; - }; - - inline Type(); - inline Type(schema::Type::Which primitive); - inline Type(StructSchema schema); - inline Type(EnumSchema schema); - inline Type(InterfaceSchema schema); - inline Type(ListSchema schema); - inline Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind); - inline Type(BrandParameter param); - inline Type(ImplicitParameter param); - - template - inline static Type from(); - - inline schema::Type::Which which() const; - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ListSchema asList() const; - // Each of these methods may only be called if which() returns the corresponding type. - - kj::Maybe getBrandParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. - - kj::Maybe getImplicitParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. "Implicit parameters" refer to type parameters on methods. - - inline schema::Type::AnyPointer::Unconstrained::Which whichAnyPointerKind() const; - // Only callable if which() returns ANY_POINTER. - - inline bool isVoid() const; - inline bool isBool() const; - inline bool isInt8() const; - inline bool isInt16() const; - inline bool isInt32() const; - inline bool isInt64() const; - inline bool isUInt8() const; - inline bool isUInt16() const; - inline bool isUInt32() const; - inline bool isUInt64() const; - inline bool isFloat32() const; - inline bool isFloat64() const; - inline bool isText() const; - inline bool isData() const; - inline bool isList() const; - inline bool isEnum() const; - inline bool isStruct() const; - inline bool isInterface() const; - inline bool isAnyPointer() const; - - bool operator==(const Type& other) const; - inline bool operator!=(const Type& other) const { return !(*this == other); } - - size_t hashCode() const; - - inline Type wrapInList(uint depth = 1) const; - // Return the Type formed by wrapping this type in List() `depth` times. - - inline Type(schema::Type::Which derived, const _::RawBrandedSchema* schema); - // For internal use. - -private: - schema::Type::Which baseType; // type not including applications of List() - uint8_t listDepth; // 0 for T, 1 for List(T), 2 for List(List(T)), ... - - bool isImplicitParam; - // If true, this refers to an implicit method parameter. baseType must be ANY_POINTER, scopeId - // must be zero, and paramIndex indicates the parameter index. - - union { - uint16_t paramIndex; - // If baseType is ANY_POINTER but this Type actually refers to a type parameter, this is the - // index of the parameter among the parameters at its scope, and `scopeId` below is the type ID - // of the scope where the parameter was defined. - - schema::Type::AnyPointer::Unconstrained::Which anyPointerKind; - // If scopeId is zero and isImplicitParam is false. - }; - - union { - const _::RawBrandedSchema* schema; // if type is struct, enum, interface... - uint64_t scopeId; // if type is AnyPointer but it's actually a type parameter... - }; - - Type(schema::Type::Which baseType, uint8_t listDepth, const _::RawBrandedSchema* schema) - : baseType(baseType), listDepth(listDepth), schema(schema) { - KJ_IREQUIRE(baseType != schema::Type::ANY_POINTER); - } - - void requireUsableAs(Type expected) const; - - friend class ListSchema; // only for requireUsableAs() -}; - -// ------------------------------------------------------------------- - -class ListSchema { - // ListSchema is a little different because list types are not described by schema nodes. So, - // ListSchema doesn't subclass Schema. - -public: - ListSchema() = default; - - static ListSchema of(schema::Type::Which primitiveType); - static ListSchema of(StructSchema elementType); - static ListSchema of(EnumSchema elementType); - static ListSchema of(InterfaceSchema elementType); - static ListSchema of(ListSchema elementType); - static ListSchema of(Type elementType); - // Construct the schema for a list of the given type. - - static ListSchema of(schema::Type::Reader elementType, Schema context) - KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the input type. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Construct from an element type schema. Requires a context which can handle getDependency() - // requests for any type ID found in the schema. - - Type getElementType() const; - - inline schema::Type::Which whichElementType() const; - // Get the element type's "which()". ListSchema does not actually store a schema::Type::Reader - // describing the element type, but if it did, this would be equivalent to calling - // .getBody().which() on that type. - - StructSchema getStructElementType() const; - EnumSchema getEnumElementType() const; - InterfaceSchema getInterfaceElementType() const; - ListSchema getListElementType() const; - // Get the schema for complex element types. Each of these throws an exception if the element - // type is not of the requested kind. - - inline bool operator==(const ListSchema& other) const { return elementType == other.elementType; } - inline bool operator!=(const ListSchema& other) const { return elementType != other.elementType; } - - template - void requireUsableAs() const; - -private: - Type elementType; - - inline explicit ListSchema(Type elementType): elementType(elementType) {} - - template - struct FromImpl; - template static inline ListSchema fromImpl() { - return FromImpl::get(); - } - - void requireUsableAs(ListSchema expected) const; - - friend class Schema; -}; - -// ======================================================================================= -// inline implementation - -template <> inline schema::Type::Which Schema::from() { return schema::Type::VOID; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::BOOL; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::TEXT; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::DATA; } - -inline Schema Schema::getDependency(uint64_t id) const { - return getDependency(id, 0); -} - -inline bool Schema::isBranded() const { - return raw != &raw->generic->defaultBrand; -} - -inline Schema Schema::getGeneric() const { - return Schema(&raw->generic->defaultBrand); -} - -template -inline void Schema::requireUsableAs() const { - requireUsableAs(&_::rawSchema()); -} - -inline bool StructSchema::Field::operator==(const Field& other) const { - return parent == other.parent && index == other.index; -} -inline bool EnumSchema::Enumerant::operator==(const Enumerant& other) const { - return parent == other.parent && ordinal == other.ordinal; -} -inline bool InterfaceSchema::Method::operator==(const Method& other) const { - return parent == other.parent && ordinal == other.ordinal; -} - -inline ListSchema ListSchema::of(StructSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(EnumSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(InterfaceSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(ListSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(Type elementType) { - return ListSchema(elementType); -} - -inline Type ListSchema::getElementType() const { - return elementType; -} - -inline schema::Type::Which ListSchema::whichElementType() const { - return elementType.which(); -} - -inline StructSchema ListSchema::getStructElementType() const { - return elementType.asStruct(); -} - -inline EnumSchema ListSchema::getEnumElementType() const { - return elementType.asEnum(); -} - -inline InterfaceSchema ListSchema::getInterfaceElementType() const { - return elementType.asInterface(); -} - -inline ListSchema ListSchema::getListElementType() const { - return elementType.asList(); -} - -template -inline void ListSchema::requireUsableAs() const { - static_assert(kind() == Kind::LIST, - "ListSchema::requireUsableAs() requires T is a list type."); - requireUsableAs(Schema::from()); -} - -inline void ListSchema::requireUsableAs(ListSchema expected) const { - elementType.requireUsableAs(expected.elementType); -} - -template -struct ListSchema::FromImpl> { - static inline ListSchema get() { return of(Schema::from()); } -}; - -inline Type::Type(): baseType(schema::Type::VOID), listDepth(0), schema(nullptr) {} -inline Type::Type(schema::Type::Which primitive) - : baseType(primitive), listDepth(0), isImplicitParam(false) { - KJ_IREQUIRE(primitive != schema::Type::STRUCT && - primitive != schema::Type::ENUM && - primitive != schema::Type::INTERFACE && - primitive != schema::Type::LIST); - if (primitive == schema::Type::ANY_POINTER) { - scopeId = 0; - anyPointerKind = schema::Type::AnyPointer::Unconstrained::ANY_KIND; - } else { - schema = nullptr; - } -} -inline Type::Type(schema::Type::Which derived, const _::RawBrandedSchema* schema) - : baseType(derived), listDepth(0), isImplicitParam(false), schema(schema) { - KJ_IREQUIRE(derived == schema::Type::STRUCT || - derived == schema::Type::ENUM || - derived == schema::Type::INTERFACE); -} - -inline Type::Type(StructSchema schema) - : baseType(schema::Type::STRUCT), listDepth(0), schema(schema.raw) {} -inline Type::Type(EnumSchema schema) - : baseType(schema::Type::ENUM), listDepth(0), schema(schema.raw) {} -inline Type::Type(InterfaceSchema schema) - : baseType(schema::Type::INTERFACE), listDepth(0), schema(schema.raw) {} -inline Type::Type(ListSchema schema) - : Type(schema.getElementType()) { ++listDepth; } -inline Type::Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - anyPointerKind(anyPointerKind), scopeId(0) {} -inline Type::Type(BrandParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - paramIndex(param.index), scopeId(param.scopeId) {} -inline Type::Type(ImplicitParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(true), - paramIndex(param.index), scopeId(0) {} - -inline schema::Type::Which Type::which() const { - return listDepth > 0 ? schema::Type::LIST : baseType; -} - -inline schema::Type::AnyPointer::Unconstrained::Which Type::whichAnyPointerKind() const { - KJ_IREQUIRE(baseType == schema::Type::ANY_POINTER); - return !isImplicitParam && scopeId == 0 ? anyPointerKind - : schema::Type::AnyPointer::Unconstrained::ANY_KIND; -} - -template -inline Type Type::from() { return Type(Schema::from()); } - -inline bool Type::isVoid () const { return baseType == schema::Type::VOID && listDepth == 0; } -inline bool Type::isBool () const { return baseType == schema::Type::BOOL && listDepth == 0; } -inline bool Type::isInt8 () const { return baseType == schema::Type::INT8 && listDepth == 0; } -inline bool Type::isInt16 () const { return baseType == schema::Type::INT16 && listDepth == 0; } -inline bool Type::isInt32 () const { return baseType == schema::Type::INT32 && listDepth == 0; } -inline bool Type::isInt64 () const { return baseType == schema::Type::INT64 && listDepth == 0; } -inline bool Type::isUInt8 () const { return baseType == schema::Type::UINT8 && listDepth == 0; } -inline bool Type::isUInt16 () const { return baseType == schema::Type::UINT16 && listDepth == 0; } -inline bool Type::isUInt32 () const { return baseType == schema::Type::UINT32 && listDepth == 0; } -inline bool Type::isUInt64 () const { return baseType == schema::Type::UINT64 && listDepth == 0; } -inline bool Type::isFloat32() const { return baseType == schema::Type::FLOAT32 && listDepth == 0; } -inline bool Type::isFloat64() const { return baseType == schema::Type::FLOAT64 && listDepth == 0; } -inline bool Type::isText () const { return baseType == schema::Type::TEXT && listDepth == 0; } -inline bool Type::isData () const { return baseType == schema::Type::DATA && listDepth == 0; } -inline bool Type::isList () const { return listDepth > 0; } -inline bool Type::isEnum () const { return baseType == schema::Type::ENUM && listDepth == 0; } -inline bool Type::isStruct () const { return baseType == schema::Type::STRUCT && listDepth == 0; } -inline bool Type::isInterface() const { - return baseType == schema::Type::INTERFACE && listDepth == 0; -} -inline bool Type::isAnyPointer() const { - return baseType == schema::Type::ANY_POINTER && listDepth == 0; -} - -inline Type Type::wrapInList(uint depth) const { - Type result = *this; - result.listDepth += depth; - return result; -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/serialize-async.h b/phonelibs/capnp-cpp/include/capnp/serialize-async.h deleted file mode 100644 index a16bfd8975..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/serialize-async.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_ASYNC_H_ -#define CAPNP_SERIALIZE_ASYNC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -kj::Promise> readMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Read a message asynchronously. -// -// `input` must remain valid until the returned promise resolves (or is canceled). -// -// `scratchSpace`, if provided, must remain valid until the returned MessageReader is destroyed. - -kj::Promise>> tryReadMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Like `readMessage` but returns null on EOF. - -kj::Promise writeMessage(kj::AsyncOutputStream& output, - kj::ArrayPtr> segments) - KJ_WARN_UNUSED_RESULT; -kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) - KJ_WARN_UNUSED_RESULT; -// Write asynchronously. The parameters must remain valid until the returned promise resolves. - -// ======================================================================================= -// inline implementation details - -inline kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) { - return writeMessage(output, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_ASYNC_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/serialize-packed.h b/phonelibs/capnp-cpp/include/capnp/serialize-packed.h deleted file mode 100644 index a71260ce1d..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/serialize-packed.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_PACKED_H_ -#define CAPNP_SERIALIZE_PACKED_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "serialize.h" - -namespace capnp { - -namespace _ { // private - -class PackedInputStream: public kj::InputStream { - // An input stream that unpacks packed data with a picky constraint: The caller must read data - // in the exact same size and sequence as the data was written to PackedOutputStream. - -public: - explicit PackedInputStream(kj::BufferedInputStream& inner); - KJ_DISALLOW_COPY(PackedInputStream); - ~PackedInputStream() noexcept(false); - - // implements InputStream ------------------------------------------ - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - kj::BufferedInputStream& inner; -}; - -class PackedOutputStream: public kj::OutputStream { -public: - explicit PackedOutputStream(kj::BufferedOutputStream& inner); - KJ_DISALLOW_COPY(PackedOutputStream); - ~PackedOutputStream() noexcept(false); - - // implements OutputStream ----------------------------------------- - void write(const void* buffer, size_t bytes) override; - -private: - kj::BufferedOutputStream& inner; -}; - -} // namespace _ (private) - -class PackedMessageReader: private _::PackedInputStream, public InputStreamMessageReader { -public: - PackedMessageReader(kj::BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - KJ_DISALLOW_COPY(PackedMessageReader); - ~PackedMessageReader() noexcept(false); -}; - -class PackedFdMessageReader: private kj::FdInputStream, private kj::BufferedInputStreamWrapper, - public PackedMessageReader { -public: - PackedFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read message from a file descriptor, without taking ownership of the descriptor. - // Note that if you want to reuse the descriptor after the reader is destroyed, you'll need to - // seek it, since otherwise the position is unspecified. - - PackedFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read a message from a file descriptor, taking ownership of the descriptor. - - KJ_DISALLOW_COPY(PackedFdMessageReader); - - ~PackedFdMessageReader() noexcept(false); -}; - -void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::BufferedOutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to a buffered output stream. - -void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::OutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to an unbuffered output stream. If you intend to write multiple messages -// in succession, consider wrapping your output in a buffered stream in order to reduce system -// call overhead. - -void writePackedMessageToFd(int fd, MessageBuilder& builder); -void writePackedMessageToFd(int fd, kj::ArrayPtr> segments); -// Write a single packed message to the file descriptor. - -size_t computeUnpackedSizeInWords(kj::ArrayPtr packedBytes); -// Computes the number of words to which the given packed bytes will unpack. Not intended for use -// in performance-sensitive situations. - -// ======================================================================================= -// inline stuff - -inline void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessageToFd(int fd, MessageBuilder& builder) { - writePackedMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_PACKED_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/serialize-text.h b/phonelibs/capnp-cpp/include/capnp/serialize-text.h deleted file mode 100644 index d86fc2c00e..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/serialize-text.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015 Philip Quinn. -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_TEXT_H_ -#define CAPNP_SERIALIZE_TEXT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "dynamic.h" -#include "orphan.h" -#include "schema.h" - -namespace capnp { - -class TextCodec { - // Reads and writes Cap'n Proto objects in a plain text format (as used in the schema - // language for constants, and read/written by the 'decode' and 'encode' commands of - // the capnp tool). - // - // This format is useful for debugging or human input, but it is not a robust alternative - // to the binary format. Changes to a schema's types or names that are permitted in a - // schema's binary evolution will likely break messages stored in this format. - // - // Note that definitions or references (to constants, other fields, or files) are not - // permitted in this format. To evaluate declarations with the full expressiveness of the - // schema language, see `capnp::SchemaParser`. - // - // Requires linking with the capnpc library. - -public: - TextCodec(); - ~TextCodec() noexcept(true); - - void setPrettyPrint(bool enabled); - // If enabled, pads the output of `encode()` with spaces and newlines to make it more - // human-readable. - - template - kj::String encode(T&& value) const; - kj::String encode(DynamicValue::Reader value) const; - // Encode any Cap'n Proto value. - - template - Orphan decode(kj::StringPtr input, Orphanage orphanage) const; - // Decode a text message into a Cap'n Proto object of type T, allocated in the given - // orphanage. Any errors parsing the input or assigning the fields of T are thrown as - // exceptions. - - void decode(kj::StringPtr input, DynamicStruct::Builder output) const; - // Decode a text message for a struct into the given builder. Any errors parsing the - // input or assigning the fields of the output are thrown as exceptions. - - // TODO(someday): expose some control over the error handling? -private: - Orphan decode(kj::StringPtr input, Type type, Orphanage orphanage) const; - - bool prettyPrint; -}; - -// ======================================================================================= -// inline stuff - -template -inline kj::String TextCodec::encode(T&& value) const { - return encode(DynamicValue::Reader(ReaderFor>(kj::fwd(value)))); -} - -template -inline Orphan TextCodec::decode(kj::StringPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_TEXT_H_ diff --git a/phonelibs/capnp-cpp/include/capnp/serialize.h b/phonelibs/capnp-cpp/include/capnp/serialize.h deleted file mode 100644 index 797db51766..0000000000 --- a/phonelibs/capnp-cpp/include/capnp/serialize.h +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file implements a simple serialization format for Cap'n Proto messages. The format -// is as follows: -// -// * 32-bit little-endian segment count (4 bytes). -// * 32-bit little-endian size of each segment (4*(segment count) bytes). -// * Padding so that subsequent data is 64-bit-aligned (0 or 4 bytes). (I.e., if there are an even -// number of segments, there are 4 bytes of zeros here, otherwise there is no padding.) -// * Data from each segment, in order (8*sum(segment sizes) bytes) -// -// This format has some important properties: -// - It is self-delimiting, so multiple messages may be written to a stream without any external -// delimiter. -// - The total size and position of each segment can be determined by reading only the first part -// of the message, allowing lazy and random-access reading of the segment data. -// - A message is always at least 8 bytes. -// - A single-segment message can be read entirely in two system calls with no buffering. -// - A multi-segment message can be read entirely in three system calls with no buffering. -// - The format is appropriate for mmap()ing since all data is aligned. - -#ifndef CAPNP_SERIALIZE_H_ -#define CAPNP_SERIALIZE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "message.h" -#include - -namespace capnp { - -class FlatArrayMessageReader: public MessageReader { - // Parses a message from a flat array. Note that it makes sense to use this together with mmap() - // for extremely fast parsing. - -public: - FlatArrayMessageReader(kj::ArrayPtr array, ReaderOptions options = ReaderOptions()); - // The array must remain valid until the MessageReader is destroyed. - - kj::ArrayPtr getSegment(uint id) override; - - const word* getEnd() const { return end; } - // Get a pointer just past the end of the message as determined by reading the message header. - // This could actually be before the end of the input array. This pointer is useful e.g. if - // you know that the input array has extra stuff appended after the message and you want to - // get at it. - -private: - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - const word* end; -}; - -kj::ArrayPtr initMessageBuilderFromFlatArrayCopy( - kj::ArrayPtr array, MessageBuilder& target, - ReaderOptions options = ReaderOptions()); -// Convenience function which reads a message using `FlatArrayMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// Returns an ArrayPtr containing any words left over in the array after consuming the whole -// message. This is useful when reading multiple messages that have been concatenated. See also -// FlatArrayMessageReader::getEnd(). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -kj::Array messageToFlatArray(MessageBuilder& builder); -// Constructs a flat array containing the entire content of the given message. -// -// To output the message as bytes, use `.asBytes()` on the returned word array. Keep in mind that -// `asBytes()` returns an ArrayPtr, so you have to save the Array as well to prevent it from being -// deleted. For example: -// -// kj::Array words = messageToFlatArray(myMessage); -// kj::ArrayPtr bytes = words.asBytes(); -// write(fd, bytes.begin(), bytes.size()); - -kj::Array messageToFlatArray(kj::ArrayPtr> segments); -// Version of messageToFlatArray that takes a raw segment array. - -size_t computeSerializedSizeInWords(MessageBuilder& builder); -// Returns the size, in words, that will be needed to serialize the message, including the header. - -size_t computeSerializedSizeInWords(kj::ArrayPtr> segments); -// Version of computeSerializedSizeInWords that takes a raw segment array. - -size_t expectedSizeInWordsFromPrefix(kj::ArrayPtr messagePrefix); -// Given a prefix of a serialized message, try to determine the expected total size of the message, -// in words. The returned size is based on the information known so far; it may be an underestimate -// if the prefix doesn't contain the full segment table. -// -// If the returned value is greater than `messagePrefix.size()`, then the message is not yet -// complete and the app cannot parse it yet. If the returned value is less than or equal to -// `messagePrefix.size()`, then the returned value is the exact total size of the message; any -// remaining bytes are part of the next message. -// -// This function is useful when reading messages from a stream in an asynchronous way, but when -// using the full KJ async infrastructure would be too difficult. Each time bytes are received, -// use this function to determine if an entire message is ready to be parsed. - -// ======================================================================================= - -class InputStreamMessageReader: public MessageReader { - // A MessageReader that reads from an abstract kj::InputStream. See also StreamFdMessageReader - // for a subclass specific to file descriptors. - -public: - InputStreamMessageReader(kj::InputStream& inputStream, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - ~InputStreamMessageReader() noexcept(false); - - // implements MessageReader ---------------------------------------- - kj::ArrayPtr getSegment(uint id) override; - -private: - kj::InputStream& inputStream; - byte* readPos; - - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - - kj::Array ownedSpace; - // Only if scratchSpace wasn't big enough. - - kj::UnwindDetector unwindDetector; -}; - -void readMessageCopy(kj::InputStream& input, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `InputStreamMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessage(kj::OutputStream& output, MessageBuilder& builder); -// Write the message to the given output stream. - -void writeMessage(kj::OutputStream& output, kj::ArrayPtr> segments); -// Write the segment array to the given output stream. - -// ======================================================================================= -// Specializations for reading from / writing to file descriptors. - -class StreamFdMessageReader: private kj::FdInputStream, public InputStreamMessageReader { - // A MessageReader that reads from a steam-based file descriptor. - -public: - StreamFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(fd), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read message from a file descriptor, without taking ownership of the descriptor. - - StreamFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(kj::mv(fd)), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read a message from a file descriptor, taking ownership of the descriptor. - - ~StreamFdMessageReader() noexcept(false); -}; - -void readMessageCopyFromFd(int fd, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `StreamFdMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessageToFd(int fd, MessageBuilder& builder); -// Write the message to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -void writeMessageToFd(int fd, kj::ArrayPtr> segments); -// Write the segment array to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -// ======================================================================================= -// inline stuff - -inline kj::Array messageToFlatArray(MessageBuilder& builder) { - return messageToFlatArray(builder.getSegmentsForOutput()); -} - -inline size_t computeSerializedSizeInWords(MessageBuilder& builder) { - return computeSerializedSizeInWords(builder.getSegmentsForOutput()); -} - -inline void writeMessage(kj::OutputStream& output, MessageBuilder& builder) { - writeMessage(output, builder.getSegmentsForOutput()); -} - -inline void writeMessageToFd(int fd, MessageBuilder& builder) { - writeMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // SERIALIZE_H_ diff --git a/phonelibs/capnp-cpp/include/kj/arena.h b/phonelibs/capnp-cpp/include/kj/arena.h deleted file mode 100644 index 32c1f61c51..0000000000 --- a/phonelibs/capnp-cpp/include/kj/arena.h +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARENA_H_ -#define KJ_ARENA_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class Arena { - // A class which allows several objects to be allocated in contiguous chunks of memory, then - // frees them all at once. - // - // Allocating from the same Arena in multiple threads concurrently is NOT safe, because making - // it safe would require atomic operations that would slow down allocation even when - // single-threaded. If you need to use arena allocation in a multithreaded context, consider - // allocating thread-local arenas. - -public: - explicit Arena(size_t chunkSizeHint = 1024); - // Create an Arena. `chunkSizeHint` hints at where to start when allocating chunks, but is only - // a hint -- the Arena will, for example, allocate progressively larger chunks as time goes on, - // in order to reduce overall allocation overhead. - - explicit Arena(ArrayPtr scratch); - // Allocates from the given scratch space first, only resorting to the heap when it runs out. - - KJ_DISALLOW_COPY(Arena); - ~Arena() noexcept(false); - - template - T& allocate(Params&&... params); - template - ArrayPtr allocateArray(size_t size); - // Allocate an object or array of type T. If T has a non-trivial destructor, that destructor - // will be run during the Arena's destructor. Such destructors are run in opposite order of - // allocation. Note that these methods must maintain a list of destructors to call, which has - // overhead, but this overhead only applies if T has a non-trivial destructor. - - template - Own allocateOwn(Params&&... params); - template - Array allocateOwnArray(size_t size); - template - ArrayBuilder allocateOwnArrayBuilder(size_t capacity); - // Allocate an object or array of type T. Destructors are executed when the returned Own - // or Array goes out-of-scope, which must happen before the Arena is destroyed. This variant - // is useful when you need to control when the destructor is called. This variant also avoids - // the need for the Arena itself to keep track of destructors to call later, which may make it - // slightly more efficient. - - template - inline T& copy(T&& value) { return allocate>(kj::fwd(value)); } - // Allocate a copy of the given value in the arena. This is just a shortcut for calling the - // type's copy (or move) constructor. - - StringPtr copyString(StringPtr content); - // Make a copy of the given string inside the arena, and return a pointer to the copy. - -private: - struct ChunkHeader { - ChunkHeader* next; - byte* pos; // first unallocated byte in this chunk - byte* end; // end of this chunk - }; - struct ObjectHeader { - void (*destructor)(void*); - ObjectHeader* next; - }; - - size_t nextChunkSize; - ChunkHeader* chunkList = nullptr; - ObjectHeader* objectList = nullptr; - - ChunkHeader* currentChunk = nullptr; - - void cleanup(); - // Run all destructors, leaving the above pointers null. If a destructor throws, the State is - // left in a consistent state, such that if cleanup() is called again, it will pick up where - // it left off. - - void* allocateBytes(size_t amount, uint alignment, bool hasDisposer); - // Allocate the given number of bytes. `hasDisposer` must be true if `setDisposer()` may be - // called on this pointer later. - - void* allocateBytesInternal(size_t amount, uint alignment); - // Try to allocate the given number of bytes without taking a lock. Fails if and only if there - // is no space left in the current chunk. - - void setDestructor(void* ptr, void (*destructor)(void*)); - // Schedule the given destructor to be executed when the Arena is destroyed. `ptr` must be a - // pointer previously returned by an `allocateBytes()` call for which `hasDisposer` was true. - - template - static void destroyArray(void* pointer) { - size_t elementCount = *reinterpret_cast(pointer); - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - DestructorOnlyArrayDisposer::instance.disposeImpl( - reinterpret_cast(pointer) + prefixSize, - sizeof(T), elementCount, elementCount, &destroyObject); - } - - template - static void destroyObject(void* pointer) { - dtor(*reinterpret_cast(pointer)); - } -}; - -// ======================================================================================= -// Inline implementation details - -template -T& Arena::allocate(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes( - sizeof(T), alignof(T), !__has_trivial_destructor(T))); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - if (!__has_trivial_destructor(T)) { - setDestructor(&result, &destroyObject); - } - return result; -} - -template -ArrayPtr Arena::allocateArray(size_t size) { - if (__has_trivial_destructor(T)) { - ArrayPtr result = - arrayPtr(reinterpret_cast(allocateBytes( - sizeof(T) * size, alignof(T), false)), size); - if (!__has_trivial_constructor(T)) { - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - } - } - return result; - } else { - // Allocate with a 64-bit prefix in which we store the array size. - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - void* base = allocateBytes(sizeof(T) * size + prefixSize, alignof(T), true); - size_t& tag = *reinterpret_cast(base); - ArrayPtr result = - arrayPtr(reinterpret_cast(reinterpret_cast(base) + prefixSize), size); - setDestructor(base, &destroyArray); - - if (__has_trivial_constructor(T)) { - tag = size; - } else { - // In case of constructor exceptions, we need the tag to end up storing the number of objects - // that were successfully constructed, so that they'll be properly destroyed. - tag = 0; - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - tag = i + 1; - } - } - return result; - } -} - -template -Own Arena::allocateOwn(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes(sizeof(T), alignof(T), false)); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - return Own(&result, DestructorOnlyDisposer::instance); -} - -template -Array Arena::allocateOwnArray(size_t size) { - ArrayBuilder result = allocateOwnArrayBuilder(size); - for (size_t i = 0; i < size; i++) { - result.add(); - } - return result.finish(); -} - -template -ArrayBuilder Arena::allocateOwnArrayBuilder(size_t capacity) { - return ArrayBuilder( - reinterpret_cast(allocateBytes(sizeof(T) * capacity, alignof(T), false)), - capacity, DestructorOnlyArrayDisposer::instance); -} - -} // namespace kj - -#endif // KJ_ARENA_H_ diff --git a/phonelibs/capnp-cpp/include/kj/array.h b/phonelibs/capnp-cpp/include/kj/array.h deleted file mode 100644 index 51b5dcf319..0000000000 --- a/phonelibs/capnp-cpp/include/kj/array.h +++ /dev/null @@ -1,813 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARRAY_H_ -#define KJ_ARRAY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include - -namespace kj { - -// ======================================================================================= -// ArrayDisposer -- Implementation details. - -class ArrayDisposer { - // Much like Disposer from memory.h. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for - // HeapArrayDisposer::instance. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const = 0; - // Disposes of the array. `destroyElement` invokes the destructor of each element, or is nullptr - // if the elements have trivial destructors. `capacity` is the amount of space that was - // allocated while `elementCount` is the number of elements that were actually constructed; - // these are always the same number for Array but may be different when using ArrayBuilder. - -public: - - template - void dispose(T* firstElement, size_t elementCount, size_t capacity) const; - // Helper wrapper around disposeImpl(). - // - // Callers must not call dispose() on the same array twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -class ExceptionSafeArrayUtil { - // Utility class that assists in constructing or destroying elements of an array, where the - // constructor or destructor could throw exceptions. In case of an exception, - // ExceptionSafeArrayUtil's destructor will call destructors on all elements that have been - // constructed but not destroyed. Remember that destructors that throw exceptions are required - // to use UnwindDetector to detect unwind and avoid exceptions in this case. Therefore, no more - // than one exception will be thrown (and the program will not terminate). - -public: - inline ExceptionSafeArrayUtil(void* ptr, size_t elementSize, size_t constructedElementCount, - void (*destroyElement)(void*)) - : pos(reinterpret_cast(ptr) + elementSize * constructedElementCount), - elementSize(elementSize), constructedElementCount(constructedElementCount), - destroyElement(destroyElement) {} - KJ_DISALLOW_COPY(ExceptionSafeArrayUtil); - - inline ~ExceptionSafeArrayUtil() noexcept(false) { - if (constructedElementCount > 0) destroyAll(); - } - - void construct(size_t count, void (*constructElement)(void*)); - // Construct the given number of elements. - - void destroyAll(); - // Destroy all elements. Call this immediately before ExceptionSafeArrayUtil goes out-of-scope - // to ensure that one element throwing an exception does not prevent the others from being - // destroyed. - - void release() { constructedElementCount = 0; } - // Prevent ExceptionSafeArrayUtil's destructor from destroying the constructed elements. - // Call this after you've successfully finished constructing. - -private: - byte* pos; - size_t elementSize; - size_t constructedElementCount; - void (*destroyElement)(void*); -}; - -class DestructorOnlyArrayDisposer: public ArrayDisposer { -public: - static const DestructorOnlyArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -class NullArrayDisposer: public ArrayDisposer { - // An ArrayDisposer that does nothing. Can be used to construct a fake Arrays that doesn't - // actually own its content. - -public: - static const NullArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -// ======================================================================================= -// Array - -template -class Array { - // An owned array which will automatically be disposed of (using an ArrayDisposer) in the - // destructor. Can be moved, but not copied. Much like Own, but for arrays rather than - // single objects. - -public: - inline Array(): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(decltype(nullptr)): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(Array&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(Array>&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(T* firstElement, size_t size, const ArrayDisposer& disposer) - : ptr(firstElement), size_(size), disposer(&disposer) {} - - KJ_DISALLOW_COPY(Array); - inline ~Array() noexcept { dispose(); } - - inline operator ArrayPtr() { - return ArrayPtr(ptr, size_); - } - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr asBytes() const { return asPtr().asBytes(); } - inline ArrayPtr> asBytes() { return asPtr().asBytes(); } - inline ArrayPtr asChars() const { return asPtr().asChars(); } - inline ArrayPtr> asChars() { return asPtr().asChars(); } - - inline Array> releaseAsBytes() { - // Like asBytes() but transfers ownership. - static_assert(sizeof(T) == sizeof(byte), - "releaseAsBytes() only possible on arrays with byte-size elements (e.g. chars)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - inline Array> releaseAsChars() { - // Like asChars() but transfers ownership. - static_assert(sizeof(T) == sizeof(PropagateConst), - "releaseAsChars() only possible on arrays with char-size elements (e.g. bytes)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline Array& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - inline Array& operator=(Array&& other) { - dispose(); - ptr = other.ptr; - size_ = other.size_; - disposer = other.disposer; - other.ptr = nullptr; - other.size_ = 0; - return *this; - } - -private: - T* ptr; - size_t size_; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - size_t sizeCopy = size_; - if (ptrCopy != nullptr) { - ptr = nullptr; - size_ = 0; - disposer->dispose(ptrCopy, sizeCopy, sizeCopy); - } - } - - template - friend class Array; -}; - -static_assert(!canMemcpy>(), "canMemcpy<>() is broken"); - -namespace _ { // private - -class HeapArrayDisposer final: public ArrayDisposer { -public: - template - static T* allocate(size_t count); - template - static T* allocateUninitialized(size_t count); - - static const HeapArrayDisposer instance; - -private: - static void* allocateImpl(size_t elementSize, size_t elementCount, size_t capacity, - void (*constructElement)(void*), void (*destroyElement)(void*)); - // Allocates and constructs the array. Both function pointers are null if the constructor is - // trivial, otherwise destroyElement is null if the constructor doesn't throw. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; - - template - struct Allocate_; -}; - -} // namespace _ (private) - -template -inline Array heapArray(size_t size) { - // Much like `heap()` from memory.h, allocates a new array on the heap. - - return Array(_::HeapArrayDisposer::allocate(size), size, - _::HeapArrayDisposer::instance); -} - -template Array heapArray(const T* content, size_t size); -template Array heapArray(ArrayPtr content); -template Array heapArray(ArrayPtr content); -template Array heapArray(Iterator begin, Iterator end); -template Array heapArray(std::initializer_list init); -// Allocate a heap array containing a copy of the given content. - -template -Array heapArrayFromIterable(Container&& a) { return heapArray(a.begin(), a.end()); } -template -Array heapArrayFromIterable(Array&& a) { return mv(a); } - -// ======================================================================================= -// ArrayBuilder - -template -class ArrayBuilder { - // Class which lets you build an Array specifying the exact constructor arguments for each - // element, rather than starting by default-constructing them. - -public: - ArrayBuilder(): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - ArrayBuilder(decltype(nullptr)): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - explicit ArrayBuilder(RemoveConst* firstElement, size_t capacity, - const ArrayDisposer& disposer) - : ptr(firstElement), pos(firstElement), endPtr(firstElement + capacity), - disposer(&disposer) {} - ArrayBuilder(ArrayBuilder&& other) - : ptr(other.ptr), pos(other.pos), endPtr(other.endPtr), disposer(other.disposer) { - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - } - KJ_DISALLOW_COPY(ArrayBuilder); - inline ~ArrayBuilder() noexcept(false) { dispose(); } - - inline operator ArrayPtr() { - return arrayPtr(ptr, pos); - } - inline operator ArrayPtr() const { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() const { - return arrayPtr(ptr, pos); - } - - inline size_t size() const { return pos - ptr; } - inline size_t capacity() const { return endPtr - ptr; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < implicitCast(pos - ptr), "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return pos; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(pos - 1); } - inline T* begin() { return ptr; } - inline T* end() { return pos; } - inline T& front() { return *ptr; } - inline T& back() { return *(pos - 1); } - - ArrayBuilder& operator=(ArrayBuilder&& other) { - dispose(); - ptr = other.ptr; - pos = other.pos; - endPtr = other.endPtr; - disposer = other.disposer; - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - return *this; - } - ArrayBuilder& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - T& add(Params&&... params) { - KJ_IREQUIRE(pos < endPtr, "Added too many elements to ArrayBuilder."); - ctor(*pos, kj::fwd(params)...); - return *pos++; - } - - template - void addAll(Container&& container) { - addAll()>( - container.begin(), container.end()); - } - - template - void addAll(Iterator start, Iterator end); - - void removeLast() { - KJ_IREQUIRE(pos > ptr, "No elements present to remove."); - kj::dtor(*--pos); - } - - void truncate(size_t size) { - KJ_IREQUIRE(size <= this->size(), "can't use truncate() to expand"); - - T* target = ptr + size; - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - - void resize(size_t size) { - KJ_IREQUIRE(size <= capacity(), "can't resize past capacity"); - - T* target = ptr + size; - if (target > pos) { - // expand - if (__has_trivial_constructor(T)) { - pos = target; - } else { - while (pos < target) { - kj::ctor(*pos++); - } - } - } else { - // truncate - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - } - - Array finish() { - // We could safely remove this check if we assume that the disposer implementation doesn't - // need to know the original capacity, as is thes case with HeapArrayDisposer since it uses - // operator new() or if we created a custom disposer for ArrayBuilder which stores the capacity - // in a prefix. But that would make it hard to write cleverer heap allocators, and anyway this - // check might catch bugs. Probably people should use Vector if they want to build arrays - // without knowing the final size in advance. - KJ_IREQUIRE(pos == endPtr, "ArrayBuilder::finish() called prematurely."); - Array result(reinterpret_cast(ptr), pos - ptr, *disposer); - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - return result; - } - - inline bool isFull() const { - return pos == endPtr; - } - -private: - T* ptr; - RemoveConst* pos; - T* endPtr; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - T* posCopy = pos; - T* endCopy = endPtr; - if (ptrCopy != nullptr) { - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - disposer->dispose(ptrCopy, posCopy - ptrCopy, endCopy - ptrCopy); - } - } -}; - -template -inline ArrayBuilder heapArrayBuilder(size_t size) { - // Like `heapArray()` but does not default-construct the elements. You must construct them - // manually by calling `add()`. - - return ArrayBuilder(_::HeapArrayDisposer::allocateUninitialized>(size), - size, _::HeapArrayDisposer::instance); -} - -// ======================================================================================= -// Inline Arrays - -template -class FixedArray { - // A fixed-width array whose storage is allocated inline rather than on the heap. - -public: - inline size_t size() const { return fixedSize; } - inline T* begin() { return content; } - inline T* end() { return content + fixedSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + fixedSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, fixedSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, fixedSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - T content[fixedSize]; -}; - -template -class CappedArray { - // Like `FixedArray` but can be dynamically resized as long as the size does not exceed the limit - // specified by the template parameter. - // - // TODO(someday): Don't construct elements past currentSize? - -public: - inline KJ_CONSTEXPR() CappedArray(): currentSize(fixedSize) {} - inline explicit constexpr CappedArray(size_t s): currentSize(s) {} - - inline size_t size() const { return currentSize; } - inline void setSize(size_t s) { KJ_IREQUIRE(s <= fixedSize); currentSize = s; } - inline T* begin() { return content; } - inline T* end() { return content + currentSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + currentSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, currentSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, currentSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - size_t currentSize; - T content[fixedSize]; -}; - -// ======================================================================================= -// KJ_MAP - -#define KJ_MAP(elementName, array) \ - ::kj::_::Mapper(array) * \ - [&](typename ::kj::_::Mapper::Element elementName) -// Applies some function to every element of an array, returning an Array of the results, with -// nice syntax. Example: -// -// StringPtr foo = "abcd"; -// Array bar = KJ_MAP(c, foo) -> char { return c + 1; }; -// KJ_ASSERT(str(bar) == "bcde"); - -namespace _ { // private - -template -struct Mapper { - T array; - Mapper(T&& array): array(kj::fwd(array)) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(array.size()); - for (auto iter = array.begin(); iter != array.end(); ++iter) { - builder.add(func(*iter)); - } - return builder.finish(); - } - typedef decltype(*kj::instance().begin()) Element; -}; - -template -struct Mapper { - T* array; - Mapper(T* array): array(array) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(s); - for (size_t i = 0; i < s; i++) { - builder.add(func(array[i])); - } - return builder.finish(); - } - typedef decltype(*array)& Element; -}; - -} // namespace _ (private) - -// ======================================================================================= -// Inline implementation details - -template -struct ArrayDisposer::Dispose_ { - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(const_cast*>(firstElement), - sizeof(T), elementCount, capacity, nullptr); - } -}; -template -struct ArrayDisposer::Dispose_ { - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(firstElement, sizeof(T), elementCount, capacity, &destruct); - } -}; - -template -void ArrayDisposer::dispose(T* firstElement, size_t elementCount, size_t capacity) const { - Dispose_::dispose(firstElement, elementCount, capacity, *this); -} - -namespace _ { // private - -template -struct HeapArrayDisposer::Allocate_ { - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, nullptr, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, &destruct)); - } -}; - -template -T* HeapArrayDisposer::allocate(size_t count) { - return Allocate_::allocate(count, count); -} - -template -T* HeapArrayDisposer::allocateUninitialized(size_t count) { - return Allocate_::allocate(0, count); -} - -template ()> -struct CopyConstructArray_; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, T* start, T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, const T* start, const T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Since both the copy constructor and assignment operator are trivial, we know that assignment - // is equivalent to copy-constructing. So we can make this case somewhat easier for the - // compiler to optimize. - while (start != end) { - *pos++ = *start++; - } - return pos; - } -}; - -template -struct CopyConstructArray_ { - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(*start); - - if (noexcept(T(*start))) { - while (start != end) { - ctor(*pos++, *start++); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, *start++); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -template -struct CopyConstructArray_ { - // Actually move-construct. - - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(kj::mv(*start)); - - if (noexcept(T(kj::mv(*start)))) { - while (start != end) { - ctor(*pos++, kj::mv(*start++)); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, kj::mv(*start++)); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -} // namespace _ (private) - -template -template -void ArrayBuilder::addAll(Iterator start, Iterator end) { - pos = _::CopyConstructArray_, Decay, move>::apply(pos, start, end); -} - -template -Array heapArray(const T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template Array -heapArray(Iterator begin, Iterator end) { - ArrayBuilder builder = heapArrayBuilder(end - begin); - builder.addAll(begin, end); - return builder.finish(); -} - -template -inline Array heapArray(std::initializer_list init) { - return heapArray(init.begin(), init.end()); -} - -} // namespace kj - -#endif // KJ_ARRAY_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async-inl.h b/phonelibs/capnp-cpp/include/kj/async-inl.h deleted file mode 100644 index f11e4fcd5b..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async-inl.h +++ /dev/null @@ -1,1112 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains extended inline implementation details that are required along with async.h. -// We move this all into a separate file to make async.h more readable. -// -// Non-inline declarations here are defined in async.c++. - -#ifndef KJ_ASYNC_H_ -#error "Do not include this directly; include kj/async.h." -#include "async.h" // help IDE parse this file -#endif - -#ifndef KJ_ASYNC_INL_H_ -#define KJ_ASYNC_INL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { -namespace _ { // private - -template -class ExceptionOr; - -class ExceptionOrValue { -public: - ExceptionOrValue(bool, Exception&& exception): exception(kj::mv(exception)) {} - KJ_DISALLOW_COPY(ExceptionOrValue); - - void addException(Exception&& exception) { - if (this->exception == nullptr) { - this->exception = kj::mv(exception); - } - } - - template - ExceptionOr& as() { return *static_cast*>(this); } - template - const ExceptionOr& as() const { return *static_cast*>(this); } - - Maybe exception; - -protected: - // Allow subclasses to have move constructor / assignment. - ExceptionOrValue() = default; - ExceptionOrValue(ExceptionOrValue&& other) = default; - ExceptionOrValue& operator=(ExceptionOrValue&& other) = default; -}; - -template -class ExceptionOr: public ExceptionOrValue { -public: - ExceptionOr() = default; - ExceptionOr(T&& value): value(kj::mv(value)) {} - ExceptionOr(bool, Exception&& exception): ExceptionOrValue(false, kj::mv(exception)) {} - ExceptionOr(ExceptionOr&&) = default; - ExceptionOr& operator=(ExceptionOr&&) = default; - - Maybe value; -}; - -class Event { - // An event waiting to be executed. Not for direct use by applications -- promises use this - // internally. - -public: - Event(); - ~Event() noexcept(false); - KJ_DISALLOW_COPY(Event); - - void armDepthFirst(); - // Enqueue this event so that `fire()` will be called from the event loop soon. - // - // Events scheduled in this way are executed in depth-first order: if an event callback arms - // more events, those events are placed at the front of the queue (in the order in which they - // were armed), so that they run immediately after the first event's callback returns. - // - // Depth-first event scheduling is appropriate for events that represent simple continuations - // of a previous event that should be globbed together for performance. Depth-first scheduling - // can lead to starvation, so any long-running task must occasionally yield with - // `armBreadthFirst()`. (Promise::then() uses depth-first whereas evalLater() uses - // breadth-first.) - // - // To use breadth-first scheduling instead, use `armBreadthFirst()`. - - void armBreadthFirst(); - // Like `armDepthFirst()` except that the event is placed at the end of the queue. - - kj::String trace(); - // Dump debug info about this event. - - virtual _::PromiseNode* getInnerForTrace(); - // If this event wraps a PromiseNode, get that node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - virtual Maybe> fire() = 0; - // Fire the event. Possibly returns a pointer to itself, which will be discarded by the - // caller. This is the only way that an event can delete itself as a result of firing, as - // doing so from within fire() will throw an exception. - -private: - friend class kj::EventLoop; - EventLoop& loop; - Event* next; - Event** prev; - bool firing = false; -}; - -class PromiseNode { - // A Promise contains a chain of PromiseNodes tracking the pending transformations. - // - // To reduce generated code bloat, PromiseNode is not a template. Instead, it makes very hacky - // use of pointers to ExceptionOrValue which actually point to ExceptionOr, but are only - // so down-cast in the few places that really need to be templated. Luckily this is all - // internal implementation details. - -public: - virtual void onReady(Event& event) noexcept = 0; - // Arms the given event when ready. - - virtual void setSelfPointer(Own* selfPtr) noexcept; - // Tells the node that `selfPtr` is the pointer that owns this node, and will continue to own - // this node until it is destroyed or setSelfPointer() is called again. ChainPromiseNode uses - // this to shorten redundant chains. The default implementation does nothing; only - // ChainPromiseNode should implement this. - - virtual void get(ExceptionOrValue& output) noexcept = 0; - // Get the result. `output` points to an ExceptionOr into which the result will be written. - // Can only be called once, and only after the node is ready. Must be called directly from the - // event loop, with no application code on the stack. - - virtual PromiseNode* getInnerForTrace(); - // If this node wraps some other PromiseNode, get the wrapped node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - class OnReadyEvent { - // Helper class for implementing onReady(). - - public: - void init(Event& newEvent); - // Returns true if arm() was already called. - - void arm(); - // Arms the event if init() has already been called and makes future calls to init() return - // true. - - private: - Event* event = nullptr; - }; -}; - -// ------------------------------------------------------------------- - -class ImmediatePromiseNodeBase: public PromiseNode { -public: - ImmediatePromiseNodeBase(); - ~ImmediatePromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override; -}; - -template -class ImmediatePromiseNode final: public ImmediatePromiseNodeBase { - // A promise that has already been resolved to an immediate value or exception. - -public: - ImmediatePromiseNode(ExceptionOr&& result): result(kj::mv(result)) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -class ImmediateBrokenPromiseNode final: public ImmediatePromiseNodeBase { -public: - ImmediateBrokenPromiseNode(Exception&& exception); - - void get(ExceptionOrValue& output) noexcept override; - -private: - Exception exception; -}; - -// ------------------------------------------------------------------- - -class AttachmentPromiseNodeBase: public PromiseNode { -public: - AttachmentPromiseNodeBase(Own&& dependency); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - - void dropDependency(); - - template - friend class AttachmentPromiseNode; -}; - -template -class AttachmentPromiseNode final: public AttachmentPromiseNodeBase { - // A PromiseNode that holds on to some object (usually, an Own, but could be any movable - // object) until the promise resolves. - -public: - AttachmentPromiseNode(Own&& dependency, Attachment&& attachment) - : AttachmentPromiseNodeBase(kj::mv(dependency)), - attachment(kj::mv(attachment)) {} - - ~AttachmentPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the attachment because the - // dependency may be using the attachment. - dropDependency(); - } - -private: - Attachment attachment; -}; - -// ------------------------------------------------------------------- - -class PtmfHelper { - // This class is a private helper for GetFunctorStartAddress. The class represents the internal - // representation of a pointer-to-member-function. - - template - friend struct GetFunctorStartAddress; - -#if __GNUG__ - - void* ptr; - ptrdiff_t adj; - // Layout of a pointer-to-member-function used by GCC and compatible compilers. - - void* apply(void* obj) { -#if defined(__arm__) || defined(__mips__) || defined(__aarch64__) - if (adj & 1) { - ptrdiff_t voff = (ptrdiff_t)ptr; -#else - ptrdiff_t voff = (ptrdiff_t)ptr; - if (voff & 1) { - voff &= ~1; -#endif - return *(void**)(*(char**)obj + voff); - } else { - return ptr; - } - } - -#define BODY \ - PtmfHelper result; \ - static_assert(sizeof(p) == sizeof(result), "unknown ptmf layout"); \ - memcpy(&result, &p, sizeof(result)); \ - return result - -#else // __GNUG__ - - void* apply(void* obj) { return nullptr; } - // TODO(port): PTMF instruction address extraction - -#define BODY return PtmfHelper{} - -#endif // __GNUG__, else - - template - static PtmfHelper from(F p) { BODY; } - // Create a PtmfHelper from some arbitrary pointer-to-member-function which is not - // overloaded nor a template. In this case the compiler is able to deduce the full function - // signature directly given the name since there is only one function with that name. - - template - static PtmfHelper from(R (C::*p)(NoInfer

...)) { BODY; } - template - static PtmfHelper from(R (C::*p)(NoInfer

...) const) { BODY; } - // Create a PtmfHelper from some poniter-to-member-function which is a template. In this case - // the function must match exactly the containing type C, return type R, and parameter types P... - // GetFunctorStartAddress normally specifies exactly the correct C and R, but can only make a - // guess at P. Luckily, if the function parameters are template parameters then it's not - // necessary to be precise about P. -#undef BODY -}; - -template -struct GetFunctorStartAddress { - // Given a functor (any object defining operator()), return the start address of the function, - // suitable for passing to addr2line to obtain a source file/line for debugging purposes. - // - // This turns out to be incredibly hard to implement in the presence of overloaded or templated - // functors. Therefore, we impose these specific restrictions, specific to our use case: - // - Overloading is not allowed, but templating is. (Generally we only intend to support lambdas - // anyway.) - // - The template parameters to GetFunctorStartAddress specify a hint as to the expected - // parameter types. If the functor is templated, its parameters must match exactly these types. - // (If it's not templated, ParamTypes are ignored.) - - template - static void* apply(Func&& func) { - typedef decltype(func(instance()...)) ReturnType; - return PtmfHelper::from, ParamTypes...>( - &Decay::operator()).apply(&func); - } -}; - -template <> -struct GetFunctorStartAddress: public GetFunctorStartAddress<> {}; -// Hack for TransformPromiseNode use case: an input type of `Void` indicates that the function -// actually has no parameters. - -class TransformPromiseNodeBase: public PromiseNode { -public: - TransformPromiseNodeBase(Own&& dependency, void* continuationTracePtr); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - void* continuationTracePtr; - - void dropDependency(); - void getDepResult(ExceptionOrValue& output); - - virtual void getImpl(ExceptionOrValue& output) = 0; - - template - friend class TransformPromiseNode; -}; - -template -class TransformPromiseNode final: public TransformPromiseNodeBase { - // A PromiseNode that transforms the result of another PromiseNode through an application-provided - // function (implements `then()`). - -public: - TransformPromiseNode(Own&& dependency, Func&& func, ErrorFunc&& errorHandler) - : TransformPromiseNodeBase(kj::mv(dependency), - GetFunctorStartAddress::apply(func)), - func(kj::fwd(func)), errorHandler(kj::fwd(errorHandler)) {} - - ~TransformPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the continuations because it - // is a common pattern for the continuations to hold ownership of objects that might be in-use - // by the dependency. - dropDependency(); - } - -private: - Func func; - ErrorFunc errorHandler; - - void getImpl(ExceptionOrValue& output) override { - ExceptionOr depResult; - getDepResult(depResult); - KJ_IF_MAYBE(depException, depResult.exception) { - output.as() = handle( - MaybeVoidCaller>>::apply( - errorHandler, kj::mv(*depException))); - } else KJ_IF_MAYBE(depValue, depResult.value) { - output.as() = handle(MaybeVoidCaller::apply(func, kj::mv(*depValue))); - } - } - - ExceptionOr handle(T&& value) { - return kj::mv(value); - } - ExceptionOr handle(PropagateException::Bottom&& value) { - return ExceptionOr(false, value.asException()); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase; - -class ForkBranchBase: public PromiseNode { -public: - ForkBranchBase(Own&& hub); - ~ForkBranchBase() noexcept(false); - - void hubReady() noexcept; - // Called by the hub to indicate that it is ready. - - // implements PromiseNode ------------------------------------------ - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -protected: - inline ExceptionOrValue& getHubResultRef(); - - void releaseHub(ExceptionOrValue& output); - // Release the hub. If an exception is thrown, add it to `output`. - -private: - OnReadyEvent onReadyEvent; - - Own hub; - ForkBranchBase* next = nullptr; - ForkBranchBase** prevPtr = nullptr; - - friend class ForkHubBase; -}; - -template T copyOrAddRef(T& t) { return t; } -template Own copyOrAddRef(Own& t) { return t->addRef(); } - -template -class ForkBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - ForkBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = copyOrAddRef(*value); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -template -class SplitBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - SplitBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - typedef kj::Decay(kj::instance()))> Element; - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = kj::mv(kj::get(*value)); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase: public Refcounted, protected Event { -public: - ForkHubBase(Own&& inner, ExceptionOrValue& resultRef); - - inline ExceptionOrValue& getResultRef() { return resultRef; } - -private: - Own inner; - ExceptionOrValue& resultRef; - - ForkBranchBase* headBranch = nullptr; - ForkBranchBase** tailBranch = &headBranch; - // Tail becomes null once the inner promise is ready and all branches have been notified. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - friend class ForkBranchBase; -}; - -template -class ForkHub final: public ForkHubBase { - // A PromiseNode that implements the hub of a fork. The first call to Promise::fork() replaces - // the promise's outer node with a ForkHub, and subsequent calls add branches to that hub (if - // possible). - -public: - ForkHub(Own&& inner): ForkHubBase(kj::mv(inner), result) {} - - Promise<_::UnfixVoid> addBranch() { - return Promise<_::UnfixVoid>(false, kj::heap>(addRef(*this))); - } - - _::SplitTuplePromise split() { - return splitImpl(MakeIndexes()>()); - } - -private: - ExceptionOr result; - - template - _::SplitTuplePromise splitImpl(Indexes) { - return kj::tuple(addSplit()...); - } - - template - Promise::Element>> addSplit() { - return Promise::Element>>( - false, maybeChain(kj::heap>(addRef(*this)), - implicitCast::Element*>(nullptr))); - } -}; - -inline ExceptionOrValue& ForkBranchBase::getHubResultRef() { - return hub->getResultRef(); -} - -// ------------------------------------------------------------------- - -class ChainPromiseNode final: public PromiseNode, public Event { - // Promise node which reduces Promise> to Promise. - // - // `Event` is only a public base class because otherwise we can't cast Own to - // Own. Ugh, templates and private... - -public: - explicit ChainPromiseNode(Own inner); - ~ChainPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void setSelfPointer(Own* selfPtr) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - enum State { - STEP1, - STEP2 - }; - - State state; - - Own inner; - // In STEP1, a PromiseNode for a Promise. - // In STEP2, a PromiseNode for a T. - - Event* onReadyEvent = nullptr; - Own* selfPtr = nullptr; - - Maybe> fire() override; -}; - -template -Own maybeChain(Own&& node, Promise*) { - return heap(kj::mv(node)); -} - -template -Own&& maybeChain(Own&& node, T*) { - return kj::mv(node); -} - -// ------------------------------------------------------------------- - -class ExclusiveJoinPromiseNode final: public PromiseNode { -public: - ExclusiveJoinPromiseNode(Own left, Own right); - ~ExclusiveJoinPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - class Branch: public Event { - public: - Branch(ExclusiveJoinPromiseNode& joinNode, Own dependency); - ~Branch() noexcept(false); - - bool get(ExceptionOrValue& output); - // Returns true if this is the side that finished. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - private: - ExclusiveJoinPromiseNode& joinNode; - Own dependency; - }; - - Branch left; - Branch right; - OnReadyEvent onReadyEvent; -}; - -// ------------------------------------------------------------------- - -class ArrayJoinPromiseNodeBase: public PromiseNode { -public: - ArrayJoinPromiseNodeBase(Array> promises, - ExceptionOrValue* resultParts, size_t partSize); - ~ArrayJoinPromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override final; - void get(ExceptionOrValue& output) noexcept override final; - PromiseNode* getInnerForTrace() override final; - -protected: - virtual void getNoError(ExceptionOrValue& output) noexcept = 0; - // Called to compile the result only in the case where there were no errors. - -private: - uint countLeft; - OnReadyEvent onReadyEvent; - - class Branch final: public Event { - public: - Branch(ArrayJoinPromiseNodeBase& joinNode, Own dependency, - ExceptionOrValue& output); - ~Branch() noexcept(false); - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - Maybe getPart(); - // Calls dependency->get(output). If there was an exception, return it. - - private: - ArrayJoinPromiseNodeBase& joinNode; - Own dependency; - ExceptionOrValue& output; - }; - - Array branches; -}; - -template -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts) - : ArrayJoinPromiseNodeBase(kj::mv(promises), resultParts.begin(), sizeof(ExceptionOr)), - resultParts(kj::mv(resultParts)) {} - -protected: - void getNoError(ExceptionOrValue& output) noexcept override { - auto builder = heapArrayBuilder(resultParts.size()); - for (auto& part: resultParts) { - KJ_IASSERT(part.value != nullptr, - "Bug in KJ promise framework: Promise result had neither value no exception."); - builder.add(kj::mv(*_::readMaybe(part.value))); - } - output.as>() = builder.finish(); - } - -private: - Array> resultParts; -}; - -template <> -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts); - ~ArrayJoinPromiseNode(); - -protected: - void getNoError(ExceptionOrValue& output) noexcept override; - -private: - Array> resultParts; -}; - -// ------------------------------------------------------------------- - -class EagerPromiseNodeBase: public PromiseNode, protected Event { - // A PromiseNode that eagerly evaluates its dependency even if its dependent does not eagerly - // evaluate it. - -public: - EagerPromiseNodeBase(Own&& dependency, ExceptionOrValue& resultRef); - - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - OnReadyEvent onReadyEvent; - - ExceptionOrValue& resultRef; - - Maybe> fire() override; -}; - -template -class EagerPromiseNode final: public EagerPromiseNodeBase { -public: - EagerPromiseNode(Own&& dependency) - : EagerPromiseNodeBase(kj::mv(dependency), result) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -template -Own spark(Own&& node) { - // Forces evaluation of the given node to begin as soon as possible, even if no one is waiting - // on it. - return heap>(kj::mv(node)); -} - -// ------------------------------------------------------------------- - -class AdapterPromiseNodeBase: public PromiseNode { -public: - void onReady(Event& event) noexcept override; - -protected: - inline void setReady() { - onReadyEvent.arm(); - } - -private: - OnReadyEvent onReadyEvent; -}; - -template -class AdapterPromiseNode final: public AdapterPromiseNodeBase, - private PromiseFulfiller> { - // A PromiseNode that wraps a PromiseAdapter. - -public: - template - AdapterPromiseNode(Params&&... params) - : adapter(static_cast>&>(*this), kj::fwd(params)...) {} - - void get(ExceptionOrValue& output) noexcept override { - KJ_IREQUIRE(!isWaiting()); - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; - bool waiting = true; - Adapter adapter; - - void fulfill(T&& value) override { - if (waiting) { - waiting = false; - result = ExceptionOr(kj::mv(value)); - setReady(); - } - } - - void reject(Exception&& exception) override { - if (waiting) { - waiting = false; - result = ExceptionOr(false, kj::mv(exception)); - setReady(); - } - } - - bool isWaiting() override { - return waiting; - } -}; - -} // namespace _ (private) - -// ======================================================================================= - -template -Promise::Promise(_::FixVoid value) - : PromiseBase(heap<_::ImmediatePromiseNode<_::FixVoid>>(kj::mv(value))) {} - -template -Promise::Promise(kj::Exception&& exception) - : PromiseBase(heap<_::ImmediateBrokenPromiseNode>(kj::mv(exception))) {} - -template -template -PromiseForResult Promise::then(Func&& func, ErrorFunc&& errorHandler) { - typedef _::FixVoid<_::ReturnType> ResultT; - - Own<_::PromiseNode> intermediate = - heap<_::TransformPromiseNode, Func, ErrorFunc>>( - kj::mv(node), kj::fwd(func), kj::fwd(errorHandler)); - return PromiseForResult(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); -} - -namespace _ { // private - -template -struct IdentityFunc { - inline T operator()(T&& value) const { - return kj::mv(value); - } -}; -template -struct IdentityFunc> { - inline Promise operator()(T&& value) const { - return kj::mv(value); - } -}; -template <> -struct IdentityFunc { - inline void operator()() const {} -}; -template <> -struct IdentityFunc> { - Promise operator()() const; - // This can't be inline because it will make the translation unit depend on kj-async. Awkwardly, - // Cap'n Proto relies on being able to include this header without creating such a link-time - // dependency. -}; - -} // namespace _ (private) - -template -template -Promise Promise::catch_(ErrorFunc&& errorHandler) { - // then()'s ErrorFunc can only return a Promise if Func also returns a Promise. In this case, - // Func is being filled in automatically. We want to make sure ErrorFunc can return a Promise, - // but we don't want the extra overhead of promise chaining if ErrorFunc doesn't actually - // return a promise. So we make our Func return match ErrorFunc. - return then(_::IdentityFunc()))>(), - kj::fwd(errorHandler)); -} - -template -T Promise::wait(WaitScope& waitScope) { - _::ExceptionOr<_::FixVoid> result; - - waitImpl(kj::mv(node), result, waitScope); - - KJ_IF_MAYBE(value, result.value) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - return _::returnMaybeVoid(kj::mv(*value)); - } else KJ_IF_MAYBE(exception, result.exception) { - throwFatalException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template <> -inline void Promise::wait(WaitScope& waitScope) { - // Override case to use throwRecoverableException(). - - _::ExceptionOr<_::Void> result; - - waitImpl(kj::mv(node), result, waitScope); - - if (result.value != nullptr) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - } else KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template -ForkedPromise Promise::fork() { - return ForkedPromise(false, refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))); -} - -template -Promise ForkedPromise::addBranch() { - return hub->addBranch(); -} - -template -_::SplitTuplePromise Promise::split() { - return refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))->split(); -} - -template -Promise Promise::exclusiveJoin(Promise&& other) { - return Promise(false, heap<_::ExclusiveJoinPromiseNode>(kj::mv(node), kj::mv(other.node))); -} - -template -template -Promise Promise::attach(Attachments&&... attachments) { - return Promise(false, kj::heap<_::AttachmentPromiseNode>>( - kj::mv(node), kj::tuple(kj::fwd(attachments)...))); -} - -template -template -Promise Promise::eagerlyEvaluate(ErrorFunc&& errorHandler) { - // See catch_() for commentary. - return Promise(false, _::spark<_::FixVoid>(then( - _::IdentityFunc()))>(), - kj::fwd(errorHandler)).node)); -} - -template -Promise Promise::eagerlyEvaluate(decltype(nullptr)) { - return Promise(false, _::spark<_::FixVoid>(kj::mv(node))); -} - -template -kj::String Promise::trace() { - return PromiseBase::trace(); -} - -template -inline PromiseForResult evalLater(Func&& func) { - return _::yield().then(kj::fwd(func), _::PropagateException()); -} - -template -inline PromiseForResult evalNow(Func&& func) { - PromiseForResult result = nullptr; - KJ_IF_MAYBE(e, kj::runCatchingExceptions([&]() { - result = func(); - })) { - result = kj::mv(*e); - } - return result; -} - -template -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([](T&&) {}, kj::fwd(errorHandler))); -} - -template <> -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([]() {}, kj::fwd(errorHandler))); -} - -template -Promise> joinPromises(Array>&& promises) { - return Promise>(false, kj::heap<_::ArrayJoinPromiseNode>( - KJ_MAP(p, promises) { return kj::mv(p.node); }, - heapArray<_::ExceptionOr>(promises.size()))); -} - -// ======================================================================================= - -namespace _ { // private - -template -class WeakFulfiller final: public PromiseFulfiller, private kj::Disposer { - // A wrapper around PromiseFulfiller which can be detached. - // - // There are a couple non-trivialities here: - // - If the WeakFulfiller is discarded, we want the promise it fulfills to be implicitly - // rejected. - // - We cannot destroy the WeakFulfiller until the application has discarded it *and* it has been - // detached from the underlying fulfiller, because otherwise the later detach() call will go - // to a dangling pointer. Essentially, WeakFulfiller is reference counted, although the - // refcount never goes over 2 and we manually implement the refcounting because we need to do - // other special things when each side detaches anyway. To this end, WeakFulfiller is its own - // Disposer -- dispose() is called when the application discards its owned pointer to the - // fulfiller and detach() is called when the promise is destroyed. - -public: - KJ_DISALLOW_COPY(WeakFulfiller); - - static kj::Own make() { - WeakFulfiller* ptr = new WeakFulfiller; - return Own(ptr, *ptr); - } - - void fulfill(FixVoid&& value) override { - if (inner != nullptr) { - inner->fulfill(kj::mv(value)); - } - } - - void reject(Exception&& exception) override { - if (inner != nullptr) { - inner->reject(kj::mv(exception)); - } - } - - bool isWaiting() override { - return inner != nullptr && inner->isWaiting(); - } - - void attach(PromiseFulfiller& newInner) { - inner = &newInner; - } - - void detach(PromiseFulfiller& from) { - if (inner == nullptr) { - // Already disposed. - delete this; - } else { - KJ_IREQUIRE(inner == &from); - inner = nullptr; - } - } - -private: - mutable PromiseFulfiller* inner; - - WeakFulfiller(): inner(nullptr) {} - - void disposeImpl(void* pointer) const override { - // TODO(perf): Factor some of this out so it isn't regenerated for every fulfiller type? - - if (inner == nullptr) { - // Already detached. - delete this; - } else { - if (inner->isWaiting()) { - inner->reject(kj::Exception(kj::Exception::Type::FAILED, __FILE__, __LINE__, - kj::heapString("PromiseFulfiller was destroyed without fulfilling the promise."))); - } - inner = nullptr; - } - } -}; - -template -class PromiseAndFulfillerAdapter { -public: - PromiseAndFulfillerAdapter(PromiseFulfiller& fulfiller, - WeakFulfiller& wrapper) - : fulfiller(fulfiller), wrapper(wrapper) { - wrapper.attach(fulfiller); - } - - ~PromiseAndFulfillerAdapter() noexcept(false) { - wrapper.detach(fulfiller); - } - -private: - PromiseFulfiller& fulfiller; - WeakFulfiller& wrapper; -}; - -} // namespace _ (private) - -template -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams) { - return Promise(false, heap<_::AdapterPromiseNode<_::FixVoid, Adapter>>( - kj::fwd(adapterConstructorParams)...)); -} - -template -PromiseFulfillerPair newPromiseAndFulfiller() { - auto wrapper = _::WeakFulfiller::make(); - - Own<_::PromiseNode> intermediate( - heap<_::AdapterPromiseNode<_::FixVoid, _::PromiseAndFulfillerAdapter>>(*wrapper)); - Promise<_::JoinPromises> promise(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); - - return PromiseFulfillerPair { kj::mv(promise), kj::mv(wrapper) }; -} - -} // namespace kj - -#endif // KJ_ASYNC_INL_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async-io.h b/phonelibs/capnp-cpp/include/kj/async-io.h deleted file mode 100644 index 2804ed7289..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async-io.h +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_IO_H_ -#define KJ_ASYNC_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "function.h" -#include "thread.h" -#include "time.h" - -struct sockaddr; - -namespace kj { - -#if _WIN32 -class Win32EventPort; -#else -class UnixEventPort; -#endif - -class NetworkAddress; -class AsyncOutputStream; - -// ======================================================================================= -// Streaming I/O - -class AsyncInputStream { - // Asynchronous equivalent of InputStream (from io.h). - -public: - virtual Promise read(void* buffer, size_t minBytes, size_t maxBytes); - virtual Promise tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - - Promise read(void* buffer, size_t bytes); - - virtual Maybe tryGetLength(); - // Get the remaining number of bytes that will be produced by this stream, if known. - // - // This is used e.g. to fill in the Content-Length header of an HTTP message. If unknown, the - // HTTP implementation may need to fall back to Transfer-Encoding: chunked. - // - // The default implementation always returns null. - - virtual Promise pumpTo( - AsyncOutputStream& output, uint64_t amount = kj::maxValue); - // Read `amount` bytes from this stream (or to EOF) and write them to `output`, returning the - // total bytes actually pumped (which is only less than `amount` if EOF was reached). - // - // Override this if your stream type knows how to pump itself to certain kinds of output - // streams more efficiently than via the naive approach. You can use - // kj::dynamicDowncastIfAvailable() to test for stream types you recognize, and if none match, - // delegate to the default implementation. - // - // The default implementation first tries calling output.tryPumpFrom(), but if that fails, it - // performs a naive pump by allocating a buffer and reading to it / writing from it in a loop. - - Promise> readAllBytes(); - Promise readAllText(); - // Read until EOF and return as one big byte array or string. -}; - -class AsyncOutputStream { - // Asynchronous equivalent of OutputStream (from io.h). - -public: - virtual Promise write(const void* buffer, size_t size) KJ_WARN_UNUSED_RESULT = 0; - virtual Promise write(ArrayPtr> pieces) - KJ_WARN_UNUSED_RESULT = 0; - - virtual Maybe> tryPumpFrom( - AsyncInputStream& input, uint64_t amount = kj::maxValue); - // Implements double-dispatch for AsyncInputStream::pumpTo(). - // - // This method should only be called from within an implementation of pumpTo(). - // - // This method examines the type of `input` to find optimized ways to pump data from it to this - // output stream. If it finds one, it performs the pump. Otherwise, it returns null. - // - // The default implementation always returns null. -}; - -class AsyncIoStream: public AsyncInputStream, public AsyncOutputStream { - // A combination input and output stream. - -public: - virtual void shutdownWrite() = 0; - // Cleanly shut down just the write end of the stream, while keeping the read end open. - - virtual void abortRead() {} - // Similar to shutdownWrite, but this will shut down the read end of the stream, and should only - // be called when an error has occurred. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception - // if the stream is not a socket or the option is not appropriate for the socket type. The - // default implementations always throw "unimplemented". - - virtual void getsockname(struct sockaddr* addr, uint* length); - virtual void getpeername(struct sockaddr* addr, uint* length); - // Corresponds to getsockname() and getpeername() syscalls. Will throw an "unimplemented" - // exception if the stream is not a socket. The default implementations always throw - // "unimplemented". - // - // Note that we don't provide methods that return NetworkAddress because it usually wouldn't - // be useful. You can't connect() to or listen() on these addresses, obviously, because they are - // ephemeral addresses for a single connection. -}; - -struct OneWayPipe { - // A data pipe with an input end and an output end. (Typically backed by pipe() system call.) - - Own in; - Own out; -}; - -struct TwoWayPipe { - // A data pipe that supports sending in both directions. Each end's output sends data to the - // other end's input. (Typically backed by socketpair() system call.) - - Own ends[2]; -}; - -class ConnectionReceiver { - // Represents a server socket listening on a port. - -public: - virtual Promise> accept() = 0; - // Accept the next incoming connection. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Datagram I/O - -class AncillaryMessage { - // Represents an ancillary message (aka control message) received using the recvmsg() system - // call (or equivalent). Most apps will not use this. - -public: - inline AncillaryMessage(int level, int type, ArrayPtr data); - AncillaryMessage() = default; - - inline int getLevel() const; - // Originating protocol / socket level. - - inline int getType() const; - // Protocol-specific message type. - - template - inline Maybe as(); - // Interpret the ancillary message as the given struct type. Most ancillary messages are some - // sort of struct, so this is a convenient way to access it. Returns nullptr if the message - // is smaller than the struct -- this can happen if the message was truncated due to - // insufficient ancillary buffer space. - - template - inline ArrayPtr asArray(); - // Interpret the ancillary message as an array of items. If the message size does not evenly - // divide into elements of type T, the remainder is discarded -- this can happen if the message - // was truncated due to insufficient ancillary buffer space. - -private: - int level; - int type; - ArrayPtr data; - // Message data. In most cases you should use `as()` or `asArray()`. -}; - -class DatagramReceiver { - // Class encapsulating the recvmsg() system call. You must specify the DatagramReceiver's - // capacity in advance; if a received packet is larger than the capacity, it will be truncated. - -public: - virtual Promise receive() = 0; - // Receive a new message, overwriting this object's content. - // - // receive() may reuse the same buffers for content and ancillary data with each call. - - template - struct MaybeTruncated { - T value; - - bool isTruncated; - // True if the Receiver's capacity was insufficient to receive the value and therefore the - // value is truncated. - }; - - virtual MaybeTruncated> getContent() = 0; - // Get the content of the datagram. - - virtual MaybeTruncated> getAncillary() = 0; - // Ancilarry messages received with the datagram. See the recvmsg() system call and the cmsghdr - // struct. Most apps don't need this. - // - // If the returned value is truncated, then the last message in the array may itself be - // truncated, meaning its as() method will return nullptr or its asArray() method will - // return fewer elements than expected. Truncation can also mean that additional messages were - // available but discarded. - - virtual NetworkAddress& getSource() = 0; - // Get the datagram sender's address. - - struct Capacity { - size_t content = 8192; - // How much space to allocate for the datagram content. If a datagram is received that is - // larger than this, it will be truncated, with no way to recover the tail. - - size_t ancillary = 0; - // How much space to allocate for ancillary messages. As with content, if the ancillary data - // is larger than this, it will be truncated. - }; -}; - -class DatagramPort { -public: - virtual Promise send(const void* buffer, size_t size, NetworkAddress& destination) = 0; - virtual Promise send(ArrayPtr> pieces, - NetworkAddress& destination) = 0; - - virtual Own makeReceiver( - DatagramReceiver::Capacity capacity = DatagramReceiver::Capacity()) = 0; - // Create a new `Receiver` that can be used to receive datagrams. `capacity` specifies how much - // space to allocate for the received message. The `DatagramPort` must outlive the `Receiver`. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Networks - -class NetworkAddress { - // Represents a remote address to which the application can connect. - -public: - virtual Promise> connect() = 0; - // Make a new connection to this address. - // - // The address must not be a wildcard ("*"). If it is an IP address, it must have a port number. - - virtual Own listen() = 0; - // Listen for incoming connections on this address. - // - // The address must be local. - - virtual Own bindDatagramPort(); - // Open this address as a datagram (e.g. UDP) port. - // - // The address must be local. - - virtual Own clone() = 0; - // Returns an equivalent copy of this NetworkAddress. - - virtual String toString() = 0; - // Produce a human-readable string which hopefully can be passed to Network::parseAddress() - // to reproduce this address, although whether or not that works of course depends on the Network - // implementation. This should be called only to display the address to human users, who will - // hopefully know what they are able to do with it. -}; - -class Network { - // Factory for NetworkAddress instances, representing the network services offered by the - // operating system. - // - // This interface typically represents broad authority, and well-designed code should limit its - // use to high-level startup code and user interaction. Low-level APIs should accept - // NetworkAddress instances directly and work from there, if at all possible. - -public: - virtual Promise> parseAddress(StringPtr addr, uint portHint = 0) = 0; - // Construct a network address from a user-provided string. The format of the address - // strings is not specified at the API level, and application code should make no assumptions - // about them. These strings should always be provided by humans, and said humans will know - // what format to use in their particular context. - // - // `portHint`, if provided, specifies the "standard" IP port number for the application-level - // service in play. If the address turns out to be an IP address (v4 or v6), and it lacks a - // port number, this port will be used. If `addr` lacks a port number *and* `portHint` is - // omitted, then the returned address will only support listen() and bindDatagramPort() - // (not connect()), and an unused port will be chosen each time one of those methods is called. - - virtual Own getSockaddr(const void* sockaddr, uint len) = 0; - // Construct a network address from a legacy struct sockaddr. -}; - -// ======================================================================================= -// I/O Provider - -class AsyncIoProvider { - // Class which constructs asynchronous wrappers around the operating system's I/O facilities. - // - // Generally, the implementation of this interface must integrate closely with a particular - // `EventLoop` implementation. Typically, the EventLoop implementation itself will provide - // an AsyncIoProvider. - -public: - virtual OneWayPipe newOneWayPipe() = 0; - // Creates an input/output stream pair representing the ends of a one-way pipe (e.g. created with - // the pipe(2) system call). - - virtual TwoWayPipe newTwoWayPipe() = 0; - // Creates two AsyncIoStreams representing the two ends of a two-way pipe (e.g. created with - // socketpair(2) system call). Data written to one end can be read from the other. - - virtual Network& getNetwork() = 0; - // Creates a new `Network` instance representing the networks exposed by the operating system. - // - // DO NOT CALL THIS except at the highest levels of your code, ideally in the main() function. If - // you call this from low-level code, then you are preventing higher-level code from injecting an - // alternative implementation. Instead, if your code needs to use network functionality, it - // should ask for a `Network` as a constructor or method parameter, so that higher-level code can - // chose what implementation to use. The system network is essentially a singleton. See: - // http://www.object-oriented-security.org/lets-argue/singletons - // - // Code that uses the system network should not make any assumptions about what kinds of - // addresses it will parse, as this could differ across platforms. String addresses should come - // strictly from the user, who will know how to write them correctly for their system. - // - // With that said, KJ currently supports the following string address formats: - // - IPv4: "1.2.3.4", "1.2.3.4:80" - // - IPv6: "1234:5678::abcd", "[1234:5678::abcd]:80" - // - Local IP wildcard (covers both v4 and v6): "*", "*:80" - // - Symbolic names: "example.com", "example.com:80", "example.com:http", "1.2.3.4:http" - // - Unix domain: "unix:/path/to/socket" - - struct PipeThread { - // A combination of a thread and a two-way pipe that communicates with that thread. - // - // The fields are intentionally ordered so that the pipe will be destroyed (and therefore - // disconnected) before the thread is destroyed (and therefore joined). Thus if the thread - // arranges to exit when it detects disconnect, destruction should be clean. - - Own thread; - Own pipe; - }; - - virtual PipeThread newPipeThread( - Function startFunc) = 0; - // Create a new thread and set up a two-way pipe (socketpair) which can be used to communicate - // with it. One end of the pipe is passed to the thread's start function and the other end of - // the pipe is returned. The new thread also gets its own `AsyncIoProvider` instance and will - // already have an active `EventLoop` when `startFunc` is called. - // - // TODO(someday): I'm not entirely comfortable with this interface. It seems to be doing too - // much at once but I'm not sure how to cleanly break it down. - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -class LowLevelAsyncIoProvider { - // Similar to `AsyncIoProvider`, but represents a lower-level interface that may differ on - // different operating systems. You should prefer to use `AsyncIoProvider` over this interface - // whenever possible, as `AsyncIoProvider` is portable and friendlier to dependency-injection. - // - // On Unix, this interface can be used to import native file descriptors into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as poll vs. epoll vs. kqueue vs. some higher-level event library. - // - // On Windows, this interface can be used to import native HANDLEs into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as I/O completion ports vs. completion routines. - // - // TODO(port): Actually implement Windows support. - -public: - // --------------------------------------------------------------------------- - // Unix-specific stuff - - enum Flags { - // Flags controlling how to wrap a file descriptor. - - TAKE_OWNERSHIP = 1 << 0, - // The returned object should own the file descriptor, automatically closing it when destroyed. - // The close-on-exec flag will be set on the descriptor if it is not already. - // - // If this flag is not used, then the file descriptor is not automatically closed and the - // close-on-exec flag is not modified. - -#if !_WIN32 - ALREADY_CLOEXEC = 1 << 1, - // Indicates that the close-on-exec flag is known already to be set, so need not be set again. - // Only relevant when combined with TAKE_OWNERSHIP. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // set the close-on-exec flag immediately. Unfortunately, other OS's do not. - - ALREADY_NONBLOCK = 1 << 2 - // Indicates that the file descriptor is known already to be in non-blocking mode, so the flag - // need not be set again. Otherwise, all wrap*Fd() methods will enable non-blocking mode - // automatically. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // enable non-blocking mode immediately. Unfortunately, other OS's do not. -#endif - }; - -#if _WIN32 - typedef uintptr_t Fd; - // On Windows, the `fd` parameter to each of these methods must be a SOCKET, and must have the - // flag WSA_FLAG_OVERLAPPED (which socket() uses by default, but WSASocket() wants you to specify - // explicitly). -#else - typedef int Fd; - // On Unix, any arbitrary file descriptor is supported. -#endif - - virtual Own wrapInputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncInputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapOutputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncOutputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Promise> wrapConnectingSocketFd( - Fd fd, const struct sockaddr* addr, uint addrlen, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket and initiate a connection to the given address. - // The returned promise does not resolve until connection has completed. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapListenSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a listen socket file descriptor. This socket should already - // have had `bind()` and `listen()` called on it, so it's ready for `accept()`. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapDatagramSocketFd(Fd fd, uint flags = 0); - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -Own newAsyncIoProvider(LowLevelAsyncIoProvider& lowLevel); -// Make a new AsyncIoProvider wrapping a `LowLevelAsyncIoProvider`. - -struct AsyncIoContext { - Own lowLevelProvider; - Own provider; - WaitScope& waitScope; - -#if _WIN32 - Win32EventPort& win32EventPort; -#else - UnixEventPort& unixEventPort; - // TEMPORARY: Direct access to underlying UnixEventPort, mainly for waiting on signals. This - // field will go away at some point when we have a chance to improve these interfaces. -#endif -}; - -AsyncIoContext setupAsyncIo(); -// Convenience method which sets up the current thread with everything it needs to do async I/O. -// The returned objects contain an `EventLoop` which is wrapping an appropriate `EventPort` for -// doing I/O on the host system, so everything is ready for the thread to start making async calls -// and waiting on promises. -// -// You would typically call this in your main() loop or in the start function of a thread. -// Example: -// -// int main() { -// auto ioContext = kj::setupAsyncIo(); -// -// // Now we can call an async function. -// Promise textPromise = getHttp(*ioContext.provider, "http://example.com"); -// -// // And we can wait for the promise to complete. Note that you can only use `wait()` -// // from the top level, not from inside a promise callback. -// String text = textPromise.wait(ioContext.waitScope); -// print(text); -// return 0; -// } -// -// WARNING: An AsyncIoContext can only be used in the thread and process that created it. In -// particular, note that after a fork(), an AsyncIoContext created in the parent process will -// not work correctly in the child, even if the parent ceases to use its copy. In particular -// note that this means that server processes which daemonize themselves at startup must wait -// until after daemonization to create an AsyncIoContext. - -// ======================================================================================= -// inline implementation details - -inline AncillaryMessage::AncillaryMessage( - int level, int type, ArrayPtr data) - : level(level), type(type), data(data) {} - -inline int AncillaryMessage::getLevel() const { return level; } -inline int AncillaryMessage::getType() const { return type; } - -template -inline Maybe AncillaryMessage::as() { - if (data.size() >= sizeof(T)) { - return *reinterpret_cast(data.begin()); - } else { - return nullptr; - } -} - -template -inline ArrayPtr AncillaryMessage::asArray() { - return arrayPtr(reinterpret_cast(data.begin()), data.size() / sizeof(T)); -} - -} // namespace kj - -#endif // KJ_ASYNC_IO_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async-prelude.h b/phonelibs/capnp-cpp/include/kj/async-prelude.h deleted file mode 100644 index 0a5843f88a..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async-prelude.h +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before async.h can start. -// We don't define these directly in async.h because it makes the file hard to read. - -#ifndef KJ_ASYNC_PRELUDE_H_ -#define KJ_ASYNC_PRELUDE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "exception.h" -#include "tuple.h" - -namespace kj { - -class EventLoop; -template -class Promise; -class WaitScope; - -template -Promise> joinPromises(Array>&& promises); -Promise joinPromises(Array>&& promises); - -namespace _ { // private - -template struct JoinPromises_ { typedef T Type; }; -template struct JoinPromises_> { typedef T Type; }; - -template -using JoinPromises = typename JoinPromises_::Type; -// If T is Promise, resolves to U, otherwise resolves to T. -// -// TODO(cleanup): Rename to avoid confusion with joinPromises() call which is completely -// unrelated. - -class PropagateException { - // A functor which accepts a kj::Exception as a parameter and returns a broken promise of - // arbitrary type which simply propagates the exception. -public: - class Bottom { - public: - Bottom(Exception&& exception): exception(kj::mv(exception)) {} - - Exception asException() { return kj::mv(exception); } - - private: - Exception exception; - }; - - Bottom operator()(Exception&& e) { - return Bottom(kj::mv(e)); - } - Bottom operator()(const Exception& e) { - return Bottom(kj::cp(e)); - } -}; - -template -struct ReturnType_ { typedef decltype(instance()(instance())) Type; }; -template -struct ReturnType_ { typedef decltype(instance()()) Type; }; - -template -using ReturnType = typename ReturnType_::Type; -// The return type of functor Func given a parameter of type T, with the special exception that if -// T is void, this is the return type of Func called with no arguments. - -template struct SplitTuplePromise_ { typedef Promise Type; }; -template -struct SplitTuplePromise_> { - typedef kj::Tuple>...> Type; -}; - -template -using SplitTuplePromise = typename SplitTuplePromise_::Type; -// T -> Promise -// Tuple -> Tuple> - -struct Void {}; -// Application code should NOT refer to this! See `kj::READY_NOW` instead. - -template struct FixVoid_ { typedef T Type; }; -template <> struct FixVoid_ { typedef Void Type; }; -template using FixVoid = typename FixVoid_::Type; -// FixVoid is just T unless T is void in which case it is _::Void (an empty struct). - -template struct UnfixVoid_ { typedef T Type; }; -template <> struct UnfixVoid_ { typedef void Type; }; -template using UnfixVoid = typename UnfixVoid_::Type; -// UnfixVoid is the opposite of FixVoid. - -template -struct MaybeVoidCaller { - // Calls the function converting a Void input to an empty parameter list and a void return - // value to a Void output. - - template - static inline Out apply(Func& func, In&& in) { - return func(kj::mv(in)); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, In& in) { - return func(in); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, Void&& in) { - return func(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In&& in) { - func(kj::mv(in)); - return Void(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In& in) { - func(in); - return Void(); - } -}; -template <> -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, Void&& in) { - func(); - return Void(); - } -}; - -template -inline T&& returnMaybeVoid(T&& t) { - return kj::fwd(t); -} -inline void returnMaybeVoid(Void&& v) {} - -class ExceptionOrValue; -class PromiseNode; -class ChainPromiseNode; -template -class ForkHub; - -class TaskSetImpl; - -class Event; - -class PromiseBase { -public: - kj::String trace(); - // Dump debug info about this promise. - -private: - Own node; - - PromiseBase() = default; - PromiseBase(Own&& node): node(kj::mv(node)) {} - - friend class kj::EventLoop; - friend class ChainPromiseNode; - template - friend class kj::Promise; - friend class TaskSetImpl; - template - friend Promise> kj::joinPromises(Array>&& promises); - friend Promise kj::joinPromises(Array>&& promises); -}; - -void detach(kj::Promise&& promise); -void waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, WaitScope& waitScope); -Promise yield(); -Own neverDone(); - -class NeverDone { -public: - template - operator Promise() const { - return Promise(false, neverDone()); - } - - KJ_NORETURN(void wait(WaitScope& waitScope) const); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_ASYNC_PRELUDE_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async-unix.h b/phonelibs/capnp-cpp/include/kj/async-unix.h deleted file mode 100644 index 06f128a50e..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async-unix.h +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_UNIX_H_ -#define KJ_ASYNC_UNIX_H_ - -#if _WIN32 -#error "This file is Unix-specific. On Windows, include async-win32.h instead." -#endif - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "time.h" -#include "vector.h" -#include "io.h" -#include - -#if __linux__ && !__BIONIC__ && !defined(KJ_USE_EPOLL) -// Default to epoll on Linux, except on Bionic (Android) which doesn't have signalfd.h. -#define KJ_USE_EPOLL 1 -#endif - -namespace kj { - -class UnixEventPort: public EventPort { - // An EventPort implementation which can wait for events on file descriptors as well as signals. - // This API only makes sense on Unix. - // - // The implementation uses `poll()` or possibly a platform-specific API (e.g. epoll, kqueue). - // To also wait on signals without race conditions, the implementation may block signals until - // just before `poll()` while using a signal handler which `siglongjmp()`s back to just before - // the signal was unblocked, or it may use a nicer platform-specific API like signalfd. - // - // The implementation reserves a signal for internal use. By default, it uses SIGUSR1. If you - // need to use SIGUSR1 for something else, you must offer a different signal by calling - // setReservedSignal() at startup. - // - // WARNING: A UnixEventPort can only be used in the thread and process that created it. In - // particular, note that after a fork(), a UnixEventPort created in the parent process will - // not work correctly in the child, even if the parent ceases to use its copy. In particular - // note that this means that server processes which daemonize themselves at startup must wait - // until after daemonization to create a UnixEventPort. - -public: - UnixEventPort(); - ~UnixEventPort() noexcept(false); - - class FdObserver; - // Class that watches an fd for readability or writability. See definition below. - - Promise onSignal(int signum); - // When the given signal is delivered to this thread, return the corresponding siginfo_t. - // The signal must have been captured using `captureSignal()`. - // - // If `onSignal()` has not been called, the signal will remain blocked in this thread. - // Therefore, a signal which arrives before `onSignal()` was called will not be "missed" -- the - // next call to 'onSignal()' will receive it. Also, you can control which thread receives a - // process-wide signal by only calling `onSignal()` on that thread's event loop. - // - // The result of waiting on the same signal twice at once is undefined. - - static void captureSignal(int signum); - // Arranges for the given signal to be captured and handled via UnixEventPort, so that you may - // then pass it to `onSignal()`. This method is static because it registers a signal handler - // which applies process-wide. If any other threads exist in the process when `captureSignal()` - // is called, you *must* set the signal mask in those threads to block this signal, otherwise - // terrible things will happen if the signal happens to be delivered to those threads. If at - // all possible, call `captureSignal()` *before* creating threads, so that threads you create in - // the future will inherit the proper signal mask. - // - // To un-capture a signal, simply install a different signal handler and then un-block it from - // the signal mask. - - static void setReservedSignal(int signum); - // Sets the signal number which `UnixEventPort` reserves for internal use. If your application - // needs to use SIGUSR1, call this at startup (before any calls to `captureSignal()` and before - // constructing an `UnixEventPort`) to offer a different signal. - - Timer& getTimer() { return timerImpl; } - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - -private: - struct TimerSet; // Defined in source file to avoid STL include. - class TimerPromiseAdapter; - class SignalPromiseAdapter; - - TimerImpl timerImpl; - - SignalPromiseAdapter* signalHead = nullptr; - SignalPromiseAdapter** signalTail = &signalHead; - - TimePoint readClock(); - void gotSignal(const siginfo_t& siginfo); - - friend class TimerPromiseAdapter; - -#if KJ_USE_EPOLL - AutoCloseFd epollFd; - AutoCloseFd signalFd; - AutoCloseFd eventFd; // Used for cross-thread wakeups. - - sigset_t signalFdSigset; - // Signal mask as currently set on the signalFd. Tracked so we can detect whether or not it - // needs updating. - - bool doEpollWait(int timeout); - -#else - class PollContext; - - FdObserver* observersHead = nullptr; - FdObserver** observersTail = &observersHead; - - unsigned long long threadId; // actually pthread_t -#endif -}; - -class UnixEventPort::FdObserver { - // Object which watches a file descriptor to determine when it is readable or writable. - // - // For listen sockets, "readable" means that there is a connection to accept(). For everything - // else, it means that read() (or recv()) will return data. - // - // The presence of out-of-band data should NOT fire this event. However, the event may - // occasionally fire spuriously (when there is actually no data to read), and one thing that can - // cause such spurious events is the arrival of OOB data on certain platforms whose event - // interfaces fail to distinguish between regular and OOB data (e.g. Mac OSX). - // - // WARNING: The exact behavior of this class differs across systems, since event interfaces - // vary wildly. Be sure to read the documentation carefully and avoid depending on unspecified - // behavior. If at all possible, use the higher-level AsyncInputStream interface instead. - -public: - enum Flags { - OBSERVE_READ = 1, - OBSERVE_WRITE = 2, - OBSERVE_URGENT = 4, - OBSERVE_READ_WRITE = OBSERVE_READ | OBSERVE_WRITE - }; - - FdObserver(UnixEventPort& eventPort, int fd, uint flags); - // Begin watching the given file descriptor for readability. Only one ReadObserver may exist - // for a given file descriptor at a time. - - ~FdObserver() noexcept(false); - - KJ_DISALLOW_COPY(FdObserver); - - Promise whenBecomesReadable(); - // Resolves the next time the file descriptor transitions from having no data to read to having - // some data to read. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already data in the read buffer which has been there since - // prior to the last turn of the event loop or prior to creation FdWatcher. In this case, it is - // unspecified whether the promise will ever resolve -- it depends on the underlying event - // mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesReadable()` - // only at times when you know the buffer is empty. You know this for sure when one of the - // following happens: - // * read() or recv() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * The file descriptor is a regular byte-oriented object (like a socket or pipe), - // read() or recv() returns fewer than the number of bytes requested, and `atEndHint()` - // returns false. This can only happen if the buffer is empty but EOF is not reached. (Note, - // though, that for record-oriented file descriptors like Linux's inotify interface, this - // rule does not hold, because it could simply be that the next record did not fit into the - // space available.) - // - // It is an error to call `whenBecomesReadable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - inline Maybe atEndHint() { return atEnd; } - // Returns true if the event system has indicated that EOF has been received. There may still - // be data in the read buffer, but once that is gone, there's nothing left. - // - // Returns false if the event system has indicated that EOF had NOT been received as of the - // last turn of the event loop. - // - // Returns nullptr if the event system does not know whether EOF has been reached. In this - // case, the only way to know for sure is to call read() or recv() and check if it returns - // zero. - // - // This hint may be useful as an optimization to avoid an unnecessary system call. - - Promise whenBecomesWritable(); - // Resolves the next time the file descriptor transitions from having no space available in the - // write buffer to having some space available. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already space in the write buffer which has been there - // since prior to the last turn of the event loop or prior to creation FdWatcher. In this case, - // it is unspecified whether the promise will ever resolve -- it depends on the underlying - // event mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesWritable()` - // only at times when you know the buffer is full. You know this for sure when one of the - // following happens: - // * write() or send() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * write() or send() succeeds but accepts fewer than the number of bytes provided. This can - // only happen if the buffer is full. - // - // It is an error to call `whenBecomesWritable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - Promise whenUrgentDataAvailable(); - // Resolves the next time the file descriptor's read buffer contains "urgent" data. - // - // The conditions for availability of urgent data are specific to the file descriptor's - // underlying implementation. - // - // It is an error to call `whenUrgentDataAvailable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - // - // WARNING: This has some known weird behavior on macOS. See - // https://github.com/sandstorm-io/capnproto/issues/374. - -private: - UnixEventPort& eventPort; - int fd; - uint flags; - - kj::Maybe>> readFulfiller; - kj::Maybe>> writeFulfiller; - kj::Maybe>> urgentFulfiller; - // Replaced each time `whenBecomesReadable()` or `whenBecomesWritable()` is called. Reverted to - // null every time an event is fired. - - Maybe atEnd; - - void fire(short events); - -#if !KJ_USE_EPOLL - FdObserver* next; - FdObserver** prev; - // Linked list of observers which currently have a non-null readFulfiller or writeFulfiller. - // If `prev` is null then the observer is not currently in the list. - - short getEventMask(); -#endif - - friend class UnixEventPort; -}; - -} // namespace kj - -#endif // KJ_ASYNC_UNIX_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async-win32.h b/phonelibs/capnp-cpp/include/kj/async-win32.h deleted file mode 100644 index b70c42e016..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async-win32.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_WIN32_H_ -#define KJ_ASYNC_WIN32_H_ - -#if !_WIN32 -#error "This file is Windows-specific. On Unix, include async-unix.h instead." -#endif - -#include "async.h" -#include "time.h" -#include "io.h" -#include -#include - -// Include windows.h as lean as possible. (If you need more of the Windows API for your app, -// #include windows.h yourself before including this header.) -#define WIN32_LEAN_AND_MEAN 1 -#define NOSERVICE 1 -#define NOMCX 1 -#define NOIME 1 -#include -#include "windows-sanity.h" - -namespace kj { - -class Win32EventPort: public EventPort { - // Abstract base interface for EventPorts that can listen on Win32 event types. Due to the - // absurd complexity of the Win32 API, it's not possible to standardize on a single - // implementation of EventPort. In particular, there is no way for a single thread to use I/O - // completion ports (the most efficient way of handling I/O) while at the same time waiting for - // signalable handles or UI messages. - // - // Note that UI messages are not supported at all by this interface because the message queue - // is implemented by user32.dll and we want libkj to depend only on kernel32.dll. A separate - // compat library could provide a Win32EventPort implementation that works with the UI message - // queue. - -public: - // --------------------------------------------------------------------------- - // overlapped I/O - - struct IoResult { - DWORD errorCode; - DWORD bytesTransferred; - }; - - class IoOperation { - public: - virtual LPOVERLAPPED getOverlapped() = 0; - // Gets the OVERLAPPED structure to pass to the Win32 I/O call. Do NOT modify it; just pass it - // on. - - virtual Promise onComplete() = 0; - // After making the Win32 call, if the return value indicates that the operation was - // successfully queued (i.e. the completion event will definitely occur), call this to wait - // for completion. - // - // You MUST call this if the operation was successfully queued, and you MUST NOT call this - // otherwise. If the Win32 call failed (without queuing any operation or event) then you should - // simply drop the IoOperation object. - // - // Dropping the returned Promise cancels the operation via Win32's CancelIoEx(). The destructor - // will wait for the cancellation to complete, such that after dropping the proimse it is safe - // to free the buffer that the operation was reading from / writing to. - // - // You may safely drop the `IoOperation` while still waiting for this promise. You may not, - // however, drop the `IoObserver`. - }; - - class IoObserver { - public: - virtual Own newOperation(uint64_t offset) = 0; - // Begin an I/O operation. For file operations, `offset` is the offset within the file at - // which the operation will start. For stream operations, `offset` is ignored. - }; - - virtual Own observeIo(HANDLE handle) = 0; - // Given a handle which supports overlapped I/O, arrange to receive I/O completion events via - // this EventPort. - // - // Different Win32EventPort implementations may handle this in different ways, such as by using - // completion routines (APCs) or by using I/O completion ports. The caller should not assume - // any particular technique. - // - // WARNING: It is only safe to call observeIo() on a particular handle once during its lifetime. - // You cannot observe the same handle from multiple Win32EventPorts, even if not at the same - // time. This is because the Win32 API provides no way to disassociate a handle from an I/O - // completion port once it is associated. - - // --------------------------------------------------------------------------- - // signalable handles - // - // Warning: Due to limitations in the Win32 API, implementations of EventPort may be forced to - // spawn additional threads to wait for signaled objects. This is necessary if the EventPort - // implementation is based on I/O completion ports, or if you need to wait on more than 64 - // handles at once. - - class SignalObserver { - public: - virtual Promise onSignaled() = 0; - // Returns a promise that completes the next time the handle enters the signaled state. - // - // Depending on the type of handle, the handle may automatically be reset to a non-signaled - // state before the promise resolves. The underlying implementaiton uses WaitForSingleObject() - // or an equivalent wait call, so check the documentation for that to understand the semantics. - // - // If the handle is a mutex and it is abandoned without being unlocked, the promise breaks with - // an exception. - - virtual Promise onSignaledOrAbandoned() = 0; - // Like onSingaled(), but instead of throwing when a mutex is abandoned, resolves to `true`. - // Resolves to `false` for non-abandoned signals. - }; - - virtual Own observeSignalState(HANDLE handle) = 0; - // Given a handle that supports waiting for it to become "signaled" via WaitForSingleObject(), - // return an object that can wait for this state using the EventPort. - - // --------------------------------------------------------------------------- - // APCs - - virtual void allowApc() = 0; - // If this is ever called, the Win32EventPort will switch modes so that APCs can be scheduled - // on the thread, e.g. through the Win32 QueueUserAPC() call. In the future, this may be enabled - // by default. However, as of this writing, Wine does not support the necessary - // GetQueuedCompletionStatusEx() call, thus allowApc() breaks Wine support. (Tested on Wine - // 1.8.7.) - // - // If the event port implementation can't support APCs for some reason, this throws. - - // --------------------------------------------------------------------------- - // time - - virtual Timer& getTimer() = 0; -}; - -class Win32WaitObjectThreadPool { - // Helper class that implements Win32EventPort::observeSignalState() by spawning additional - // threads as needed to perform the actual waiting. - // - // This class is intended to be used to assist in building Win32EventPort implementations. - -public: - Win32WaitObjectThreadPool(uint mainThreadCount = 0); - // `mainThreadCount` indicates the number of objects the main thread is able to listen on - // directly. Typically this would be zero (e.g. if the main thread watches an I/O completion - // port) or MAXIMUM_WAIT_OBJECTS (e.g. if the main thread is a UI thread but can use - // MsgWaitForMultipleObjectsEx() to wait on some handles at the same time as messages). - - Own observeSignalState(HANDLE handle); - // Implemetns Win32EventPort::observeSignalState(). - - uint prepareMainThreadWait(HANDLE* handles[]); - // Call immediately before invoking WaitForMultipleObjects() or similar in the main thread. - // Fills in `handles` with the handle pointers to wait on, and returns the number of handles - // in this array. (The array should be allocated to be at least the size passed to the - // constructor). - // - // There's no need to call this if `mainThreadCount` as passed to the constructor was zero. - - bool finishedMainThreadWait(DWORD returnCode); - // Call immediately after invoking WaitForMultipleObjects() or similar in the main thread, - // passing the value returend by that call. Returns true if the event indicated by `returnCode` - // has been handled (i.e. it was WAIT_OBJECT_n or WAIT_ABANDONED_n where n is in-range for the - // last call to prepareMainThreadWait()). -}; - -class Win32IocpEventPort final: public Win32EventPort { - // An EventPort implementation which uses Windows I/O completion ports to listen for events. - // - // With this implementation, observeSignalState() requires spawning a separate thread. - -public: - Win32IocpEventPort(); - ~Win32IocpEventPort() noexcept(false); - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - - // implements Win32IocpEventPort --------------------------------------------- - Own observeIo(HANDLE handle) override; - Own observeSignalState(HANDLE handle) override; - Timer& getTimer() override { return timerImpl; } - void allowApc() override { isAllowApc = true; } - -private: - class IoPromiseAdapter; - class IoOperationImpl; - class IoObserverImpl; - - AutoCloseHandle iocp; - AutoCloseHandle thread; - Win32WaitObjectThreadPool waitThreads; - TimerImpl timerImpl; - mutable std::atomic sentWake {false}; - bool isAllowApc = false; - - static TimePoint readClock(); - - void waitIocp(DWORD timeoutMs); - // Wait on the I/O completion port for up to timeoutMs and pump events. Does not advance the - // timer; caller must do that. - - bool receivedWake(); - - static AutoCloseHandle newIocpHandle(); - static AutoCloseHandle openCurrentThread(); -}; - -} // namespace kj - -#endif // KJ_ASYNC_WIN32_H_ diff --git a/phonelibs/capnp-cpp/include/kj/async.h b/phonelibs/capnp-cpp/include/kj/async.h deleted file mode 100644 index 5a9d9bdae7..0000000000 --- a/phonelibs/capnp-cpp/include/kj/async.h +++ /dev/null @@ -1,682 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_H_ -#define KJ_ASYNC_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async-prelude.h" -#include "exception.h" -#include "refcount.h" - -namespace kj { - -class EventLoop; -class WaitScope; - -template -class Promise; -template -class ForkedPromise; -template -class PromiseFulfiller; -template -struct PromiseFulfillerPair; - -template -using PromiseForResult = Promise<_::JoinPromises<_::ReturnType>>; -// Evaluates to the type of Promise for the result of calling functor type Func with parameter type -// T. If T is void, then the promise is for the result of calling Func with no arguments. If -// Func itself returns a promise, the promises are joined, so you never get Promise>. - -// ======================================================================================= -// Promises - -template -class Promise: protected _::PromiseBase { - // The basic primitive of asynchronous computation in KJ. Similar to "futures", but designed - // specifically for event loop concurrency. Similar to E promises and JavaScript Promises/A. - // - // A Promise represents a promise to produce a value of type T some time in the future. Once - // that value has been produced, the promise is "fulfilled". Alternatively, a promise can be - // "broken", with an Exception describing what went wrong. You may implicitly convert a value of - // type T to an already-fulfilled Promise. You may implicitly convert the constant - // `kj::READY_NOW` to an already-fulfilled Promise. You may also implicitly convert a - // `kj::Exception` to an already-broken promise of any type. - // - // Promises are linear types -- they are moveable but not copyable. If a Promise is destroyed - // or goes out of scope (without being moved elsewhere), any ongoing asynchronous operations - // meant to fulfill the promise will be canceled if possible. All methods of `Promise` (unless - // otherwise noted) actually consume the promise in the sense of move semantics. (Arguably they - // should be rvalue-qualified, but at the time this interface was created compilers didn't widely - // support that yet and anyway it would be pretty ugly typing kj::mv(promise).whatever().) If - // you want to use one Promise in two different places, you must fork it with `fork()`. - // - // To use the result of a Promise, you must call `then()` and supply a callback function to - // call with the result. `then()` returns another promise, for the result of the callback. - // Any time that this would result in Promise>, the promises are collapsed into a - // simple Promise that first waits for the outer promise, then the inner. Example: - // - // // Open a remote file, read the content, and then count the - // // number of lines of text. - // // Note that none of the calls here block. `file`, `content` - // // and `lineCount` are all initialized immediately before any - // // asynchronous operations occur. The lambda callbacks are - // // called later. - // Promise> file = openFtp("ftp://host/foo/bar"); - // Promise content = file.then( - // [](Own file) -> Promise { - // return file.readAll(); - // }); - // Promise lineCount = content.then( - // [](String text) -> int { - // uint count = 0; - // for (char c: text) count += (c == '\n'); - // return count; - // }); - // - // For `then()` to work, the current thread must have an active `EventLoop`. Each callback - // is scheduled to execute in that loop. Since `then()` schedules callbacks only on the current - // thread's event loop, you do not need to worry about two callbacks running at the same time. - // You will need to set up at least one `EventLoop` at the top level of your program before you - // can use promises. - // - // To adapt a non-Promise-based asynchronous API to promises, use `newAdaptedPromise()`. - // - // Systems using promises should consider supporting the concept of "pipelining". Pipelining - // means allowing a caller to start issuing method calls against a promised object before the - // promise has actually been fulfilled. This is particularly useful if the promise is for a - // remote object living across a network, as this can avoid round trips when chaining a series - // of calls. It is suggested that any class T which supports pipelining implement a subclass of - // Promise which adds "eventual send" methods -- methods which, when called, say "please - // invoke the corresponding method on the promised value once it is available". These methods - // should in turn return promises for the eventual results of said invocations. Cap'n Proto, - // for example, implements the type `RemotePromise` which supports pipelining RPC requests -- see - // `capnp/capability.h`. - // - // KJ Promises are based on E promises: - // http://wiki.erights.org/wiki/Walnut/Distributed_Computing#Promises - // - // KJ Promises are also inspired in part by the evolving standards for JavaScript/ECMAScript - // promises, which are themselves influenced by E promises: - // http://promisesaplus.com/ - // https://github.com/domenic/promises-unwrapping - -public: - Promise(_::FixVoid value); - // Construct an already-fulfilled Promise from a value of type T. For non-void promises, the - // parameter type is simply T. So, e.g., in a function that returns `Promise`, you can - // say `return 123;` to return a promise that is already fulfilled to 123. - // - // For void promises, use `kj::READY_NOW` as the value, e.g. `return kj::READY_NOW`. - - Promise(kj::Exception&& e); - // Construct an already-broken Promise. - - inline Promise(decltype(nullptr)) {} - - template - PromiseForResult then(Func&& func, ErrorFunc&& errorHandler = _::PropagateException()) - KJ_WARN_UNUSED_RESULT; - // Register a continuation function to be executed when the promise completes. The continuation - // (`func`) takes the promised value (an rvalue of type `T`) as its parameter. The continuation - // may return a new value; `then()` itself returns a promise for the continuation's eventual - // result. If the continuation itself returns a `Promise`, then `then()` shall also return - // a `Promise` which first waits for the original promise, then executes the continuation, - // then waits for the inner promise (i.e. it automatically "unwraps" the promise). - // - // In all cases, `then()` returns immediately. The continuation is executed later. The - // continuation is always executed on the same EventLoop (and, therefore, the same thread) which - // called `then()`, therefore no synchronization is necessary on state shared by the continuation - // and the surrounding scope. If no EventLoop is running on the current thread, `then()` throws - // an exception. - // - // You may also specify an error handler continuation as the second parameter. `errorHandler` - // must be a functor taking a parameter of type `kj::Exception&&`. It must return the same - // type as `func` returns (except when `func` returns `Promise`, in which case `errorHandler` - // may return either `Promise` or just `U`). The default error handler simply propagates the - // exception to the returned promise. - // - // Either `func` or `errorHandler` may, of course, throw an exception, in which case the promise - // is broken. When compiled with -fno-exceptions, the framework will still detect when a - // recoverable exception was thrown inside of a continuation and will consider the promise - // broken even though a (presumably garbage) result was returned. - // - // If the returned promise is destroyed before the callback runs, the callback will be canceled - // (it will never run). - // - // Note that `then()` -- like all other Promise methods -- consumes the promise on which it is - // called, in the sense of move semantics. After returning, the original promise is no longer - // valid, but `then()` returns a new promise. - // - // *Advanced implementation tips:* Most users will never need to worry about the below, but - // it is good to be aware of. - // - // As an optimization, if the callback function `func` does _not_ return another promise, then - // execution of `func` itself may be delayed until its result is known to be needed. The - // expectation here is that `func` is just doing some transformation on the results, not - // scheduling any other actions, therefore the system doesn't need to be proactive about - // evaluating it. This way, a chain of trivial then() transformations can be executed all at - // once without repeatedly re-scheduling through the event loop. Use the `eagerlyEvaluate()` - // method to suppress this behavior. - // - // On the other hand, if `func` _does_ return another promise, then the system evaluates `func` - // as soon as possible, because the promise it returns might be for a newly-scheduled - // long-running asynchronous task. - // - // As another optimization, when a callback function registered with `then()` is actually - // scheduled, it is scheduled to occur immediately, preempting other work in the event queue. - // This allows a long chain of `then`s to execute all at once, improving cache locality by - // clustering operations on the same data. However, this implies that starvation can occur - // if a chain of `then()`s takes a very long time to execute without ever stopping to wait for - // actual I/O. To solve this, use `kj::evalLater()` to yield control; this way, all other events - // in the queue will get a chance to run before your callback is executed. - - Promise ignoreResult() KJ_WARN_UNUSED_RESULT { return then([](T&&) {}); } - // Convenience method to convert the promise to a void promise by ignoring the return value. - // - // You must still wait on the returned promise if you want the task to execute. - - template - Promise catch_(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - // Equivalent to `.then(identityFunc, errorHandler)`, where `identifyFunc` is a function that - // just returns its input. - - T wait(WaitScope& waitScope); - // Run the event loop until the promise is fulfilled, then return its result. If the promise - // is rejected, throw an exception. - // - // wait() is primarily useful at the top level of a program -- typically, within the function - // that allocated the EventLoop. For example, a program that performs one or two RPCs and then - // exits would likely use wait() in its main() function to wait on each RPC. On the other hand, - // server-side code generally cannot use wait(), because it has to be able to accept multiple - // requests at once. - // - // If the promise is rejected, `wait()` throws an exception. If the program was compiled without - // exceptions (-fno-exceptions), this will usually abort. In this case you really should first - // use `then()` to set an appropriate handler for the exception case, so that the promise you - // actually wait on never throws. - // - // `waitScope` is an object proving that the caller is in a scope where wait() is allowed. By - // convention, any function which might call wait(), or which might call another function which - // might call wait(), must take `WaitScope&` as one of its parameters. This is needed for two - // reasons: - // * `wait()` is not allowed during an event callback, because event callbacks are themselves - // called during some other `wait()`, and such recursive `wait()`s would only be able to - // complete in LIFO order, which might mean that the outer `wait()` ends up waiting longer - // than it is supposed to. To prevent this, a `WaitScope` cannot be constructed or used during - // an event callback. - // * Since `wait()` runs the event loop, unrelated event callbacks may execute before `wait()` - // returns. This means that anyone calling `wait()` must be reentrant -- state may change - // around them in arbitrary ways. Therefore, callers really need to know if a function they - // are calling might wait(), and the `WaitScope&` parameter makes this clear. - // - // TODO(someday): Implement fibers, and let them call wait() even when they are handling an - // event. - - ForkedPromise fork() KJ_WARN_UNUSED_RESULT; - // Forks the promise, so that multiple different clients can independently wait on the result. - // `T` must be copy-constructable for this to work. Or, in the special case where `T` is - // `Own`, `U` must have a method `Own addRef()` which returns a new reference to the same - // (or an equivalent) object (probably implemented via reference counting). - - _::SplitTuplePromise split(); - // Split a promise for a tuple into a tuple of promises. - // - // E.g. if you have `Promise>`, `split()` returns - // `kj::Tuple, Promise>`. - - Promise exclusiveJoin(Promise&& other) KJ_WARN_UNUSED_RESULT; - // Return a new promise that resolves when either the original promise resolves or `other` - // resolves (whichever comes first). The promise that didn't resolve first is canceled. - - // TODO(someday): inclusiveJoin(), or perhaps just join(), which waits for both completions - // and produces a tuple? - - template - Promise attach(Attachments&&... attachments) KJ_WARN_UNUSED_RESULT; - // "Attaches" one or more movable objects (often, Owns) to the promise, such that they will - // be destroyed when the promise resolves. This is useful when a promise's callback contains - // pointers into some object and you want to make sure the object still exists when the callback - // runs -- after calling then(), use attach() to add necessary objects to the result. - - template - Promise eagerlyEvaluate(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - Promise eagerlyEvaluate(decltype(nullptr)) KJ_WARN_UNUSED_RESULT; - // Force eager evaluation of this promise. Use this if you are going to hold on to the promise - // for awhile without consuming the result, but you want to make sure that the system actually - // processes it. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. We make you specify this because otherwise it's - // easy to forget to handle errors in a promise that you never use. You may specify nullptr for - // the error handler if you are sure that ignoring errors is fine, or if you know that you'll - // eventually wait on the promise somewhere. - - template - void detach(ErrorFunc&& errorHandler); - // Allows the promise to continue running in the background until it completes or the - // `EventLoop` is destroyed. Be careful when using this: since you can no longer cancel this - // promise, you need to make sure that the promise owns all the objects it touches or make sure - // those objects outlive the EventLoop. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. - // - // This function exists mainly to implement the Cap'n Proto requirement that RPC calls cannot be - // canceled unless the callee explicitly permits it. - - kj::String trace(); - // Returns a dump of debug info about this promise. Not for production use. Requires RTTI. - // This method does NOT consume the promise as other methods do. - -private: - Promise(bool, Own<_::PromiseNode>&& node): PromiseBase(kj::mv(node)) {} - // Second parameter prevent ambiguity with immediate-value constructor. - - template - friend class Promise; - friend class EventLoop; - template - friend Promise newAdaptedPromise(Params&&... adapterConstructorParams); - template - friend PromiseFulfillerPair newPromiseAndFulfiller(); - template - friend class _::ForkHub; - friend class _::TaskSetImpl; - friend Promise _::yield(); - friend class _::NeverDone; - template - friend Promise> joinPromises(Array>&& promises); - friend Promise joinPromises(Array>&& promises); -}; - -template -class ForkedPromise { - // The result of `Promise::fork()` and `EventLoop::fork()`. Allows branches to be created. - // Like `Promise`, this is a pass-by-move type. - -public: - inline ForkedPromise(decltype(nullptr)) {} - - Promise addBranch(); - // Add a new branch to the fork. The branch is equivalent to the original promise. - -private: - Own<_::ForkHub<_::FixVoid>> hub; - - inline ForkedPromise(bool, Own<_::ForkHub<_::FixVoid>>&& hub): hub(kj::mv(hub)) {} - - friend class Promise; - friend class EventLoop; -}; - -constexpr _::Void READY_NOW = _::Void(); -// Use this when you need a Promise that is already fulfilled -- this value can be implicitly -// cast to `Promise`. - -constexpr _::NeverDone NEVER_DONE = _::NeverDone(); -// The opposite of `READY_NOW`, return this when the promise should never resolve. This can be -// implicitly converted to any promise type. You may also call `NEVER_DONE.wait()` to wait -// forever (useful for servers). - -template -PromiseForResult evalLater(Func&& func) KJ_WARN_UNUSED_RESULT; -// Schedule for the given zero-parameter function to be executed in the event loop at some -// point in the near future. Returns a Promise for its result -- or, if `func()` itself returns -// a promise, `evalLater()` returns a Promise for the result of resolving that promise. -// -// Example usage: -// Promise x = evalLater([]() { return 123; }); -// -// The above is exactly equivalent to: -// Promise x = Promise(READY_NOW).then([]() { return 123; }); -// -// If the returned promise is destroyed before the callback runs, the callback will be canceled -// (never called). -// -// If you schedule several evaluations with `evalLater` during the same callback, they are -// guaranteed to be executed in order. - -template -PromiseForResult evalNow(Func&& func) KJ_WARN_UNUSED_RESULT; -// Run `func()` and return a promise for its result. `func()` executes before `evalNow()` returns. -// If `func()` throws an exception, the exception is caught and wrapped in a promise -- this is the -// main reason why `evalNow()` is useful. - -template -Promise> joinPromises(Array>&& promises); -// Join an array of promises into a promise for an array. - -// ======================================================================================= -// Hack for creating a lambda that holds an owned pointer. - -template -class CaptureByMove { -public: - inline CaptureByMove(Func&& func, MovedParam&& param) - : func(kj::mv(func)), param(kj::mv(param)) {} - - template - inline auto operator()(Params&&... params) - -> decltype(kj::instance()(kj::instance(), kj::fwd(params)...)) { - return func(kj::mv(param), kj::fwd(params)...); - } - -private: - Func func; - MovedParam param; -}; - -template -inline CaptureByMove> mvCapture(MovedParam&& param, Func&& func) { - // Hack to create a "lambda" which captures a variable by moving it rather than copying or - // referencing. C++14 generalized captures should make this obsolete, but for now in C++11 this - // is commonly needed for Promise continuations that own their state. Example usage: - // - // Own ptr = makeFoo(); - // Promise promise = callRpc(); - // promise.then(mvCapture(ptr, [](Own&& ptr, int result) { - // return ptr->finish(result); - // })); - - return CaptureByMove>(kj::fwd(func), kj::mv(param)); -} - -// ======================================================================================= -// Advanced promise construction - -template -class PromiseFulfiller { - // A callback which can be used to fulfill a promise. Only the first call to fulfill() or - // reject() matters; subsequent calls are ignored. - -public: - virtual void fulfill(T&& value) = 0; - // Fulfill the promise with the given value. - - virtual void reject(Exception&& exception) = 0; - // Reject the promise with an error. - - virtual bool isWaiting() = 0; - // Returns true if the promise is still unfulfilled and someone is potentially waiting for it. - // Returns false if fulfill()/reject() has already been called *or* if the promise to be - // fulfilled has been discarded and therefore the result will never be used anyway. - - template - bool rejectIfThrows(Func&& func); - // Call the function (with no arguments) and return true. If an exception is thrown, call - // `fulfiller.reject()` and then return false. When compiled with exceptions disabled, - // non-fatal exceptions are still detected and handled correctly. -}; - -template <> -class PromiseFulfiller { - // Specialization of PromiseFulfiller for void promises. See PromiseFulfiller. - -public: - virtual void fulfill(_::Void&& value = _::Void()) = 0; - // Call with zero parameters. The parameter is a dummy that only exists so that subclasses don't - // have to specialize for . - - virtual void reject(Exception&& exception) = 0; - virtual bool isWaiting() = 0; - - template - bool rejectIfThrows(Func&& func); -}; - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams); -// Creates a new promise which owns an instance of `Adapter` which encapsulates the operation -// that will eventually fulfill the promise. This is primarily useful for adapting non-KJ -// asynchronous APIs to use promises. -// -// An instance of `Adapter` will be allocated and owned by the returned `Promise`. A -// `PromiseFulfiller&` will be passed as the first parameter to the adapter's constructor, -// and `adapterConstructorParams` will be forwarded as the subsequent parameters. The adapter -// is expected to perform some asynchronous operation and call the `PromiseFulfiller` once -// it is finished. -// -// The adapter is destroyed when its owning Promise is destroyed. This may occur before the -// Promise has been fulfilled. In this case, the adapter's destructor should cancel the -// asynchronous operation. Once the adapter is destroyed, the fulfillment callback cannot be -// called. -// -// An adapter implementation should be carefully written to ensure that it cannot accidentally -// be left unfulfilled permanently because of an exception. Consider making liberal use of -// `PromiseFulfiller::rejectIfThrows()`. - -template -struct PromiseFulfillerPair { - Promise<_::JoinPromises> promise; - Own> fulfiller; -}; - -template -PromiseFulfillerPair newPromiseAndFulfiller(); -// Construct a Promise and a separate PromiseFulfiller which can be used to fulfill the promise. -// If the PromiseFulfiller is destroyed before either of its methods are called, the Promise is -// implicitly rejected. -// -// Although this function is easier to use than `newAdaptedPromise()`, it has the serious drawback -// that there is no way to handle cancellation (i.e. detect when the Promise is discarded). -// -// You can arrange to fulfill a promise with another promise by using a promise type for T. E.g. -// `newPromiseAndFulfiller>()` will produce a promise of type `Promise` but the -// fulfiller will be of type `PromiseFulfiller>`. Thus you pass a `Promise` to the -// `fulfill()` callback, and the promises are chained. - -// ======================================================================================= -// TaskSet - -class TaskSet { - // Holds a collection of Promises and ensures that each executes to completion. Memory - // associated with each promise is automatically freed when the promise completes. Destroying - // the TaskSet itself automatically cancels all unfinished promises. - // - // This is useful for "daemon" objects that perform background tasks which aren't intended to - // fulfill any particular external promise, but which may need to be canceled (and thus can't - // use `Promise::detach()`). The daemon object holds a TaskSet to collect these tasks it is - // working on. This way, if the daemon itself is destroyed, the TaskSet is detroyed as well, - // and everything the daemon is doing is canceled. - -public: - class ErrorHandler { - public: - virtual void taskFailed(kj::Exception&& exception) = 0; - }; - - TaskSet(ErrorHandler& errorHandler); - // `loop` will be used to wait on promises. `errorHandler` will be executed any time a task - // throws an exception, and will execute within the given EventLoop. - - ~TaskSet() noexcept(false); - - void add(Promise&& promise); - - kj::String trace(); - // Return debug info about all promises currently in the TaskSet. - -private: - Own<_::TaskSetImpl> impl; -}; - -// ======================================================================================= -// The EventLoop class - -class EventPort { - // Interfaces between an `EventLoop` and events originating from outside of the loop's thread. - // All such events come in through the `EventPort` implementation. - // - // An `EventPort` implementation may interface with low-level operating system APIs and/or other - // threads. You can also write an `EventPort` which wraps some other (non-KJ) event loop - // framework, allowing the two to coexist in a single thread. - -public: - virtual bool wait() = 0; - // Wait for an external event to arrive, sleeping if necessary. Once at least one event has - // arrived, queue it to the event loop (e.g. by fulfilling a promise) and return. - // - // This is called during `Promise::wait()` whenever the event queue becomes empty, in order to - // wait for new events to populate the queue. - // - // It is safe to return even if nothing has actually been queued, so long as calling `wait()` in - // a loop will eventually sleep. (That is to say, false positives are fine.) - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual bool poll() = 0; - // Check if any external events have arrived, but do not sleep. If any events have arrived, - // add them to the event queue (e.g. by fulfilling promises) before returning. - // - // This may be called during `Promise::wait()` when the EventLoop has been executing for a while - // without a break but is still non-empty. - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual void setRunnable(bool runnable); - // Called to notify the `EventPort` when the `EventLoop` has work to do; specifically when it - // transitions from empty -> runnable or runnable -> empty. This is typically useful when - // integrating with an external event loop; if the loop is currently runnable then you should - // arrange to call run() on it soon. The default implementation does nothing. - - virtual void wake() const; - // Wake up the EventPort's thread from another thread. - // - // Unlike all other methods on this interface, `wake()` may be called from another thread, hence - // it is `const`. - // - // Technically speaking, `wake()` causes the target thread to cease sleeping and not to sleep - // again until `wait()` or `poll()` has returned true at least once. - // - // The default implementation throws an UNIMPLEMENTED exception. -}; - -class EventLoop { - // Represents a queue of events being executed in a loop. Most code won't interact with - // EventLoop directly, but instead use `Promise`s to interact with it indirectly. See the - // documentation for `Promise`. - // - // Each thread can have at most one current EventLoop. To make an `EventLoop` current for - // the thread, create a `WaitScope`. Async APIs require that the thread has a current EventLoop, - // or they will throw exceptions. APIs that use `Promise::wait()` additionally must explicitly - // be passed a reference to the `WaitScope` to make the caller aware that they might block. - // - // Generally, you will want to construct an `EventLoop` at the top level of your program, e.g. - // in the main() function, or in the start function of a thread. You can then use it to - // construct some promises and wait on the result. Example: - // - // int main() { - // // `loop` becomes the official EventLoop for the thread. - // MyEventPort eventPort; - // EventLoop loop(eventPort); - // - // // Now we can call an async function. - // Promise textPromise = getHttp("http://example.com"); - // - // // And we can wait for the promise to complete. Note that you can only use `wait()` - // // from the top level, not from inside a promise callback. - // String text = textPromise.wait(); - // print(text); - // return 0; - // } - // - // Most applications that do I/O will prefer to use `setupAsyncIo()` from `async-io.h` rather - // than allocate an `EventLoop` directly. - -public: - EventLoop(); - // Construct an `EventLoop` which does not receive external events at all. - - explicit EventLoop(EventPort& port); - // Construct an `EventLoop` which receives external events through the given `EventPort`. - - ~EventLoop() noexcept(false); - - void run(uint maxTurnCount = maxValue); - // Run the event loop for `maxTurnCount` turns or until there is nothing left to be done, - // whichever comes first. This never calls the `EventPort`'s `sleep()` or `poll()`. It will - // call the `EventPort`'s `setRunnable(false)` if the queue becomes empty. - - bool isRunnable(); - // Returns true if run() would currently do anything, or false if the queue is empty. - -private: - EventPort& port; - - bool running = false; - // True while looping -- wait() is then not allowed. - - bool lastRunnableState = false; - // What did we last pass to port.setRunnable()? - - _::Event* head = nullptr; - _::Event** tail = &head; - _::Event** depthFirstInsertPoint = &head; - - Own<_::TaskSetImpl> daemons; - - bool turn(); - void setRunnable(bool runnable); - void enterScope(); - void leaveScope(); - - friend void _::detach(kj::Promise&& promise); - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); - friend class _::Event; - friend class WaitScope; -}; - -class WaitScope { - // Represents a scope in which asynchronous programming can occur. A `WaitScope` should usually - // be allocated on the stack and serves two purposes: - // * While the `WaitScope` exists, its `EventLoop` is registered as the current loop for the - // thread. Most operations dealing with `Promise` (including all of its methods) do not work - // unless the thread has a current `EventLoop`. - // * `WaitScope` may be passed to `Promise::wait()` to synchronously wait for a particular - // promise to complete. See `Promise::wait()` for an extended discussion. - -public: - inline explicit WaitScope(EventLoop& loop): loop(loop) { loop.enterScope(); } - inline ~WaitScope() { loop.leaveScope(); } - KJ_DISALLOW_COPY(WaitScope); - -private: - EventLoop& loop; - friend class EventLoop; - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); -}; - -} // namespace kj - -#include "async-inl.h" - -#endif // KJ_ASYNC_H_ diff --git a/phonelibs/capnp-cpp/include/kj/common.h b/phonelibs/capnp-cpp/include/kj/common.h deleted file mode 100644 index 4a908ae000..0000000000 --- a/phonelibs/capnp-cpp/include/kj/common.h +++ /dev/null @@ -1,1400 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Header that should be #included by everyone. -// -// This defines very simple utilities that are widely applicable. - -#ifndef KJ_COMMON_H_ -#define KJ_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef KJ_NO_COMPILER_CHECK -#if __cplusplus < 201103L && !__CDT_PARSER__ && !_MSC_VER - #error "This code requires C++11. Either your compiler does not support it or it is not enabled." - #ifdef __GNUC__ - // Compiler claims compatibility with GCC, so presumably supports -std. - #error "Pass -std=c++11 on the compiler command line to enable C++11." - #endif -#endif - -#ifdef __GNUC__ - #if __clang__ - #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 2) - #warning "This library requires at least Clang 3.2." - #elif defined(__apple_build_version__) && __apple_build_version__ <= 4250028 - #warning "This library requires at least Clang 3.2. XCode 4.6's Clang, which claims to be "\ - "version 4.2 (wat?), is actually built from some random SVN revision between 3.1 "\ - "and 3.2. Unfortunately, it is insufficient for compiling this library. You can "\ - "download the real Clang 3.2 (or newer) from the Clang web site. Step-by-step "\ - "instructions can be found in Cap'n Proto's documentation: "\ - "http://kentonv.github.io/capnproto/install.html#clang_32_on_mac_osx" - #elif __cplusplus >= 201103L && !__has_include() - #warning "Your compiler supports C++11 but your C++ standard library does not. If your "\ - "system has libc++ installed (as should be the case on e.g. Mac OSX), try adding "\ - "-stdlib=libc++ to your CXXFLAGS." - #endif - #else - #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) - #warning "This library requires at least GCC 4.7." - #endif - #endif -#elif defined(_MSC_VER) - #if _MSC_VER < 1900 - #error "You need Visual Studio 2015 or better to compile this code." - #endif -#else - #warning "I don't recognize your compiler. As of this writing, Clang and GCC are the only "\ - "known compilers with enough C++11 support for this library. "\ - "#define KJ_NO_COMPILER_CHECK to make this warning go away." -#endif -#endif - -#include -#include - -#if __linux__ && __cplusplus > 201200L -// Hack around stdlib bug with C++14 that exists on some Linux systems. -// Apparently in this mode the C library decides not to define gets() but the C++ library still -// tries to import it into the std namespace. This bug has been fixed at the source but is still -// widely present in the wild e.g. on Ubuntu 14.04. -#undef _GLIBCXX_HAVE_GETS -#endif - -#if defined(_MSC_VER) -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif -#include // __popcnt -#endif - -// ======================================================================================= - -namespace kj { - -typedef unsigned int uint; -typedef unsigned char byte; - -// ======================================================================================= -// Common macros, especially for common yet compiler-specific features. - -// Detect whether RTTI and exceptions are enabled, assuming they are unless we have specific -// evidence to the contrary. Clients can always define KJ_NO_RTTI or KJ_NO_EXCEPTIONS explicitly -// to override these checks. -#ifdef __GNUC__ - #if !defined(KJ_NO_RTTI) && !__GXX_RTTI - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !__EXCEPTIONS - #define KJ_NO_EXCEPTIONS 1 - #endif -#elif defined(_MSC_VER) - #if !defined(KJ_NO_RTTI) && !defined(_CPPRTTI) - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !defined(_CPPUNWIND) - #define KJ_NO_EXCEPTIONS 1 - #endif -#endif - -#if !defined(KJ_DEBUG) && !defined(KJ_NDEBUG) -// Heuristically decide whether to enable debug mode. If DEBUG or NDEBUG is defined, use that. -// Otherwise, fall back to checking whether optimization is enabled. -#if defined(DEBUG) || defined(_DEBUG) -#define KJ_DEBUG -#elif defined(NDEBUG) -#define KJ_NDEBUG -#elif __OPTIMIZE__ -#define KJ_NDEBUG -#else -#define KJ_DEBUG -#endif -#endif - -#define KJ_DISALLOW_COPY(classname) \ - classname(const classname&) = delete; \ - classname& operator=(const classname&) = delete -// Deletes the implicit copy constructor and assignment operator. - -#ifdef __GNUC__ -#define KJ_LIKELY(condition) __builtin_expect(condition, true) -#define KJ_UNLIKELY(condition) __builtin_expect(condition, false) -// Branch prediction macros. Evaluates to the condition given, but also tells the compiler that we -// expect the condition to be true/false enough of the time that it's worth hard-coding branch -// prediction. -#else -#define KJ_LIKELY(condition) (condition) -#define KJ_UNLIKELY(condition) (condition) -#endif - -#if defined(KJ_DEBUG) || __NO_INLINE__ -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ -// Don't force inline in debug mode. -#else -#if defined(_MSC_VER) -#define KJ_ALWAYS_INLINE(...) __forceinline __VA_ARGS__ -#else -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ __attribute__((always_inline)) -#endif -// Force a function to always be inlined. Apply only to the prototype, not to the definition. -#endif - -#if defined(_MSC_VER) -#define KJ_NOINLINE __declspec(noinline) -#else -#define KJ_NOINLINE __attribute__((noinline)) -#endif - -#if defined(_MSC_VER) -#define KJ_NORETURN(prototype) __declspec(noreturn) prototype -#define KJ_UNUSED -#define KJ_WARN_UNUSED_RESULT -// TODO(msvc): KJ_WARN_UNUSED_RESULT can use _Check_return_ on MSVC, but it's a prefix, so -// wrapping the whole prototype is needed. http://msdn.microsoft.com/en-us/library/jj159529.aspx -// Similarly, KJ_UNUSED could use __pragma(warning(suppress:...)), but again that's a prefix. -#else -#define KJ_NORETURN(prototype) prototype __attribute__((noreturn)) -#define KJ_UNUSED __attribute__((unused)) -#define KJ_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#endif - -#if __clang__ -#define KJ_UNUSED_MEMBER __attribute__((unused)) -// Inhibits "unused" warning for member variables. Only Clang produces such a warning, while GCC -// complains if the attribute is set on members. -#else -#define KJ_UNUSED_MEMBER -#endif - -#if __clang__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated(reason))) -#define KJ_UNAVAILABLE(reason) \ - __attribute__((unavailable(reason))) -#elif __GNUC__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated)) -#define KJ_UNAVAILABLE(reason) -#else -#define KJ_DEPRECATED(reason) -#define KJ_UNAVAILABLE(reason) -// TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated). -#endif - -namespace _ { // private - -KJ_NORETURN(void inlineRequireFailure( - const char* file, int line, const char* expectation, const char* macroArgs, - const char* message = nullptr)); - -KJ_NORETURN(void unreachable()); - -} // namespace _ (private) - -#ifdef KJ_DEBUG -#if _MSC_VER -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, "" #__VA_ARGS__, __VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#else -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, #__VA_ARGS__, ##__VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#endif -#else -#define KJ_IREQUIRE(condition, ...) -#endif - -#define KJ_IASSERT KJ_IREQUIRE - -#define KJ_UNREACHABLE ::kj::_::unreachable(); -// Put this on code paths that cannot be reached to suppress compiler warnings about missing -// returns. - -#if __clang__ -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT -#else -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT KJ_UNREACHABLE -#endif - -// #define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) -// -// Allocate an array, preferably on the stack, unless it is too big. On GCC this will use -// variable-sized arrays. For other compilers we could just use a fixed-size array. `minStack` -// is the stack array size to use if variable-width arrays are not supported. `maxStack` is the -// maximum stack array size if variable-width arrays *are* supported. -#if __GNUC__ && !__clang__ -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (maxStack); \ - type name##_stack[name##_isOnStack ? size : 0]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#else -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (minStack); \ - type name##_stack[minStack]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#endif - -#define KJ_CONCAT_(x, y) x##y -#define KJ_CONCAT(x, y) KJ_CONCAT_(x, y) -#define KJ_UNIQUE_NAME(prefix) KJ_CONCAT(prefix, __LINE__) -// Create a unique identifier name. We use concatenate __LINE__ rather than __COUNTER__ so that -// the name can be used multiple times in the same macro. - -#if _MSC_VER - -#define KJ_CONSTEXPR(...) __VA_ARGS__ -// Use in cases where MSVC barfs on constexpr. A replacement keyword (e.g. "const") can be -// provided, or just leave blank to remove the keyword entirely. -// -// TODO(msvc): Remove this hack once MSVC fully supports constexpr. - -#ifndef __restrict__ -#define __restrict__ __restrict -// TODO(msvc): Would it be better to define a KJ_RESTRICT macro? -#endif - -#pragma warning(disable: 4521 4522) -// This warning complains when there are two copy constructors, one for a const reference and -// one for a non-const reference. It is often quite necessary to do this in wrapper templates, -// therefore this warning is dumb and we disable it. - -#pragma warning(disable: 4458) -// Warns when a parameter name shadows a class member. Unfortunately my code does this a lot, -// since I don't use a special name format for members. - -#else // _MSC_VER -#define KJ_CONSTEXPR(...) constexpr -#endif - -// ======================================================================================= -// Template metaprogramming helpers. - -template struct NoInfer_ { typedef T Type; }; -template using NoInfer = typename NoInfer_::Type; -// Use NoInfer::Type in place of T for a template function parameter to prevent inference of -// the type based on the parameter value. - -template struct RemoveConst_ { typedef T Type; }; -template struct RemoveConst_ { typedef T Type; }; -template using RemoveConst = typename RemoveConst_::Type; - -template struct IsLvalueReference_ { static constexpr bool value = false; }; -template struct IsLvalueReference_ { static constexpr bool value = true; }; -template -inline constexpr bool isLvalueReference() { return IsLvalueReference_::value; } - -template struct Decay_ { typedef T Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template using Decay = typename Decay_::Type; - -template struct EnableIf_; -template <> struct EnableIf_ { typedef void Type; }; -template using EnableIf = typename EnableIf_::Type; -// Use like: -// -// template ()> -// void func(T&& t); - -template struct VoidSfinae_ { using Type = void; }; -template using VoidSfinae = typename VoidSfinae_::Type; -// Note: VoidSfinae is std::void_t from C++17. - -template -T instance() noexcept; -// Like std::declval, but doesn't transform T into an rvalue reference. If you want that, specify -// instance(). - -struct DisallowConstCopy { - // Inherit from this, or declare a member variable of this type, to prevent the class from being - // copyable from a const reference -- instead, it will only be copyable from non-const references. - // This is useful for enforcing transitive constness of contained pointers. - // - // For example, say you have a type T which contains a pointer. T has non-const methods which - // modify the value at that pointer, but T's const methods are designed to allow reading only. - // Unfortunately, if T has a regular copy constructor, someone can simply make a copy of T and - // then use it to modify the pointed-to value. However, if T inherits DisallowConstCopy, then - // callers will only be able to copy non-const instances of T. Ideally, there is some - // parallel type ImmutableT which is like a version of T that only has const methods, and can - // be copied from a const T. - // - // Note that due to C++ rules about implicit copy constructors and assignment operators, any - // type that contains or inherits from a type that disallows const copies will also automatically - // disallow const copies. Hey, cool, that's exactly what we want. - -#if CAPNP_DEBUG_TYPES - // Alas! Declaring a defaulted non-const copy constructor tickles a bug which causes GCC and - // Clang to disagree on ABI, using different calling conventions to pass this type, leading to - // immediate segfaults. See: - // https://bugs.llvm.org/show_bug.cgi?id=23764 - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58074 - // - // Because of this, we can't use this technique. We guard it by CAPNP_DEBUG_TYPES so that it - // still applies to the Cap'n Proto developers during internal testing. - - DisallowConstCopy() = default; - DisallowConstCopy(DisallowConstCopy&) = default; - DisallowConstCopy(DisallowConstCopy&&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&&) = default; -#endif -}; - -#if _MSC_VER - -#define KJ_CPCAP(obj) obj=::kj::cp(obj) -// TODO(msvc): MSVC refuses to invoke non-const versions of copy constructors in by-value lambda -// captures. Wrap your captured object in this macro to force the compiler to perform a copy. -// Example: -// -// struct Foo: DisallowConstCopy {}; -// Foo foo; -// auto lambda = [KJ_CPCAP(foo)] {}; - -#else - -#define KJ_CPCAP(obj) obj -// Clang and gcc both already perform copy capturing correctly with non-const copy constructors. - -#endif - -template -struct DisallowConstCopyIfNotConst: public DisallowConstCopy { - // Inherit from this when implementing a template that contains a pointer to T and which should - // enforce transitive constness. If T is a const type, this has no effect. Otherwise, it is - // an alias for DisallowConstCopy. -}; - -template -struct DisallowConstCopyIfNotConst {}; - -template struct IsConst_ { static constexpr bool value = false; }; -template struct IsConst_ { static constexpr bool value = true; }; -template constexpr bool isConst() { return IsConst_::value; } - -template struct EnableIfNotConst_ { typedef T Type; }; -template struct EnableIfNotConst_; -template using EnableIfNotConst = typename EnableIfNotConst_::Type; - -template struct EnableIfConst_; -template struct EnableIfConst_ { typedef T Type; }; -template using EnableIfConst = typename EnableIfConst_::Type; - -template struct RemoveConstOrDisable_ { struct Type; }; -template struct RemoveConstOrDisable_ { typedef T Type; }; -template using RemoveConstOrDisable = typename RemoveConstOrDisable_::Type; - -template struct IsReference_ { static constexpr bool value = false; }; -template struct IsReference_ { static constexpr bool value = true; }; -template constexpr bool isReference() { return IsReference_::value; } - -template -struct PropagateConst_ { typedef To Type; }; -template -struct PropagateConst_ { typedef const To Type; }; -template -using PropagateConst = typename PropagateConst_::Type; - -namespace _ { // private - -template -T refIfLvalue(T&&); - -} // namespace _ (private) - -#define KJ_DECLTYPE_REF(exp) decltype(::kj::_::refIfLvalue(exp)) -// Like decltype(exp), but if exp is an lvalue, produces a reference type. -// -// int i; -// decltype(i) i1(i); // i1 has type int. -// KJ_DECLTYPE_REF(i + 1) i2(i + 1); // i2 has type int. -// KJ_DECLTYPE_REF(i) i3(i); // i3 has type int&. -// KJ_DECLTYPE_REF(kj::mv(i)) i4(kj::mv(i)); // i4 has type int. - -template -struct CanConvert_ { - static int sfinae(T); - static bool sfinae(...); -}; - -template -constexpr bool canConvert() { - return sizeof(CanConvert_::sfinae(instance())) == sizeof(int); -} - -#if __GNUC__ && !__clang__ && __GNUC__ < 5 -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - // GCC 4 does not have __is_trivially_constructible and friends, and there doesn't seem to be - // any reliable alternative. __has_trivial_copy() and __has_trivial_assign() return the right - // thing at one point but later on they changed such that a deleted copy constructor was - // considered "trivial" (apparently technically correct, though useless). So, on GCC 4 we give up - // and assume we can't memcpy() at all, and must explicitly copy-construct everything. - return false; -} -#define KJ_ASSERT_CAN_MEMCPY(T) -#else -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - return __is_trivially_constructible(T, const T&) && __is_trivially_assignable(T, const T&); -} -#define KJ_ASSERT_CAN_MEMCPY(T) \ - static_assert(kj::canMemcpy(), "this code expects this type to be memcpy()-able"); -#endif - -// ======================================================================================= -// Equivalents to std::move() and std::forward(), since these are very commonly needed and the -// std header pulls in lots of other stuff. -// -// We use abbreviated names mv and fwd because these helpers (especially mv) are so commonly used -// that the cost of typing more letters outweighs the cost of being slightly harder to understand -// when first encountered. - -template constexpr T&& mv(T& t) noexcept { return static_cast(t); } -template constexpr T&& fwd(NoInfer& t) noexcept { return static_cast(t); } - -template constexpr T cp(T& t) noexcept { return t; } -template constexpr T cp(const T& t) noexcept { return t; } -// Useful to force a copy, particularly to pass into a function that expects T&&. - -template struct ChooseType_; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef U Type; }; - -template -using WiderType = typename ChooseType_= sizeof(U)>::Type; - -template -inline constexpr auto min(T&& a, U&& b) -> WiderType, Decay> { - return a < b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr auto max(T&& a, U&& b) -> WiderType, Decay> { - return a > b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr size_t size(T (&arr)[s]) { return s; } -template -inline constexpr size_t size(T&& arr) { return arr.size(); } -// Returns the size of the parameter, whether the parameter is a regular C array or a container -// with a `.size()` method. - -class MaxValue_ { -private: - template - inline constexpr T maxSigned() const { - return (1ull << (sizeof(T) * 8 - 1)) - 1; - } - template - inline constexpr T maxUnsigned() const { - return ~static_cast(0u); - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MaxValue_::maxSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MaxValue_::maxUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MaxValue_::maxSigned() - : MaxValue_::maxUnsigned(); - } -}; - -class MinValue_ { -private: - template - inline constexpr T minSigned() const { - return 1ull << (sizeof(T) * 8 - 1); - } - template - inline constexpr T minUnsigned() const { - return 0u; - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MinValue_::minSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MinValue_::minUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MinValue_::minSigned() - : MinValue_::minUnsigned(); - } -}; - -static KJ_CONSTEXPR(const) MaxValue_ maxValue = MaxValue_(); -// A special constant which, when cast to an integer type, takes on the maximum possible value of -// that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -static KJ_CONSTEXPR(const) MinValue_ minValue = MinValue_(); -// A special constant which, when cast to an integer type, takes on the minimum possible value -// of that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -template -inline bool operator==(T t, MaxValue_) { return t == Decay(maxValue); } -template -inline bool operator==(T t, MinValue_) { return t == Decay(minValue); } - -template -inline constexpr unsigned long long maxValueForBits() { - // Get the maximum integer representable in the given number of bits. - - // 1ull << 64 is unfortunately undefined. - return (bits == 64 ? 0 : (1ull << bits)) - 1; -} - -struct ThrowOverflow { - // Functor which throws an exception complaining about integer overflow. Usually this is used - // with the interfaces in units.h, but is defined here because Cap'n Proto wants to avoid - // including units.h when not using CAPNP_DEBUG_TYPES. - void operator()() const; -}; - -#if __GNUC__ -inline constexpr float inf() { return __builtin_huge_valf(); } -inline constexpr float nan() { return __builtin_nanf(""); } - -#elif _MSC_VER - -// Do what MSVC math.h does -#pragma warning(push) -#pragma warning(disable: 4756) // "overflow in constant arithmetic" -inline constexpr float inf() { return (float)(1e300 * 1e300); } -#pragma warning(pop) - -float nan(); -// Unfortunatley, inf() * 0.0f produces a NaN with the sign bit set, whereas our preferred -// canonical NaN should not have the sign bit set. std::numeric_limits::quiet_NaN() -// returns the correct NaN, but we don't want to #include that here. So, we give up and make -// this out-of-line on MSVC. -// -// TODO(msvc): Can we do better? - -#else -#error "Not sure how to support your compiler." -#endif - -inline constexpr bool isNaN(float f) { return f != f; } -inline constexpr bool isNaN(double f) { return f != f; } - -inline int popCount(unsigned int x) { -#if defined(_MSC_VER) - return __popcnt(x); - // Note: __popcnt returns unsigned int, but the value is clearly guaranteed to fit into an int -#else - return __builtin_popcount(x); -#endif -} - -// ======================================================================================= -// Useful fake containers - -template -class Range { -public: - inline constexpr Range(const T& begin, const T& end): begin_(begin), end_(end) {} - inline explicit constexpr Range(const T& end): begin_(0), end_(end) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value): value(value) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](size_t index) const { return value + index; } - inline Iterator& operator++() { ++value; return *this; } - inline Iterator operator++(int) { return Iterator(value++); } - inline Iterator& operator--() { --value; return *this; } - inline Iterator operator--(int) { return Iterator(value--); } - inline Iterator& operator+=(ptrdiff_t amount) { value += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { value -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return value - other.value; } - - inline bool operator==(const Iterator& other) const { return value == other.value; } - inline bool operator!=(const Iterator& other) const { return value != other.value; } - inline bool operator<=(const Iterator& other) const { return value <= other.value; } - inline bool operator>=(const Iterator& other) const { return value >= other.value; } - inline bool operator< (const Iterator& other) const { return value < other.value; } - inline bool operator> (const Iterator& other) const { return value > other.value; } - - private: - T value; - }; - - inline Iterator begin() const { return Iterator(begin_); } - inline Iterator end() const { return Iterator(end_); } - - inline auto size() const -> decltype(instance() - instance()) { return end_ - begin_; } - -private: - T begin_; - T end_; -}; - -template -inline constexpr Range, Decay>> range(T begin, U end) { - return Range, Decay>>(begin, end); -} - -template -inline constexpr Range> range(T begin, T end) { return Range>(begin, end); } -// Returns a fake iterable container containing all values of T from `begin` (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::range(1, 10)) { print(i); } - -template -inline constexpr Range> zeroTo(T end) { return Range>(end); } -// Returns a fake iterable container containing all values of T from zero (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::zeroTo(10)) { print(i); } - -template -inline constexpr Range indices(T&& container) { - // Shortcut for iterating over the indices of a container: - // - // for (size_t i: kj::indices(myArray)) { handle(myArray[i]); } - - return range(0, kj::size(container)); -} - -template -class Repeat { -public: - inline constexpr Repeat(const T& value, size_t count): value(value), count(count) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value, size_t index): value(value), index(index) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](ptrdiff_t index) const { return value; } - inline Iterator& operator++() { ++index; return *this; } - inline Iterator operator++(int) { return Iterator(value, index++); } - inline Iterator& operator--() { --index; return *this; } - inline Iterator operator--(int) { return Iterator(value, index--); } - inline Iterator& operator+=(ptrdiff_t amount) { index += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { index -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value, index + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value, index - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return index - other.index; } - - inline bool operator==(const Iterator& other) const { return index == other.index; } - inline bool operator!=(const Iterator& other) const { return index != other.index; } - inline bool operator<=(const Iterator& other) const { return index <= other.index; } - inline bool operator>=(const Iterator& other) const { return index >= other.index; } - inline bool operator< (const Iterator& other) const { return index < other.index; } - inline bool operator> (const Iterator& other) const { return index > other.index; } - - private: - T value; - size_t index; - }; - - inline Iterator begin() const { return Iterator(value, 0); } - inline Iterator end() const { return Iterator(value, count); } - - inline size_t size() const { return count; } - inline const T& operator[](ptrdiff_t) const { return value; } - -private: - T value; - size_t count; -}; - -template -inline constexpr Repeat> repeat(T&& value, size_t count) { - // Returns a fake iterable which contains `count` repeats of `value`. Useful for e.g. creating - // a bunch of spaces: `kj::repeat(' ', indent * 2)` - - return Repeat>(value, count); -} - -// ======================================================================================= -// Manually invoking constructors and destructors -// -// ctor(x, ...) and dtor(x) invoke x's constructor or destructor, respectively. - -// We want placement new, but we don't want to #include . operator new cannot be defined in -// a namespace, and defining it globally conflicts with the definition in . So we have to -// define a dummy type and an operator new that uses it. - -namespace _ { // private -struct PlacementNew {}; -} // namespace _ (private) -} // namespace kj - -inline void* operator new(size_t, kj::_::PlacementNew, void* __p) noexcept { - return __p; -} - -inline void operator delete(void*, kj::_::PlacementNew, void* __p) noexcept {} - -namespace kj { - -template -inline void ctor(T& location, Params&&... params) { - new (_::PlacementNew(), &location) T(kj::fwd(params)...); -} - -template -inline void dtor(T& location) { - location.~T(); -} - -// ======================================================================================= -// Maybe -// -// Use in cases where you want to indicate that a value may be null. Using Maybe instead of T* -// forces the caller to handle the null case in order to satisfy the compiler, thus reliably -// preventing null pointer dereferences at runtime. -// -// Maybe can be implicitly constructed from T and from nullptr. Additionally, it can be -// implicitly constructed from T*, in which case the pointer is checked for nullness at runtime. -// To read the value of a Maybe, do: -// -// KJ_IF_MAYBE(value, someFuncReturningMaybe()) { -// doSomething(*value); -// } else { -// maybeWasNull(); -// } -// -// KJ_IF_MAYBE's first parameter is a variable name which will be defined within the following -// block. The variable will behave like a (guaranteed non-null) pointer to the Maybe's value, -// though it may or may not actually be a pointer. -// -// Note that Maybe actually just wraps a pointer, whereas Maybe wraps a T and a boolean -// indicating nullness. - -template -class Maybe; - -namespace _ { // private - -template -class NullableValue { - // Class whose interface behaves much like T*, but actually contains an instance of T and a - // boolean flag indicating nullness. - -public: - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline NullableValue(NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline ~NullableValue() -#if _MSC_VER - // TODO(msvc): MSVC has a hard time with noexcept specifier expressions that are more complex - // than `true` or `false`. We had a workaround for VS2015, but VS2017 regressed. - noexcept(false) -#else - noexcept(noexcept(instance().~T())) -#endif - { - if (isSet) { - dtor(value); - } - } - - inline T& operator*() & { return value; } - inline const T& operator*() const & { return value; } - inline T&& operator*() && { return kj::mv(value); } - inline const T&& operator*() const && { return kj::mv(value); } - inline T* operator->() { return &value; } - inline const T* operator->() const { return &value; } - inline operator T*() { return isSet ? &value : nullptr; } - inline operator const T*() const { return isSet ? &value : nullptr; } - - template - inline T& emplace(Params&&... params) { - if (isSet) { - isSet = false; - dtor(value); - } - ctor(value, kj::fwd(params)...); - isSet = true; - return value; - } - -private: // internal interface used by friends only - inline NullableValue() noexcept: isSet(false) {} - inline NullableValue(T&& t) noexcept(noexcept(T(instance()))) - : isSet(true) { - ctor(value, kj::mv(t)); - } - inline NullableValue(T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T* t) - : isSet(t != nullptr) { - if (isSet) ctor(value, *t); - } - template - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, *other.ptr); - } - } - inline NullableValue(decltype(nullptr)): isSet(false) {} - - inline NullableValue& operator=(NullableValue&& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, kj::mv(other.value)); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(const NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline bool operator==(decltype(nullptr)) const { return !isSet; } - inline bool operator!=(decltype(nullptr)) const { return isSet; } - -private: - bool isSet; - -#if _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4624) -// Warns that the anonymous union has a deleted destructor when T is non-trivial. This warning -// seems broken. -#endif - - union { - T value; - }; - -#if _MSC_VER -#pragma warning(pop) -#endif - - friend class kj::Maybe; - template - friend NullableValue&& readMaybe(Maybe&& maybe); -}; - -template -inline NullableValue&& readMaybe(Maybe&& maybe) { return kj::mv(maybe.ptr); } -template -inline T* readMaybe(Maybe& maybe) { return maybe.ptr; } -template -inline const T* readMaybe(const Maybe& maybe) { return maybe.ptr; } -template -inline T* readMaybe(Maybe&& maybe) { return maybe.ptr; } -template -inline T* readMaybe(const Maybe& maybe) { return maybe.ptr; } - -template -inline T* readMaybe(T* ptr) { return ptr; } -// Allow KJ_IF_MAYBE to work on regular pointers. - -} // namespace _ (private) - -#define KJ_IF_MAYBE(name, exp) if (auto name = ::kj::_::readMaybe(exp)) - -template -class Maybe { - // A T, or nullptr. - - // IF YOU CHANGE THIS CLASS: Note that there is a specialization of it in memory.h. - -public: - Maybe(): ptr(nullptr) {} - Maybe(T&& t) noexcept(noexcept(T(instance()))): ptr(kj::mv(t)) {} - Maybe(T& t): ptr(t) {} - Maybe(const T& t): ptr(t) {} - Maybe(const T* t) noexcept: ptr(t) {} - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))): ptr(kj::mv(other.ptr)) {} - Maybe(const Maybe& other): ptr(other.ptr) {} - Maybe(Maybe& other): ptr(other.ptr) {} - - template - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))) { - KJ_IF_MAYBE(val, kj::mv(other)) { - ptr.emplace(kj::mv(*val)); - } - } - template - Maybe(const Maybe& other) { - KJ_IF_MAYBE(val, other) { - ptr.emplace(*val); - } - } - - Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - template - inline T& emplace(Params&&... params) { - // Replace this Maybe's content with a new value constructed by passing the given parametrs to - // T's constructor. This can be used to initialize a Maybe without copying or even moving a T. - // Returns a reference to the newly-constructed value. - - return ptr.emplace(kj::fwd(params)...); - } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - inline Maybe& operator=(Maybe& other) { ptr = other.ptr; return *this; } - inline Maybe& operator=(const Maybe& other) { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - -private: - _::NullableValue ptr; - - template - friend class Maybe; - template - friend _::NullableValue&& _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(Maybe& maybe); - template - friend const U* _::readMaybe(const Maybe& maybe); -}; - -template -class Maybe: public DisallowConstCopyIfNotConst { -public: - Maybe() noexcept: ptr(nullptr) {} - Maybe(T& t) noexcept: ptr(&t) {} - Maybe(T* t) noexcept: ptr(t) {} - - template - inline Maybe(Maybe& other) noexcept: ptr(other.ptr) {} - template - inline Maybe(const Maybe& other) noexcept: ptr(other.ptr) {} - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline Maybe& operator=(T& other) noexcept { ptr = &other; return *this; } - inline Maybe& operator=(T* other) noexcept { ptr = other; return *this; } - template - inline Maybe& operator=(Maybe& other) noexcept { ptr = other.ptr; return *this; } - template - inline Maybe& operator=(const Maybe& other) noexcept { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - -private: - T* ptr; - - template - friend class Maybe; - template - friend U* _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(const Maybe& maybe); -}; - -// ======================================================================================= -// ArrayPtr -// -// So common that we put it in common.h rather than array.h. - -template -class ArrayPtr: public DisallowConstCopyIfNotConst { - // A pointer to an array. Includes a size. Like any pointer, it doesn't own the target data, - // and passing by value only copies the pointer, not the target. - -public: - inline constexpr ArrayPtr(): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(decltype(nullptr)): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(T* ptr, size_t size): ptr(ptr), size_(size) {} - inline constexpr ArrayPtr(T* begin, T* end): ptr(begin), size_(end - begin) {} - inline KJ_CONSTEXPR() ArrayPtr(::std::initializer_list> init) - : ptr(init.begin()), size_(init.size()) {} - - template - inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) {} - // Construct an ArrayPtr from a native C-style array. - - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asConst() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline const T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - inline T& operator[](size_t index) { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr> asBytes() const { - // Reinterpret the array as a byte array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - inline ArrayPtr> asChars() const { - // Reinterpret the array as a char array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline bool operator==(const ArrayPtr& other) const { - if (size_ != other.size_) return false; - for (size_t i = 0; i < size_; i++) { - if (ptr[i] != other[i]) return false; - } - return true; - } - inline bool operator!=(const ArrayPtr& other) const { return !(*this == other); } - -private: - T* ptr; - size_t size_; -}; - -template -inline constexpr ArrayPtr arrayPtr(T* ptr, size_t size) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(ptr, size); -} - -template -inline constexpr ArrayPtr arrayPtr(T* begin, T* end) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(begin, end); -} - -// ======================================================================================= -// Casts - -template -To implicitCast(From&& from) { - // `implicitCast(value)` casts `value` to type `T` only if the conversion is implicit. Useful - // for e.g. resolving ambiguous overloads without sacrificing type-safety. - return kj::fwd(from); -} - -template -Maybe dynamicDowncastIfAvailable(From& from) { - // If RTTI is disabled, always returns nullptr. Otherwise, works like dynamic_cast. Useful - // in situations where dynamic_cast could allow an optimization, but isn't strictly necessary - // for correctness. It is highly recommended that you try to arrange all your dynamic_casts - // this way, as a dynamic_cast that is necessary for correctness implies a flaw in the interface - // design. - - // Force a compile error if To is not a subtype of From. Cross-casting is rare; if it is needed - // we should have a separate cast function like dynamicCrosscastIfAvailable(). - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if KJ_NO_RTTI - return nullptr; -#else - return dynamic_cast(&from); -#endif -} - -template -To& downcast(From& from) { - // Down-cast a value to a sub-type, asserting that the cast is valid. In opt mode this is a - // static_cast, but in debug mode (when RTTI is enabled) a dynamic_cast will be used to verify - // that the value really has the requested type. - - // Force a compile error if To is not a subtype of From. - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if !KJ_NO_RTTI - KJ_IREQUIRE(dynamic_cast(&from) != nullptr, "Value cannot be downcast() to requested type."); -#endif - - return static_cast(from); -} - -// ======================================================================================= -// Defer - -namespace _ { // private - -template -class Deferred { -public: - inline Deferred(Func&& func): func(kj::fwd(func)), canceled(false) {} - inline ~Deferred() noexcept(false) { if (!canceled) func(); } - KJ_DISALLOW_COPY(Deferred); - - // This move constructor is usually optimized away by the compiler. - inline Deferred(Deferred&& other): func(kj::mv(other.func)), canceled(false) { - other.canceled = true; - } -private: - Func func; - bool canceled; -}; - -} // namespace _ (private) - -template -_::Deferred defer(Func&& func) { - // Returns an object which will invoke the given functor in its destructor. The object is not - // copyable but is movable with the semantics you'd expect. Since the return type is private, - // you need to assign to an `auto` variable. - // - // The KJ_DEFER macro provides slightly more convenient syntax for the common case where you - // want some code to run at current scope exit. - - return _::Deferred(kj::fwd(func)); -} - -#define KJ_DEFER(code) auto KJ_UNIQUE_NAME(_kjDefer) = ::kj::defer([&](){code;}) -// Run the given code when the function exits, whether by return or exception. - -} // namespace kj - -#endif // KJ_COMMON_H_ diff --git a/phonelibs/capnp-cpp/include/kj/compat/gtest.h b/phonelibs/capnp-cpp/include/kj/compat/gtest.h deleted file mode 100644 index 016dbdfac3..0000000000 --- a/phonelibs/capnp-cpp/include/kj/compat/gtest.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_GTEST_H_ -#define KJ_COMPAT_GTEST_H_ -// This file defines compatibility macros converting Google Test tests into KJ tests. -// -// This is only intended to cover the most common functionality. Many tests will likely need -// additional tweaks. For instance: -// - Using operator<< to print information on failure is not supported. Instead, switch to -// KJ_ASSERT/KJ_EXPECT and pass in stuff to print as additional parameters. -// - Test fixtures are not supported. Allocate your "test fixture" on the stack instead. Do setup -// in the constructor, teardown in the destructor. - -#include "../test.h" - -namespace kj { - -namespace _ { // private - -template -T abs(T value) { return value < 0 ? -value : value; } - -inline bool floatAlmostEqual(float a, float b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-5; -} - -inline bool doubleAlmostEqual(double a, double b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-12; -} - -} // namespace _ (private) - -#define EXPECT_FALSE(x) KJ_EXPECT(!(x)) -#define EXPECT_TRUE(x) KJ_EXPECT(x) -#define EXPECT_EQ(x, y) KJ_EXPECT((x) == (y), x, y) -#define EXPECT_NE(x, y) KJ_EXPECT((x) != (y), x, y) -#define EXPECT_LE(x, y) KJ_EXPECT((x) <= (y), x, y) -#define EXPECT_GE(x, y) KJ_EXPECT((x) >= (y), x, y) -#define EXPECT_LT(x, y) KJ_EXPECT((x) < (y), x, y) -#define EXPECT_GT(x, y) KJ_EXPECT((x) > (y), x, y) -#define EXPECT_STREQ(x, y) KJ_EXPECT(::strcmp(x, y) == 0, x, y) -#define EXPECT_FLOAT_EQ(x, y) KJ_EXPECT(::kj::_::floatAlmostEqual(y, x), y, x); -#define EXPECT_DOUBLE_EQ(x, y) KJ_EXPECT(::kj::_::doubleAlmostEqual(y, x), y, x); - -#define ASSERT_FALSE(x) KJ_ASSERT(!(x)) -#define ASSERT_TRUE(x) KJ_ASSERT(x) -#define ASSERT_EQ(x, y) KJ_ASSERT((x) == (y), x, y) -#define ASSERT_NE(x, y) KJ_ASSERT((x) != (y), x, y) -#define ASSERT_LE(x, y) KJ_ASSERT((x) <= (y), x, y) -#define ASSERT_GE(x, y) KJ_ASSERT((x) >= (y), x, y) -#define ASSERT_LT(x, y) KJ_ASSERT((x) < (y), x, y) -#define ASSERT_GT(x, y) KJ_ASSERT((x) > (y), x, y) -#define ASSERT_STREQ(x, y) KJ_ASSERT(::strcmp(x, y) == 0, x, y) -#define ASSERT_FLOAT_EQ(x, y) KJ_ASSERT(::kj::_::floatAlmostEqual(y, x), y, x); -#define ASSERT_DOUBLE_EQ(x, y) KJ_ASSERT(::kj::_::doubleAlmostEqual(y, x), y, x); - -class AddFailureAdapter { -public: - AddFailureAdapter(const char* file, int line): file(file), line(line) {} - - ~AddFailureAdapter() { - if (!handled) { - _::Debug::log(file, line, LogSeverity::ERROR, "expectation failed"); - } - } - - template - void operator<<(T&& info) { - handled = true; - _::Debug::log(file, line, LogSeverity::ERROR, "\"expectation failed\", info", - "expectation failed", kj::fwd(info)); - } - -private: - bool handled = false; - const char* file; - int line; -}; - -#define ADD_FAILURE() ::kj::AddFailureAdapter(__FILE__, __LINE__) - -#if KJ_NO_EXCEPTIONS -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, nullptr, [&]() { code; })) -#else -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::runCatchingExceptions([&]() { code; }) != nullptr) -#endif - -#define EXPECT_NONFATAL_FAILURE(code) \ - EXPECT_TRUE(kj::runCatchingExceptions([&]() { code; }) != nullptr); - -#ifdef KJ_DEBUG -#define EXPECT_DEBUG_ANY_THROW EXPECT_ANY_THROW -#else -#define EXPECT_DEBUG_ANY_THROW(EXP) -#endif - -#define TEST(x, y) KJ_TEST("legacy test: " #x "/" #y) - -} // namespace kj - -#endif // KJ_COMPAT_GTEST_H_ diff --git a/phonelibs/capnp-cpp/include/kj/compat/http.h b/phonelibs/capnp-cpp/include/kj/compat/http.h deleted file mode 100644 index 8d455cc258..0000000000 --- a/phonelibs/capnp-cpp/include/kj/compat/http.h +++ /dev/null @@ -1,636 +0,0 @@ -// Copyright (c) 2017 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_HTTP_H_ -#define KJ_COMPAT_HTTP_H_ -// The KJ HTTP client/server library. -// -// This is a simple library which can be used to implement an HTTP client or server. Properties -// of this library include: -// - Uses KJ async framework. -// - Agnostic to transport layer -- you can provide your own. -// - Header parsing is zero-copy -- it results in strings that point directly into the buffer -// received off the wire. -// - Application code which reads and writes headers refers to headers by symbolic names, not by -// string literals, with lookups being array-index-based, not map-based. To make this possible, -// the application announces what headers it cares about in advance, in order to assign numeric -// values to them. -// - Methods are identified by an enum. - -#include -#include -#include -#include -#include - -namespace kj { - -#define KJ_HTTP_FOR_EACH_METHOD(MACRO) \ - MACRO(GET) \ - MACRO(HEAD) \ - MACRO(POST) \ - MACRO(PUT) \ - MACRO(DELETE) \ - MACRO(PATCH) \ - MACRO(PURGE) \ - MACRO(OPTIONS) \ - MACRO(TRACE) \ - /* standard methods */ \ - /* */ \ - /* (CONNECT is intentionally omitted since it is handled specially in HttpHandler) */ \ - \ - MACRO(COPY) \ - MACRO(LOCK) \ - MACRO(MKCOL) \ - MACRO(MOVE) \ - MACRO(PROPFIND) \ - MACRO(PROPPATCH) \ - MACRO(SEARCH) \ - MACRO(UNLOCK) \ - /* WebDAV */ \ - \ - MACRO(REPORT) \ - MACRO(MKACTIVITY) \ - MACRO(CHECKOUT) \ - MACRO(MERGE) \ - /* Subversion */ \ - \ - MACRO(MSEARCH) \ - MACRO(NOTIFY) \ - MACRO(SUBSCRIBE) \ - MACRO(UNSUBSCRIBE) - /* UPnP */ - -#define KJ_HTTP_FOR_EACH_CONNECTION_HEADER(MACRO) \ - MACRO(connection, "Connection") \ - MACRO(contentLength, "Content-Length") \ - MACRO(keepAlive, "Keep-Alive") \ - MACRO(te, "TE") \ - MACRO(trailer, "Trailer") \ - MACRO(transferEncoding, "Transfer-Encoding") \ - MACRO(upgrade, "Upgrade") - -enum class HttpMethod { - // Enum of known HTTP methods. - // - // We use an enum rather than a string to allow for faster parsing and switching and to reduce - // ambiguity. - -#define DECLARE_METHOD(id) id, -KJ_HTTP_FOR_EACH_METHOD(DECLARE_METHOD) -#undef DECLARE_METHOD -}; - -kj::StringPtr KJ_STRINGIFY(HttpMethod method); -kj::Maybe tryParseHttpMethod(kj::StringPtr name); - -class HttpHeaderTable; - -class HttpHeaderId { - // Identifies an HTTP header by numeric ID that indexes into an HttpHeaderTable. - // - // The KJ HTTP API prefers that headers be identified by these IDs for a few reasons: - // - Integer lookups are much more efficient than string lookups. - // - Case-insensitivity is awkward to deal with when const strings are being passed to the lookup - // method. - // - Writing out strings less often means fewer typos. - // - // See HttpHeaderTable for usage hints. - -public: - HttpHeaderId() = default; - - inline bool operator==(const HttpHeaderId& other) const { return id == other.id; } - inline bool operator!=(const HttpHeaderId& other) const { return id != other.id; } - inline bool operator< (const HttpHeaderId& other) const { return id < other.id; } - inline bool operator> (const HttpHeaderId& other) const { return id > other.id; } - inline bool operator<=(const HttpHeaderId& other) const { return id <= other.id; } - inline bool operator>=(const HttpHeaderId& other) const { return id >= other.id; } - - inline size_t hashCode() const { return id; } - - kj::StringPtr toString() const; - - void requireFrom(HttpHeaderTable& table) const; - // In debug mode, throws an exception if the HttpHeaderId is not from the given table. - // - // In opt mode, no-op. - -#define KJ_HTTP_FOR_EACH_BUILTIN_HEADER(MACRO) \ - MACRO(HOST, "Host") \ - MACRO(DATE, "Date") \ - MACRO(LOCATION, "Location") \ - MACRO(CONTENT_TYPE, "Content-Type") - // For convenience, these very-common headers are valid for all HttpHeaderTables. You can refer - // to them like: - // - // HttpHeaderId::HOST - // - // TODO(0.7): Fill this out with more common headers. - -#define DECLARE_HEADER(id, name) \ - static const HttpHeaderId id; - // Declare a constant for each builtin header, e.g.: HttpHeaderId::CONNECTION - - KJ_HTTP_FOR_EACH_BUILTIN_HEADER(DECLARE_HEADER); -#undef DECLARE_HEADER - -private: - HttpHeaderTable* table; - uint id; - - inline explicit constexpr HttpHeaderId(HttpHeaderTable* table, uint id): table(table), id(id) {} - friend class HttpHeaderTable; - friend class HttpHeaders; -}; - -class HttpHeaderTable { - // Construct an HttpHeaderTable to declare which headers you'll be interested in later on, and - // to manufacture IDs for them. - // - // Example: - // - // // Build a header table with the headers we are interested in. - // kj::HttpHeaderTable::Builder builder; - // const HttpHeaderId accept = builder.add("Accept"); - // const HttpHeaderId contentType = builder.add("Content-Type"); - // kj::HttpHeaderTable table(kj::mv(builder)); - // - // // Create an HTTP client. - // auto client = kj::newHttpClient(table, network); - // - // // Get http://example.com. - // HttpHeaders headers(table); - // headers.set(accept, "text/html"); - // auto response = client->send(kj::HttpMethod::GET, "http://example.com", headers) - // .wait(waitScope); - // auto msg = kj::str("Response content type: ", response.headers.get(contentType)); - - struct IdsByNameMap; - -public: - HttpHeaderTable(); - // Constructs a table that only contains the builtin headers. - - class Builder { - public: - Builder(); - HttpHeaderId add(kj::StringPtr name); - Own build(); - - HttpHeaderTable& getFutureTable(); - // Get the still-unbuilt header table. You cannot actually use it until build() has been - // called. - // - // This method exists to help when building a shared header table -- the Builder may be passed - // to several components, each of which will register the headers they need and get a reference - // to the future table. - - private: - kj::Own table; - }; - - KJ_DISALLOW_COPY(HttpHeaderTable); // Can't copy because HttpHeaderId points to the table. - ~HttpHeaderTable() noexcept(false); - - uint idCount(); - // Return the number of IDs in the table. - - kj::Maybe stringToId(kj::StringPtr name); - // Try to find an ID for the given name. The matching is case-insensitive, per the HTTP spec. - // - // Note: if `name` contains characters that aren't allowed in HTTP header names, this may return - // a bogus value rather than null, due to optimizations used in case-insensitive matching. - - kj::StringPtr idToString(HttpHeaderId id); - // Get the canonical string name for the given ID. - -private: - kj::Vector namesById; - kj::Own idsByName; -}; - -class HttpHeaders { - // Represents a set of HTTP headers. - // - // This class guards against basic HTTP header injection attacks: Trying to set a header name or - // value containing a newline, carriage return, or other invalid character will throw an - // exception. - -public: - explicit HttpHeaders(HttpHeaderTable& table); - - KJ_DISALLOW_COPY(HttpHeaders); - HttpHeaders(HttpHeaders&&) = default; - HttpHeaders& operator=(HttpHeaders&&) = default; - - void clear(); - // Clears all contents, as if the object was freshly-allocated. However, calling this rather - // than actually re-allocating the object may avoid re-allocation of internal objects. - - HttpHeaders clone() const; - // Creates a deep clone of the HttpHeaders. The returned object owns all strings it references. - - HttpHeaders cloneShallow() const; - // Creates a shallow clone of the HttpHeaders. The returned object references the same strings - // as the original, owning none of them. - - kj::Maybe get(HttpHeaderId id) const; - // Read a header. - - template - void forEach(Func&& func) const; - // Calls `func(name, value)` for each header in the set -- including headers that aren't mapped - // to IDs in the header table. Both inputs are of type kj::StringPtr. - - void set(HttpHeaderId id, kj::StringPtr value); - void set(HttpHeaderId id, kj::String&& value); - // Sets a header value, overwriting the existing value. - // - // The String&& version is equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `value` remains valid until the - // HttpHeaders object is destroyed. This allows string literals to be passed without making a - // copy, but complicates the use of dynamic values. Hint: Consider using `takeOwnership()`. - - void add(kj::StringPtr name, kj::StringPtr value); - void add(kj::StringPtr name, kj::String&& value); - void add(kj::String&& name, kj::String&& value); - // Append a header. `name` will be looked up in the header table, but if it's not mapped, the - // header will be added to the list of unmapped headers. - // - // The String&& versions are equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `name` and `value` remain valid - // until the HttpHeaders object is destroyed. This allows string literals to be passed without - // making a copy, but complicates the use of dynamic values. Hint: Consider using - // `takeOwnership()`. - - void unset(HttpHeaderId id); - // Removes a header. - // - // It's not possible to remove a header by string name because non-indexed headers would take - // O(n) time to remove. Instead, construct a new HttpHeaders object and copy contents. - - void takeOwnership(kj::String&& string); - void takeOwnership(kj::Array&& chars); - void takeOwnership(HttpHeaders&& otherHeaders); - // Takes overship of a string so that it lives until the HttpHeaders object is destroyed. Useful - // when you've passed a dynamic value to set() or add() or parse*(). - - struct ConnectionHeaders { - // These headers govern details of the specific HTTP connection or framing of the content. - // Hence, they are managed internally within the HTTP library, and never appear in an - // HttpHeaders structure. - -#define DECLARE_HEADER(id, name) \ - kj::StringPtr id; - KJ_HTTP_FOR_EACH_CONNECTION_HEADER(DECLARE_HEADER) -#undef DECLARE_HEADER - }; - - struct Request { - HttpMethod method; - kj::StringPtr url; - ConnectionHeaders connectionHeaders; - }; - struct Response { - uint statusCode; - kj::StringPtr statusText; - ConnectionHeaders connectionHeaders; - }; - - kj::Maybe tryParseRequest(kj::ArrayPtr content); - kj::Maybe tryParseResponse(kj::ArrayPtr content); - // Parse an HTTP header blob and add all the headers to this object. - // - // `content` should be all text from the start of the request to the first occurrance of two - // newlines in a row -- including the first of these two newlines, but excluding the second. - // - // The parse is performed with zero copies: The callee clobbers `content` with '\0' characters - // to split it into a bunch of shorter strings. The caller must keep `content` valid until the - // `HttpHeaders` is destroyed, or pass it to `takeOwnership()`. - - kj::String serializeRequest(HttpMethod method, kj::StringPtr url, - const ConnectionHeaders& connectionHeaders) const; - kj::String serializeResponse(uint statusCode, kj::StringPtr statusText, - const ConnectionHeaders& connectionHeaders) const; - // Serialize the headers as a complete request or response blob. The blob uses '\r\n' newlines - // and includes the double-newline to indicate the end of the headers. - - kj::String toString() const; - -private: - HttpHeaderTable* table; - - kj::Array indexedHeaders; - // Size is always table->idCount(). - - struct Header { - kj::StringPtr name; - kj::StringPtr value; - }; - kj::Vector

unindexedHeaders; - - kj::Vector> ownedStrings; - - kj::Maybe addNoCheck(kj::StringPtr name, kj::StringPtr value); - - kj::StringPtr cloneToOwn(kj::StringPtr str); - - kj::String serialize(kj::ArrayPtr word1, - kj::ArrayPtr word2, - kj::ArrayPtr word3, - const ConnectionHeaders& connectionHeaders) const; - - bool parseHeaders(char* ptr, char* end, ConnectionHeaders& connectionHeaders); - - // TODO(perf): Arguably we should store a map, but header sets are never very long - // TODO(perf): We could optimize for common headers by storing them directly as fields. We could - // also add direct accessors for those headers. -}; - -class WebSocket { -public: - WebSocket(kj::Own stream); - // Create a WebSocket wrapping the given I/O stream. - - kj::Promise send(kj::ArrayPtr message); - kj::Promise send(kj::ArrayPtr message); -}; - -class HttpClient { - // Interface to the client end of an HTTP connection. - // - // There are two kinds of clients: - // * Host clients are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests.) - // * Proxy clients are used when the target could be any arbitrary host on the internet. - // The `url` specified in a request is a full URL including protocol and hostname. - -public: - struct Response { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::Own body; - // `statusText` and `headers` remain valid until `body` is dropped. - }; - - struct Request { - kj::Own body; - // Write the request entity body to this stream, then drop it when done. - // - // May be null for GET and HEAD requests (which have no body) and requests that have - // Content-Length: 0. - - kj::Promise response; - // Promise for the eventual respnose. - }; - - virtual Request request(HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the client is a proxy client or a host client. - // - // `url` and `headers` need only remain valid until `request()` returns (they can be - // stack-allocated). - // - // `expectedBodySize`, if provided, must be exactly the number of bytes that will be written to - // the body. This will trigger use of the `Content-Length` connection header. Otherwise, - // `Transfer-Encoding: chunked` will be used. - - struct WebSocketResponse { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::OneOf, kj::Own> upstreamOrBody; - // `statusText` and `headers` remain valid until `upstreamOrBody` is dropped. - }; - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, kj::Own downstream); - // Tries to open a WebSocket. Default implementation calls send() and never returns a WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy clients. Default implementation throws - // UNIMPLEMENTED. -}; - -class HttpService { - // Interface which HTTP services should implement. - // - // This interface is functionally equivalent to HttpClient, but is intended for applications to - // implement rather than call. The ergonomics and performance of the method signatures are - // optimized for the serving end. - // - // As with clients, there are two kinds of services: - // * Host services are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests, and the service - // may in fact serve multiple origins via this header.) - // * Proxy services are used when the target could be any arbitrary host on the internet, i.e. to - // implement an HTTP proxy. The `url` specified in a request is a full URL including protocol - // and hostname. - -public: - class Response { - public: - virtual kj::Own send( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Begin the response. - // - // `statusText` and `headers` need only remain valid until send() returns (they can be - // stack-allocated). - }; - - virtual kj::Promise request( - HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::AsyncInputStream& requestBody, Response& response) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the service is a proxy service or a host service. - // - // `url` and `headers` are invalidated on the first read from `requestBody` or when the returned - // promise resolves, whichever comes first. - - class WebSocketResponse: public Response { - public: - kj::Own startWebSocket( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - WebSocket& upstream); - // Begin the response. - // - // `statusText` and `headers` need only remain valid until startWebSocket() returns (they can - // be stack-allocated). - }; - - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, WebSocketResponse& response); - // Tries to open a WebSocket. Default implementation calls request() and never returns a - // WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy services. Default implementation throws - // UNIMPLEMENTED. -}; - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::Network& network, - kj::Maybe tlsNetwork = nullptr); -// Creates a proxy HttpClient that connects to hosts over the given network. -// -// `responseHeaderTable` is used when parsing HTTP responses. Requests can use any header table. -// -// `tlsNetwork` is required to support HTTPS destination URLs. Otherwise, only HTTP URLs can be -// fetched. - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::AsyncIoStream& stream); -// Creates an HttpClient that speaks over the given pre-established connection. The client may -// be used as a proxy client or a host client depending on whether the peer is operating as -// a proxy. -// -// Note that since this client has only one stream to work with, it will try to pipeline all -// requests on this stream. If one request or response has an I/O failure, all subsequent requests -// fail as well. If the destination server chooses to close the connection after a response, -// subsequent requests will fail. If a response takes a long time, it blocks subsequent responses. -// If a WebSocket is opened successfully, all subsequent requests fail. - -kj::Own newHttpClient(HttpService& service); -kj::Own newHttpService(HttpClient& client); -// Adapts an HttpClient to an HttpService and vice versa. - -struct HttpServerSettings { - kj::Duration headerTimeout = 15 * kj::SECONDS; - // After initial connection open, or after receiving the first byte of a pipelined request, - // the client must send the complete request within this time. - - kj::Duration pipelineTimeout = 5 * kj::SECONDS; - // After one request/response completes, we'll wait up to this long for a pipelined request to - // arrive. -}; - -class HttpServer: private kj::TaskSet::ErrorHandler { - // Class which listens for requests on ports or connections and sends them to an HttpService. - -public: - typedef HttpServerSettings Settings; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings = Settings()); - // Set up an HttpServer that directs incoming connections to the given service. The service - // may be a host service or a proxy service depending on whether you are intending to implement - // an HTTP server or an HTTP proxy. - - kj::Promise drain(); - // Stop accepting new connections or new requests on existing connections. Finish any requests - // that are already executing, then close the connections. Returns once no more requests are - // in-flight. - - kj::Promise listenHttp(kj::ConnectionReceiver& port); - // Accepts HTTP connections on the given port and directs them to the handler. - // - // The returned promise never completes normally. It may throw if port.accept() throws. Dropping - // the returned promise will cause the server to stop listening on the port, but already-open - // connections will continue to be served. Destroy the whole HttpServer to cancel all I/O. - - kj::Promise listenHttp(kj::Own connection); - // Reads HTTP requests from the given connection and directs them to the handler. A successful - // completion of the promise indicates that all requests received on the connection resulted in - // a complete response, and the client closed the connection gracefully or drain() was called. - // The promise throws if an unparseable request is received or if some I/O error occurs. Dropping - // the returned promise will cancel all I/O on the connection and cancel any in-flight requests. - -private: - class Connection; - - kj::Timer& timer; - HttpHeaderTable& requestHeaderTable; - HttpService& service; - Settings settings; - - bool draining = false; - kj::ForkedPromise onDrain; - kj::Own> drainFulfiller; - - uint connectionCount = 0; - kj::Maybe>> zeroConnectionsFulfiller; - - kj::TaskSet tasks; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings, kj::PromiseFulfillerPair paf); - - kj::Promise listenLoop(kj::ConnectionReceiver& port); - - void taskFailed(kj::Exception&& exception) override; -}; - -// ======================================================================================= -// inline implementation - -inline void HttpHeaderId::requireFrom(HttpHeaderTable& table) const { - KJ_IREQUIRE(this->table == nullptr || this->table == &table, - "the provided HttpHeaderId is from the wrong HttpHeaderTable"); -} - -inline kj::Own HttpHeaderTable::Builder::build() { return kj::mv(table); } -inline HttpHeaderTable& HttpHeaderTable::Builder::getFutureTable() { return *table; } - -inline uint HttpHeaderTable::idCount() { return namesById.size(); } - -inline kj::StringPtr HttpHeaderTable::idToString(HttpHeaderId id) { - id.requireFrom(*this); - return namesById[id.id]; -} - -inline kj::Maybe HttpHeaders::get(HttpHeaderId id) const { - id.requireFrom(*table); - auto result = indexedHeaders[id.id]; - return result == nullptr ? kj::Maybe(nullptr) : result; -} - -inline void HttpHeaders::unset(HttpHeaderId id) { - id.requireFrom(*table); - indexedHeaders[id.id] = nullptr; -} - -template -inline void HttpHeaders::forEach(Func&& func) const { - for (auto i: kj::indices(indexedHeaders)) { - if (indexedHeaders[i] != nullptr) { - func(table->idToString(HttpHeaderId(table, i)), indexedHeaders[i]); - } - } - - for (auto& header: unindexedHeaders) { - func(header.name, header.value); - } -} - -} // namespace kj - -#endif // KJ_COMPAT_HTTP_H_ diff --git a/phonelibs/capnp-cpp/include/kj/debug.h b/phonelibs/capnp-cpp/include/kj/debug.h deleted file mode 100644 index fff7f98bc0..0000000000 --- a/phonelibs/capnp-cpp/include/kj/debug.h +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file declares convenient macros for debug logging and error handling. The macros make -// it excessively easy to extract useful context information from code. Example: -// -// KJ_ASSERT(a == b, a, b, "a and b must be the same."); -// -// On failure, this will throw an exception whose description looks like: -// -// myfile.c++:43: bug in code: expected a == b; a = 14; b = 72; a and b must be the same. -// -// As you can see, all arguments after the first provide additional context. -// -// The macros available are: -// -// * `KJ_LOG(severity, ...)`: Just writes a log message, to stderr by default (but you can -// intercept messages by implementing an ExceptionCallback). `severity` is `INFO`, `WARNING`, -// `ERROR`, or `FATAL`. By default, `INFO` logs are not written, but for command-line apps the -// user should be able to pass a flag like `--verbose` to enable them. Other log levels are -// enabled by default. Log messages -- like exceptions -- can be intercepted by registering an -// ExceptionCallback. -// -// * `KJ_DBG(...)`: Like `KJ_LOG`, but intended specifically for temporary log lines added while -// debugging a particular problem. Calls to `KJ_DBG` should always be deleted before committing -// code. It is suggested that you set up a pre-commit hook that checks for this. -// -// * `KJ_ASSERT(condition, ...)`: Throws an exception if `condition` is false, or aborts if -// exceptions are disabled. This macro should be used to check for bugs in the surrounding code -// and its dependencies, but NOT to check for invalid input. The macro may be followed by a -// brace-delimited code block; if so, the block will be executed in the case where the assertion -// fails, before throwing the exception. If control jumps out of the block (e.g. with "break", -// "return", or "goto"), then the error is considered "recoverable" -- in this case, if -// exceptions are disabled, execution will continue normally rather than aborting (but if -// exceptions are enabled, an exception will still be thrown on exiting the block). A "break" -// statement in particular will jump to the code immediately after the block (it does not break -// any surrounding loop or switch). Example: -// -// KJ_ASSERT(value >= 0, "Value cannot be negative.", value) { -// // Assertion failed. Set value to zero to "recover". -// value = 0; -// // Don't abort if exceptions are disabled. Continue normally. -// // (Still throw an exception if they are enabled, though.) -// break; -// } -// // When exceptions are disabled, we'll get here even if the assertion fails. -// // Otherwise, we get here only if the assertion passes. -// -// * `KJ_REQUIRE(condition, ...)`: Like `KJ_ASSERT` but used to check preconditions -- e.g. to -// validate parameters passed from a caller. A failure indicates that the caller is buggy. -// -// * `KJ_SYSCALL(code, ...)`: Executes `code` assuming it makes a system call. A negative result -// is considered an error, with error code reported via `errno`. EINTR is handled by retrying. -// Other errors are handled by throwing an exception. If you need to examine the return code, -// assign it to a variable like so: -// -// int fd; -// KJ_SYSCALL(fd = open(filename, O_RDONLY), filename); -// -// `KJ_SYSCALL` can be followed by a recovery block, just like `KJ_ASSERT`. -// -// * `KJ_NONBLOCKING_SYSCALL(code, ...)`: Like KJ_SYSCALL, but will not throw an exception on -// EAGAIN/EWOULDBLOCK. The calling code should check the syscall's return value to see if it -// indicates an error; in this case, it can assume the error was EAGAIN because any other error -// would have caused an exception to be thrown. -// -// * `KJ_CONTEXT(...)`: Notes additional contextual information relevant to any exceptions thrown -// from within the current scope. That is, until control exits the block in which KJ_CONTEXT() -// is used, if any exception is generated, it will contain the given information in its context -// chain. This is helpful because it can otherwise be very difficult to come up with error -// messages that make sense within low-level helper code. Note that the parameters to -// KJ_CONTEXT() are only evaluated if an exception is thrown. This implies that any variables -// used must remain valid until the end of the scope. -// -// Notes: -// * Do not write expressions with side-effects in the message content part of the macro, as the -// message will not necessarily be evaluated. -// * For every macro `FOO` above except `LOG`, there is also a `FAIL_FOO` macro used to report -// failures that already happened. For the macros that check a boolean condition, `FAIL_FOO` -// omits the first parameter and behaves like it was `false`. `FAIL_SYSCALL` and -// `FAIL_RECOVERABLE_SYSCALL` take a string and an OS error number as the first two parameters. -// The string should be the name of the failed system call. -// * For every macro `FOO` above, there is a `DFOO` version (or `RECOVERABLE_DFOO`) which is only -// executed in debug mode, i.e. when KJ_DEBUG is defined. KJ_DEBUG is defined automatically -// by common.h when compiling without optimization (unless NDEBUG is defined), but you can also -// define it explicitly (e.g. -DKJ_DEBUG). Generally, production builds should NOT use KJ_DEBUG -// as it may enable expensive checks that are unlikely to fail. - -#ifndef KJ_DEBUG_H_ -#define KJ_DEBUG_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" -#include "exception.h" - -#ifdef ERROR -// This is problematic because windows.h #defines ERROR, which we use in an enum here. -#error "Make sure to to undefine ERROR (or just #include ) before this file" -#endif - -namespace kj { - -#if _MSC_VER -// MSVC does __VA_ARGS__ differently from GCC: -// - A trailing comma before an empty __VA_ARGS__ is removed automatically, whereas GCC wants -// you to request this behavior with "##__VA_ARGS__". -// - If __VA_ARGS__ is passed directly as an argument to another macro, it will be treated as a -// *single* argument rather than an argument list. This can be worked around by wrapping the -// outer macro call in KJ_EXPAND(), which appraently forces __VA_ARGS__ to be expanded before -// the macro is evaluated. I don't understand the C preprocessor. -// - Using "#__VA_ARGS__" to stringify __VA_ARGS__ expands to zero tokens when __VA_ARGS__ is -// empty, rather than expanding to an empty string literal. We can work around by concatenating -// with an empty string literal. - -#define KJ_EXPAND(X) X - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - "" #__VA_ARGS__, __VA_ARGS__) - -#define KJ_DBG(...) KJ_EXPAND(KJ_LOG(DBG, __VA_ARGS__)) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -// TODO(msvc): MSVC mis-deduces `ContextImpl` as `ContextImpl` in some edge -// cases, such as inside nested lambdas inside member functions. Wrapping the type in -// `decltype(instance<...>())` helps it deduce the context function's type correctly. -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)); \ - }; \ - decltype(::kj::instance<::kj::_::Debug::ContextImpl>()) \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*[&] { \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", "" #__VA_ARGS__, __VA_ARGS__).fatal(); \ - } \ - return _kj_result; \ - }()) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)) - -#else - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - #__VA_ARGS__, ##__VA_ARGS__) - -#define KJ_DBG(...) KJ_LOG(DBG, ##__VA_ARGS__) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)); \ - }; \ - ::kj::_::Debug::ContextImpl \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*({ \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", #__VA_ARGS__, ##__VA_ARGS__).fatal(); \ - } \ - kj::mv(_kj_result); \ - })) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)) - -#endif - -#define KJ_SYSCALL_HANDLE_ERRORS(call) \ - if (int _kjSyscallError = ::kj::_::Debug::syscallError([&](){return (call);}, false)) \ - switch (int error = _kjSyscallError) -// Like KJ_SYSCALL, but doesn't throw. Instead, the block after the macro is a switch block on the -// error. Additionally, the int value `error` is defined within the block. So you can do: -// -// KJ_SYSCALL_HANDLE_ERRORS(foo()) { -// case ENOENT: -// handleNoSuchFile(); -// break; -// case EEXIST: -// handleExists(); -// break; -// default: -// KJ_FAIL_SYSCALL("foo()", error); -// } else { -// handleSuccessCase(); -// } - -#define KJ_ASSERT KJ_REQUIRE -#define KJ_FAIL_ASSERT KJ_FAIL_REQUIRE -#define KJ_ASSERT_NONNULL KJ_REQUIRE_NONNULL -// Use "ASSERT" in place of "REQUIRE" when the problem is local to the immediate surrounding code. -// That is, if the assert ever fails, it indicates that the immediate surrounding code is broken. - -#ifdef KJ_DEBUG -#define KJ_DLOG KJ_LOG -#define KJ_DASSERT KJ_ASSERT -#define KJ_DREQUIRE KJ_REQUIRE -#else -#define KJ_DLOG(...) do {} while (false) -#define KJ_DASSERT(...) do {} while (false) -#define KJ_DREQUIRE(...) do {} while (false) -#endif - -namespace _ { // private - -class Debug { -public: - Debug() = delete; - - typedef LogSeverity Severity; // backwards-compatibility - -#if _WIN32 - struct Win32Error { - // Hack for overloading purposes. - uint number; - inline explicit Win32Error(uint number): number(number) {} - }; -#endif - - static inline bool shouldLog(LogSeverity severity) { return severity >= minSeverity; } - // Returns whether messages of the given severity should be logged. - - static inline void setLogLevel(LogSeverity severity) { minSeverity = severity; } - // Set the minimum message severity which will be logged. - // - // TODO(someday): Expose publicly. - - template - static void log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params); - - class Fault { - public: - template - Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params); - Fault(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs); - Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs); -#if _WIN32 - Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs); -#endif - ~Fault() noexcept(false); - - KJ_NOINLINE KJ_NORETURN(void fatal()); - // Throw the exception. - - private: - void init(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs, ArrayPtr argValues); - void init(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#if _WIN32 - void init(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#endif - - Exception* exception; - }; - - class SyscallResult { - public: - inline SyscallResult(int errorNumber): errorNumber(errorNumber) {} - inline operator void*() { return errorNumber == 0 ? this : nullptr; } - inline int getErrorNumber() { return errorNumber; } - - private: - int errorNumber; - }; - - template - static SyscallResult syscall(Call&& call, bool nonblocking); - template - static int syscallError(Call&& call, bool nonblocking); - -#if _WIN32 - static bool isWin32Success(int boolean); - static bool isWin32Success(void* handle); - static Win32Error getWin32Error(); -#endif - - class Context: public ExceptionCallback { - public: - Context(); - KJ_DISALLOW_COPY(Context); - virtual ~Context() noexcept(false); - - struct Value { - const char* file; - int line; - String description; - - inline Value(const char* file, int line, String&& description) - : file(file), line(line), description(mv(description)) {} - }; - - virtual Value evaluate() = 0; - - virtual void onRecoverableException(Exception&& exception) override; - virtual void onFatalException(Exception&& exception) override; - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - - private: - bool logged; - Maybe value; - - Value ensureInitialized(); - }; - - template - class ContextImpl: public Context { - public: - inline ContextImpl(Func& func): func(func) {} - KJ_DISALLOW_COPY(ContextImpl); - - Value evaluate() override { - return func(); - } - private: - Func& func; - }; - - template - static String makeDescription(const char* macroArgs, Params&&... params); - -private: - static LogSeverity minSeverity; - - static void logInternal(const char* file, int line, LogSeverity severity, const char* macroArgs, - ArrayPtr argValues); - static String makeDescriptionInternal(const char* macroArgs, ArrayPtr argValues); - - static int getOsErrorNumber(bool nonblocking); - // Get the error code of the last error (e.g. from errno). Returns -1 on EINTR. -}; - -template -void Debug::log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - logInternal(file, line, severity, macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline void Debug::log<>(const char* file, int line, LogSeverity severity, const char* macroArgs) { - logInternal(file, line, severity, macroArgs, nullptr); -} - -template -Debug::Fault::Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params) - : exception(nullptr) { - String argValues[sizeof...(Params)] = {str(params)...}; - init(file, line, code, condition, macroArgs, - arrayPtr(argValues, sizeof...(Params))); -} - -inline Debug::Fault::Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline Debug::Fault::Fault(const char* file, int line, kj::Exception::Type type, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, type, condition, macroArgs, nullptr); -} - -#if _WIN32 -inline Debug::Fault::Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline bool Debug::isWin32Success(int boolean) { - return boolean; -} -inline bool Debug::isWin32Success(void* handle) { - // Assume null and INVALID_HANDLE_VALUE mean failure. - return handle != nullptr && handle != (void*)-1; -} -#endif - -template -Debug::SyscallResult Debug::syscall(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return SyscallResult(errorNum); - } - } - return SyscallResult(0); -} - -template -int Debug::syscallError(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return errorNum; - } - } - return 0; -} - -template -String Debug::makeDescription(const char* macroArgs, Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - return makeDescriptionInternal(macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline String Debug::makeDescription<>(const char* macroArgs) { - return makeDescriptionInternal(macroArgs, nullptr); -} - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_DEBUG_H_ diff --git a/phonelibs/capnp-cpp/include/kj/exception.h b/phonelibs/capnp-cpp/include/kj/exception.h deleted file mode 100644 index f6c0b2daa6..0000000000 --- a/phonelibs/capnp-cpp/include/kj/exception.h +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_EXCEPTION_H_ -#define KJ_EXCEPTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class ExceptionImpl; - -class Exception { - // Exception thrown in case of fatal errors. - // - // Actually, a subclass of this which also implements std::exception will be thrown, but we hide - // that fact from the interface to avoid #including . - -public: - enum class Type { - // What kind of failure? - - FAILED = 0, - // Something went wrong. This is the usual error type. KJ_ASSERT and KJ_REQUIRE throw this - // error type. - - OVERLOADED = 1, - // The call failed because of a temporary lack of resources. This could be space resources - // (out of memory, out of disk space) or time resources (request queue overflow, operation - // timed out). - // - // The operation might work if tried again, but it should NOT be repeated immediately as this - // may simply exacerbate the problem. - - DISCONNECTED = 2, - // The call required communication over a connection that has been lost. The callee will need - // to re-establish connections and try again. - - UNIMPLEMENTED = 3 - // The requested method is not implemented. The caller may wish to revert to a fallback - // approach based on other methods. - - // IF YOU ADD A NEW VALUE: - // - Update the stringifier. - // - Update Cap'n Proto's RPC protocol's Exception.Type enum. - }; - - Exception(Type type, const char* file, int line, String description = nullptr) noexcept; - Exception(Type type, String file, int line, String description = nullptr) noexcept; - Exception(const Exception& other) noexcept; - Exception(Exception&& other) = default; - ~Exception() noexcept; - - const char* getFile() const { return file; } - int getLine() const { return line; } - Type getType() const { return type; } - StringPtr getDescription() const { return description; } - ArrayPtr getStackTrace() const { return arrayPtr(trace, traceCount); } - - struct Context { - // Describes a bit about what was going on when the exception was thrown. - - const char* file; - int line; - String description; - Maybe> next; - - Context(const char* file, int line, String&& description, Maybe>&& next) - : file(file), line(line), description(mv(description)), next(mv(next)) {} - Context(const Context& other) noexcept; - }; - - inline Maybe getContext() const { - KJ_IF_MAYBE(c, context) { - return **c; - } else { - return nullptr; - } - } - - void wrapContext(const char* file, int line, String&& description); - // Wraps the context in a new node. This becomes the head node returned by getContext() -- it - // is expected that contexts will be added in reverse order as the exception passes up the - // callback stack. - - KJ_NOINLINE void extendTrace(uint ignoreCount); - // Append the current stack trace to the exception's trace, ignoring the first `ignoreCount` - // frames (see `getStackTrace()` for discussion of `ignoreCount`). - - KJ_NOINLINE void truncateCommonTrace(); - // Remove the part of the stack trace which the exception shares with the caller of this method. - // This is used by the async library to remove the async infrastructure from the stack trace - // before replacing it with the async trace. - - void addTrace(void* ptr); - // Append the given pointer to the backtrace, if it is not already full. This is used by the - // async library to trace through the promise chain that led to the exception. - -private: - String ownFile; - const char* file; - int line; - Type type; - String description; - Maybe> context; - void* trace[32]; - uint traceCount; - - friend class ExceptionImpl; -}; - -StringPtr KJ_STRINGIFY(Exception::Type type); -String KJ_STRINGIFY(const Exception& e); - -// ======================================================================================= - -enum class LogSeverity { - INFO, // Information describing what the code is up to, which users may request to see - // with a flag like `--verbose`. Does not indicate a problem. Not printed by - // default; you must call setLogLevel(INFO) to enable. - WARNING, // A problem was detected but execution can continue with correct output. - ERROR, // Something is wrong, but execution can continue with garbage output. - FATAL, // Something went wrong, and execution cannot continue. - DBG // Temporary debug logging. See KJ_DBG. - - // Make sure to update the stringifier if you add a new severity level. -}; - -StringPtr KJ_STRINGIFY(LogSeverity severity); - -class ExceptionCallback { - // If you don't like C++ exceptions, you may implement and register an ExceptionCallback in order - // to perform your own exception handling. For example, a reasonable thing to do is to have - // onRecoverableException() set a flag indicating that an error occurred, and then check for that - // flag just before writing to storage and/or returning results to the user. If the flag is set, - // discard whatever you have and return an error instead. - // - // ExceptionCallbacks must always be allocated on the stack. When an exception is thrown, the - // newest ExceptionCallback on the calling thread's stack is called. The default implementation - // of each method calls the next-oldest ExceptionCallback for that thread. Thus the callbacks - // behave a lot like try/catch blocks, except that they are called before any stack unwinding - // occurs. - -public: - ExceptionCallback(); - KJ_DISALLOW_COPY(ExceptionCallback); - virtual ~ExceptionCallback() noexcept(false); - - virtual void onRecoverableException(Exception&& exception); - // Called when an exception has been raised, but the calling code has the ability to continue by - // producing garbage output. This method _should_ throw the exception, but is allowed to simply - // return if garbage output is acceptable. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void onFatalException(Exception&& exception); - // Called when an exception has been raised and the calling code cannot continue. If this method - // returns normally, abort() will be called. The method must throw the exception to avoid - // aborting. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text); - // Called when something wants to log some debug text. `contextDepth` indicates how many levels - // of context the message passed through; it may make sense to indent the message accordingly. - // - // The global default implementation writes the text to stderr. - - enum class StackTraceMode { - FULL, - // Stringifying a stack trace will attempt to determine source file and line numbers. This may - // be expensive. For example, on Linux, this shells out to `addr2line`. - // - // This is the default in debug builds. - - ADDRESS_ONLY, - // Stringifying a stack trace will only generate a list of code addresses. - // - // This is the default in release builds. - - NONE - // Generating a stack trace will always return an empty array. - // - // This avoids ever unwinding the stack. On Windows in particular, the stack unwinding library - // has been observed to be pretty slow, so exception-heavy code might benefit significantly - // from this setting. (But exceptions should be rare...) - }; - - virtual StackTraceMode stackTraceMode(); - // Returns the current preferred stack trace mode. - -protected: - ExceptionCallback& next; - -private: - ExceptionCallback(ExceptionCallback& next); - - class RootExceptionCallback; - friend ExceptionCallback& getExceptionCallback(); -}; - -ExceptionCallback& getExceptionCallback(); -// Returns the current exception callback. - -KJ_NOINLINE KJ_NORETURN(void throwFatalException(kj::Exception&& exception, uint ignoreCount = 0)); -// Invoke the exception callback to throw the given fatal exception. If the exception callback -// returns, abort. - -KJ_NOINLINE void throwRecoverableException(kj::Exception&& exception, uint ignoreCount = 0); -// Invoke the exception callback to throw the given recoverable exception. If the exception -// callback returns, return normally. - -// ======================================================================================= - -namespace _ { class Runnable; } - -template -Maybe runCatchingExceptions(Func&& func) noexcept; -// Executes the given function (usually, a lambda returning nothing) catching any exceptions that -// are thrown. Returns the Exception if there was one, or null if the operation completed normally. -// Non-KJ exceptions will be wrapped. -// -// If exception are disabled (e.g. with -fno-exceptions), this will still detect whether any -// recoverable exceptions occurred while running the function and will return those. - -class UnwindDetector { - // Utility for detecting when a destructor is called due to unwind. Useful for: - // - Avoiding throwing exceptions in this case, which would terminate the program. - // - Detecting whether to commit or roll back a transaction. - // - // To use this class, either inherit privately from it or declare it as a member. The detector - // works by comparing the exception state against that when the constructor was called, so for - // an object that was actually constructed during exception unwind, it will behave as if no - // unwind is taking place. This is usually the desired behavior. - -public: - UnwindDetector(); - - bool isUnwinding() const; - // Returns true if the current thread is in a stack unwind that it wasn't in at the time the - // object was constructed. - - template - void catchExceptionsIfUnwinding(Func&& func) const; - // Runs the given function (e.g., a lambda). If isUnwinding() is true, any exceptions are - // caught and treated as secondary faults, meaning they are considered to be side-effects of the - // exception that is unwinding the stack. Otherwise, exceptions are passed through normally. - -private: - uint uncaughtCount; - - void catchExceptionsAsSecondaryFaults(_::Runnable& runnable) const; -}; - -namespace _ { // private - -class Runnable { -public: - virtual void run() = 0; -}; - -template -class RunnableImpl: public Runnable { -public: - RunnableImpl(Func&& func): func(kj::mv(func)) {} - void run() override { - func(); - } -private: - Func func; -}; - -Maybe runCatchingExceptions(Runnable& runnable) noexcept; - -} // namespace _ (private) - -template -Maybe runCatchingExceptions(Func&& func) noexcept { - _::RunnableImpl> runnable(kj::fwd(func)); - return _::runCatchingExceptions(runnable); -} - -template -void UnwindDetector::catchExceptionsIfUnwinding(Func&& func) const { - if (isUnwinding()) { - _::RunnableImpl> runnable(kj::fwd(func)); - catchExceptionsAsSecondaryFaults(runnable); - } else { - func(); - } -} - -#define KJ_ON_SCOPE_SUCCESS(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (!KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited normally (not due to an exception). - -#define KJ_ON_SCOPE_FAILURE(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited due to an exception. - -// ======================================================================================= - -KJ_NOINLINE ArrayPtr getStackTrace(ArrayPtr space, uint ignoreCount); -// Attempt to get the current stack trace, returning a list of pointers to instructions. The -// returned array is a slice of `space`. Provide a larger `space` to get a deeper stack trace. -// If the platform doesn't support stack traces, returns an empty array. -// -// `ignoreCount` items will be truncated from the front of the trace. This is useful for chopping -// off a prefix of the trace that is uninteresting to the developer because it's just locations -// inside the debug infrastructure that is requesting the trace. Be careful to mark functions as -// KJ_NOINLINE if you intend to count them in `ignoreCount`. Note that, unfortunately, the -// ignored entries will still waste space in the `space` array (and the returned array's `begin()` -// is never exactly equal to `space.begin()` due to this effect, even if `ignoreCount` is zero -// since `getStackTrace()` needs to ignore its own internal frames). - -String stringifyStackTrace(ArrayPtr); -// Convert the stack trace to a string with file names and line numbers. This may involve executing -// suprocesses. - -String getStackTrace(); -// Get a stack trace right now and stringify it. Useful for debugging. - -void printStackTraceOnCrash(); -// Registers signal handlers on common "crash" signals like SIGSEGV that will (attempt to) print -// a stack trace. You should call this as early as possible on program startup. Programs using -// KJ_MAIN get this automatically. - -kj::StringPtr trimSourceFilename(kj::StringPtr filename); -// Given a source code file name, trim off noisy prefixes like "src/" or -// "/ekam-provider/canonical/". - -} // namespace kj - -#endif // KJ_EXCEPTION_H_ diff --git a/phonelibs/capnp-cpp/include/kj/function.h b/phonelibs/capnp-cpp/include/kj/function.h deleted file mode 100644 index ba6601b560..0000000000 --- a/phonelibs/capnp-cpp/include/kj/function.h +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_FUNCTION_H_ -#define KJ_FUNCTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" - -namespace kj { - -template -class Function; -// Function wrapper using virtual-based polymorphism. Use this when template polymorphism is -// not possible. You can, for example, accept a Function as a parameter: -// -// void setFilter(Function filter); -// -// The caller of `setFilter()` may then pass any callable object as the parameter. The callable -// object does not have to have the exact signature specified, just one that is "compatible" -- -// i.e. the return type is covariant and the parameters are contravariant. -// -// Unlike `std::function`, `kj::Function`s are movable but not copyable, just like `kj::Own`. This -// is to avoid unexpected heap allocation or slow atomic reference counting. -// -// When a `Function` is constructed from an lvalue, it captures only a reference to the value. -// When constructed from an rvalue, it invokes the value's move constructor. So, for example: -// -// struct AddN { -// int n; -// int operator(int i) { return i + n; } -// } -// -// Function f1 = AddN{2}; -// // f1 owns an instance of AddN. It may safely be moved out -// // of the local scope. -// -// AddN adder(2); -// Function f2 = adder; -// // f2 contains a reference to `adder`. Thus, it becomes invalid -// // when `adder` goes out-of-scope. -// -// AddN adder2(2); -// Function f3 = kj::mv(adder2); -// // f3 owns an insatnce of AddN moved from `adder2`. f3 may safely -// // be moved out of the local scope. -// -// Additionally, a Function may be bound to a class method using KJ_BIND_METHOD(object, methodName). -// For example: -// -// class Printer { -// public: -// void print(int i); -// void print(kj::StringPtr s); -// }; -// -// Printer p; -// -// Function intPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(int). -// -// Function strPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(kj::StringPtr). -// -// Notice how KJ_BIND_METHOD is able to figure out which overload to use depending on the kind of -// Function it is binding to. - -template -class ConstFunction; -// Like Function, but wraps a "const" (i.e. thread-safe) call. - -template -class Function { -public: - template - inline Function(F&& f): impl(heap>(kj::fwd(f))) {} - Function() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(Function); - Function(Function&) = delete; - Function& operator=(Function&) = delete; - template Function(const Function&) = delete; - template Function& operator=(const Function&) = delete; - template Function(const ConstFunction&) = delete; - template Function& operator=(const ConstFunction&) = delete; - Function(Function&&) = default; - Function& operator=(Function&&) = default; - - inline Return operator()(Params... params) { - return (*impl)(kj::fwd(params)...); - } - - Function reference() { - // Forms a new Function of the same type that delegates to this Function by reference. - // Therefore, this Function must outlive the returned Function, but otherwise they behave - // exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -template -class ConstFunction { -public: - template - inline ConstFunction(F&& f): impl(heap>(kj::fwd(f))) {} - ConstFunction() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(ConstFunction); - ConstFunction(ConstFunction&) = delete; - ConstFunction& operator=(ConstFunction&) = delete; - template ConstFunction(const ConstFunction&) = delete; - template ConstFunction& operator=(const ConstFunction&) = delete; - template ConstFunction(const Function&) = delete; - template ConstFunction& operator=(const Function&) = delete; - ConstFunction(ConstFunction&&) = default; - ConstFunction& operator=(ConstFunction&&) = default; - - inline Return operator()(Params... params) const { - return (*impl)(kj::fwd(params)...); - } - - ConstFunction reference() const { - // Forms a new ConstFunction of the same type that delegates to this ConstFunction by reference. - // Therefore, this ConstFunction must outlive the returned ConstFunction, but otherwise they - // behave exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) const = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) const override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -#if 1 - -namespace _ { // private - -template -class BoundMethod; - -template ::*method)(Params...)> -class BoundMethod::*)(Params...), method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -template ::*method)(Params...) const> -class BoundMethod::*)(Params...) const, method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) const { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -} // namespace _ (private) - -#define KJ_BIND_METHOD(obj, method) \ - ::kj::_::BoundMethod::method), \ - &::kj::Decay::method>(obj) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. -// -// The current implementation requires that the method is not overloaded. -// -// TODO(someday): C++14's generic lambdas may be able to simplify this code considerably, and -// probably make it work with overloaded methods. - -#else -// Here's a better implementation of the above that doesn't work with GCC (but does with Clang) -// because it uses a local class with a template method. Sigh. This implementation supports -// overloaded methods. - -#define KJ_BIND_METHOD(obj, method) \ - ({ \ - typedef KJ_DECLTYPE_REF(obj) T; \ - class F { \ - public: \ - inline F(T&& t): t(::kj::fwd(t)) {} \ - template \ - auto operator()(Params&&... params) \ - -> decltype(::kj::instance().method(::kj::fwd(params)...)) { \ - return t.method(::kj::fwd(params)...); \ - } \ - private: \ - T t; \ - }; \ - (F(obj)); \ - }) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. - -#endif - -} // namespace kj - -#endif // KJ_FUNCTION_H_ diff --git a/phonelibs/capnp-cpp/include/kj/io.h b/phonelibs/capnp-cpp/include/kj/io.h deleted file mode 100644 index f5c03bfe7b..0000000000 --- a/phonelibs/capnp-cpp/include/kj/io.h +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_IO_H_ -#define KJ_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "common.h" -#include "array.h" -#include "exception.h" - -namespace kj { - -// ======================================================================================= -// Abstract interfaces - -class InputStream { -public: - virtual ~InputStream() noexcept(false); - - size_t read(void* buffer, size_t minBytes, size_t maxBytes); - // Reads at least minBytes and at most maxBytes, copying them into the given buffer. Returns - // the size read. Throws an exception on errors. Implemented in terms of tryRead(). - // - // maxBytes is the number of bytes the caller really wants, but minBytes is the minimum amount - // needed by the caller before it can start doing useful processing. If the stream returns less - // than maxBytes, the caller will usually call read() again later to get the rest. Returning - // less than maxBytes is useful when it makes sense for the caller to parallelize processing - // with I/O. - // - // Never blocks if minBytes is zero. If minBytes is zero and maxBytes is non-zero, this may - // attempt a non-blocking read or may just return zero. To force a read, use a non-zero minBytes. - // To detect EOF without throwing an exception, use tryRead(). - // - // If the InputStream can't produce minBytes, it MUST throw an exception, as the caller is not - // expected to understand how to deal with partial reads. - - virtual size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - // Like read(), but may return fewer than minBytes on EOF. - - inline void read(void* buffer, size_t bytes) { read(buffer, bytes, bytes); } - // Convenience method for reading an exact number of bytes. - - virtual void skip(size_t bytes); - // Skips past the given number of bytes, discarding them. The default implementation read()s - // into a scratch buffer. -}; - -class OutputStream { -public: - virtual ~OutputStream() noexcept(false); - - virtual void write(const void* buffer, size_t size) = 0; - // Always writes the full size. Throws exception on error. - - virtual void write(ArrayPtr> pieces); - // Equivalent to write()ing each byte array in sequence, which is what the default implementation - // does. Override if you can do something better, e.g. use writev() to do the write in a single - // syscall. -}; - -class BufferedInputStream: public InputStream { - // An input stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An input stream that actually reads from some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedInputStream() noexcept(false); - - ArrayPtr getReadBuffer(); - // Get a direct pointer into the read buffer, which contains the next bytes in the input. If the - // caller consumes any bytes, it should then call skip() to indicate this. This always returns a - // non-empty buffer or throws an exception. Implemented in terms of tryGetReadBuffer(). - - virtual ArrayPtr tryGetReadBuffer() = 0; - // Like getReadBuffer() but may return an empty buffer on EOF. -}; - -class BufferedOutputStream: public OutputStream { - // An output stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An output stream that actually writes into some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedOutputStream() noexcept(false); - - virtual ArrayPtr getWriteBuffer() = 0; - // Get a direct pointer into the write buffer. The caller may choose to fill in some prefix of - // this buffer and then pass it to write(), in which case write() may avoid a copy. It is - // incorrect to pass to write any slice of this buffer which is not a prefix. -}; - -// ======================================================================================= -// Buffered streams implemented as wrappers around regular streams - -class BufferedInputStreamWrapper: public BufferedInputStream { - // Implements BufferedInputStream in terms of an InputStream. - // - // Note that the underlying stream's position is unpredictable once the wrapper is destroyed, - // unless the entire stream was consumed. To read a predictable number of bytes in a buffered - // way without going over, you'd need this wrapper to wrap some other wrapper which itself - // implements an artificial EOF at the desired point. Such a stream should be trivial to write - // but is not provided by the library at this time. - -public: - explicit BufferedInputStreamWrapper(InputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. No guarantee is made about - // the position of the inner stream after a buffered wrapper has been created unless the entire - // input is read. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedInputStreamWrapper); - ~BufferedInputStreamWrapper() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - InputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - ArrayPtr bufferAvailable; -}; - -class BufferedOutputStreamWrapper: public BufferedOutputStream { - // Implements BufferedOutputStream in terms of an OutputStream. Note that writes to the - // underlying stream may be delayed until flush() is called or the wrapper is destroyed. - -public: - explicit BufferedOutputStreamWrapper(OutputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedOutputStreamWrapper); - ~BufferedOutputStreamWrapper() noexcept(false); - - void flush(); - // Force the wrapper to write any remaining bytes in its buffer to the inner stream. Note that - // this only flushes this object's buffer; this object has no idea how to flush any other buffers - // that may be present in the underlying stream. - - // implements BufferedOutputStream --------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - OutputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - byte* bufferPos; - UnwindDetector unwindDetector; -}; - -// ======================================================================================= -// Array I/O - -class ArrayInputStream: public BufferedInputStream { -public: - explicit ArrayInputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayInputStream); - ~ArrayInputStream() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - ArrayPtr array; -}; - -class ArrayOutputStream: public BufferedOutputStream { -public: - explicit ArrayOutputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayOutputStream); - ~ArrayOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(array.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - ArrayPtr array; - byte* fillPos; -}; - -class VectorOutputStream: public BufferedOutputStream { -public: - explicit VectorOutputStream(size_t initialCapacity = 4096); - KJ_DISALLOW_COPY(VectorOutputStream); - ~VectorOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(vector.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - Array vector; - byte* fillPos; - - void grow(size_t minSize); -}; - -// ======================================================================================= -// File descriptor I/O - -class AutoCloseFd { - // A wrapper around a file descriptor which automatically closes the descriptor when destroyed. - // The wrapper supports move construction for transferring ownership of the descriptor. If - // close() returns an error, the destructor throws an exception, UNLESS the destructor is being - // called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseFd. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseFd(): fd(-1) {} - inline AutoCloseFd(decltype(nullptr)): fd(-1) {} - inline explicit AutoCloseFd(int fd): fd(fd) {} - inline AutoCloseFd(AutoCloseFd&& other) noexcept: fd(other.fd) { other.fd = -1; } - KJ_DISALLOW_COPY(AutoCloseFd); - ~AutoCloseFd() noexcept(false); - - inline AutoCloseFd& operator=(AutoCloseFd&& other) { - AutoCloseFd old(kj::mv(*this)); - fd = other.fd; - other.fd = -1; - return *this; - } - - inline AutoCloseFd& operator=(decltype(nullptr)) { - AutoCloseFd old(kj::mv(*this)); - return *this; - } - - inline operator int() const { return fd; } - inline int get() const { return fd; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the int conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return fd < 0; } - inline bool operator!=(decltype(nullptr)) { return fd >= 0; } - -private: - int fd; - UnwindDetector unwindDetector; -}; - -inline auto KJ_STRINGIFY(const AutoCloseFd& fd) - -> decltype(kj::toCharSequence(implicitCast(fd))) { - return kj::toCharSequence(implicitCast(fd)); -} - -class FdInputStream: public InputStream { - // An InputStream wrapping a file descriptor. - -public: - explicit FdInputStream(int fd): fd(fd) {} - explicit FdInputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdInputStream); - ~FdInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -class FdOutputStream: public OutputStream { - // An OutputStream wrapping a file descriptor. - -public: - explicit FdOutputStream(int fd): fd(fd) {} - explicit FdOutputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdOutputStream); - ~FdOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - void write(ArrayPtr> pieces) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -// ======================================================================================= -// Win32 Handle I/O - -#ifdef _WIN32 - -class AutoCloseHandle { - // A wrapper around a Win32 HANDLE which automatically closes the handle when destroyed. - // The wrapper supports move construction for transferring ownership of the handle. If - // CloseHandle() returns an error, the destructor throws an exception, UNLESS the destructor is - // being called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseHandle. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseHandle(): handle((void*)-1) {} - inline AutoCloseHandle(decltype(nullptr)): handle((void*)-1) {} - inline explicit AutoCloseHandle(void* handle): handle(handle) {} - inline AutoCloseHandle(AutoCloseHandle&& other) noexcept: handle(other.handle) { - other.handle = (void*)-1; - } - KJ_DISALLOW_COPY(AutoCloseHandle); - ~AutoCloseHandle() noexcept(false); - - inline AutoCloseHandle& operator=(AutoCloseHandle&& other) { - AutoCloseHandle old(kj::mv(*this)); - handle = other.handle; - other.handle = (void*)-1; - return *this; - } - - inline AutoCloseHandle& operator=(decltype(nullptr)) { - AutoCloseHandle old(kj::mv(*this)); - return *this; - } - - inline operator void*() const { return handle; } - inline void* get() const { return handle; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the void* conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return handle != (void*)-1; } - inline bool operator!=(decltype(nullptr)) { return handle == (void*)-1; } - -private: - void* handle; // -1 (aka INVALID_HANDLE_VALUE) if not valid. -}; - -class HandleInputStream: public InputStream { - // An InputStream wrapping a Win32 HANDLE. - -public: - explicit HandleInputStream(void* handle): handle(handle) {} - explicit HandleInputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleInputStream); - ~HandleInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -class HandleOutputStream: public OutputStream { - // An OutputStream wrapping a Win32 HANDLE. - -public: - explicit HandleOutputStream(void* handle): handle(handle) {} - explicit HandleOutputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleOutputStream); - ~HandleOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -#endif // _WIN32 - -} // namespace kj - -#endif // KJ_IO_H_ diff --git a/phonelibs/capnp-cpp/include/kj/main.h b/phonelibs/capnp-cpp/include/kj/main.h deleted file mode 100644 index 4dcd804fd4..0000000000 --- a/phonelibs/capnp-cpp/include/kj/main.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MAIN_H_ -#define KJ_MAIN_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" -#include "string.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class ProcessContext { - // Context for command-line programs. - -public: - virtual StringPtr getProgramName() = 0; - // Get argv[0] as passed to main(). - - KJ_NORETURN(virtual void exit()) = 0; - // Indicates program completion. The program is considered successful unless `error()` was - // called. Typically this exits with _Exit(), meaning that the stack is not unwound, buffers - // are not flushed, etc. -- it is the responsibility of the caller to flush any buffers that - // matter. However, an alternate context implementation e.g. for unit testing purposes could - // choose to throw an exception instead. - // - // At first this approach may sound crazy. Isn't it much better to shut down cleanly? What if - // you lose data? However, it turns out that if you look at each common class of program, _Exit() - // is almost always preferable. Let's break it down: - // - // * Commands: A typical program you might run from the command line is single-threaded and - // exits quickly and deterministically. Commands often use buffered I/O and need to flush - // those buffers before exit. However, most of the work performed by destructors is not - // flushing buffers, but rather freeing up memory, placing objects into freelists, and closing - // file descriptors. All of this is irrelevant if the process is about to exit anyway, and - // for a command that runs quickly, time wasted freeing heap space may make a real difference - // in the overall runtime of a script. Meanwhile, it is usually easy to determine exactly what - // resources need to be flushed before exit, and easy to tell if they are not being flushed - // (because the command fails to produce the expected output). Therefore, it is reasonably - // easy for commands to explicitly ensure all output is flushed before exiting, and it is - // probably a good idea for them to do so anyway, because write failures should be detected - // and handled. For commands, a good strategy is to allocate any objects that require clean - // destruction on the stack, and allow them to go out of scope before the command exits. - // Meanwhile, any resources which do not need to be cleaned up should be allocated as members - // of the command's main class, whose destructor normally will not be called. - // - // * Interactive apps: Programs that interact with the user (whether they be graphical apps - // with windows or console-based apps like emacs) generally exit only when the user asks them - // to. Such applications may store large data structures in memory which need to be synced - // to disk, such as documents or user preferences. However, relying on stack unwind or global - // destructors as the mechanism for ensuring such syncing occurs is probably wrong. First of - // all, it's 2013, and applications ought to be actively syncing changes to non-volatile - // storage the moment those changes are made. Applications can crash at any time and a crash - // should never lose data that is more than half a second old. Meanwhile, if a user actually - // does try to close an application while unsaved changes exist, the application UI should - // prompt the user to decide what to do. Such a UI mechanism is obviously too high level to - // be implemented via destructors, so KJ's use of _Exit() shouldn't make a difference here. - // - // * Servers: A good server is fault-tolerant, prepared for the possibility that at any time - // it could crash, the OS could decide to kill it off, or the machine it is running on could - // just die. So, using _Exit() should be no problem. In fact, servers generally never even - // call exit anyway; they are killed externally. - // - // * Batch jobs: A long-running batch job is something between a command and a server. It - // probably knows exactly what needs to be flushed before exiting, and it probably should be - // fault-tolerant. - // - // Meanwhile, regardless of program type, if you are adhering to KJ style, then the use of - // _Exit() shouldn't be a problem anyway: - // - // * KJ style forbids global mutable state (singletons) in general and global constructors and - // destructors in particular. Therefore, everything that could possibly need cleanup either - // lives on the stack or is transitively owned by something living on the stack. - // - // * Calling exit() simply means "Don't clean up anything older than this stack frame.". If you - // have resources that require cleanup before exit, make sure they are owned by stack frames - // beyond the one that eventually calls exit(). To be as safe as possible, don't place any - // state in your program's main class, and don't call exit() yourself. Then, runMainAndExit() - // will do it, and the only thing on the stack at that time will be your main class, which - // has no state anyway. - // - // TODO(someday): Perhaps we should use the new std::quick_exit(), so that at_quick_exit() is - // available for those who really think they need it. Unfortunately, it is not yet available - // on many platforms. - - virtual void warning(StringPtr message) = 0; - // Print the given message to standard error. A newline is printed after the message if it - // doesn't already have one. - - virtual void error(StringPtr message) = 0; - // Like `warning()`, but also sets a flag indicating that the process has failed, and that when - // it eventually exits it should indicate an error status. - - KJ_NORETURN(virtual void exitError(StringPtr message)) = 0; - // Equivalent to `error(message)` followed by `exit()`. - - KJ_NORETURN(virtual void exitInfo(StringPtr message)) = 0; - // Displays the given non-error message to the user and then calls `exit()`. This is used to - // implement things like --help. - - virtual void increaseLoggingVerbosity() = 0; - // Increase the level of detail produced by the debug logging system. `MainBuilder` invokes - // this if the caller uses the -v flag. - - // TODO(someday): Add interfaces representing standard OS resources like the filesystem, so that - // these things can be mocked out. -}; - -class TopLevelProcessContext final: public ProcessContext { - // A ProcessContext implementation appropriate for use at the actual entry point of a process - // (as opposed to when you are trying to call a program's main function from within some other - // program). This implementation writes errors to stderr, and its `exit()` method actually - // calls the C `quick_exit()` function. - -public: - explicit TopLevelProcessContext(StringPtr programName); - - struct CleanShutdownException { int exitCode; }; - // If the environment variable KJ_CLEAN_SHUTDOWN is set, then exit() will actually throw this - // exception rather than exiting. `kj::runMain()` catches this exception and returns normally. - // This is useful primarily for testing purposes, to assist tools like memory leak checkers that - // are easily confused by quick_exit(). - - StringPtr getProgramName() override; - KJ_NORETURN(void exit() override); - void warning(StringPtr message) override; - void error(StringPtr message) override; - KJ_NORETURN(void exitError(StringPtr message) override); - KJ_NORETURN(void exitInfo(StringPtr message) override); - void increaseLoggingVerbosity() override; - -private: - StringPtr programName; - bool cleanShutdown; - bool hadErrors = false; -}; - -typedef Function params)> MainFunc; - -int runMainAndExit(ProcessContext& context, MainFunc&& func, int argc, char* argv[]); -// Runs the given main function and then exits using the given context. If an exception is thrown, -// this will catch it, report it via the context and exit with an error code. -// -// Normally this function does not return, because returning would probably lead to wasting time -// on cleanup when the process is just going to exit anyway. However, to facilitate memory leak -// checkers and other tools that require a clean shutdown to do their job, if the environment -// variable KJ_CLEAN_SHUTDOWN is set, the function will in fact return an exit code, which should -// then be returned from main(). -// -// Most users will use the KJ_MAIN() macro rather than call this function directly. - -#define KJ_MAIN(MainClass) \ - int main(int argc, char* argv[]) { \ - ::kj::TopLevelProcessContext context(argv[0]); \ - MainClass mainObject(context); \ - return ::kj::runMainAndExit(context, mainObject.getMain(), argc, argv); \ - } -// Convenience macro for declaring a main function based on the given class. The class must have -// a constructor that accepts a ProcessContext& and a method getMain() which returns -// kj::MainFunc (probably building it using a MainBuilder). - -class MainBuilder { - // Builds a main() function with nice argument parsing. As options and arguments are parsed, - // corresponding callbacks are called, so that you never have to write a massive switch() - // statement to interpret arguments. Additionally, this approach encourages you to write - // main classes that have a reasonable API that can be used as an alternative to their - // command-line interface. - // - // All StringPtrs passed to MainBuilder must remain valid until option parsing completes. The - // assumption is that these strings will all be literals, making this an easy requirement. If - // not, consider allocating them in an Arena. - // - // Some flags are automatically recognized by the main functions built by this class: - // --help: Prints help text and exits. The help text is constructed based on the - // information you provide to the builder as you define each flag. - // --verbose: Increase logging verbosity. - // --version: Print version information and exit. - // - // Example usage: - // - // class FooMain { - // public: - // FooMain(kj::ProcessContext& context): context(context) {} - // - // bool setAll() { all = true; return true; } - // // Enable the --all flag. - // - // kj::MainBuilder::Validity setOutput(kj::StringPtr name) { - // // Set the output file. - // - // if (name.endsWith(".foo")) { - // outputFile = name; - // return true; - // } else { - // return "Output file must have extension .foo."; - // } - // } - // - // kj::MainBuilder::Validity processInput(kj::StringPtr name) { - // // Process an input file. - // - // if (!exists(name)) { - // return kj::str(name, ": file not found"); - // } - // // ... process the input file ... - // return true; - // } - // - // kj::MainFunc getMain() { - // return MainBuilder(context, "Foo Builder v1.5", "Reads s and builds a Foo.") - // .addOption({'a', "all"}, KJ_BIND_METHOD(*this, setAll), - // "Frob all the widgets. Otherwise, only some widgets are frobbed.") - // .addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to . Must be a .foo file.") - // .expectOneOrMoreArgs("", KJ_BIND_METHOD(*this, processInput)) - // .build(); - // } - // - // private: - // bool all = false; - // kj::StringPtr outputFile; - // kj::ProcessContext& context; - // }; - -public: - MainBuilder(ProcessContext& context, StringPtr version, - StringPtr briefDescription, StringPtr extendedDescription = nullptr); - ~MainBuilder() noexcept(false); - - class OptionName { - public: - OptionName() = default; - inline OptionName(char shortName): isLong(false), shortName(shortName) {} - inline OptionName(const char* longName): isLong(true), longName(longName) {} - - private: - bool isLong; - union { - char shortName; - const char* longName; - }; - friend class MainBuilder; - }; - - class Validity { - public: - inline Validity(bool valid) { - if (!valid) errorMessage = heapString("invalid argument"); - } - inline Validity(const char* errorMessage) - : errorMessage(heapString(errorMessage)) {} - inline Validity(String&& errorMessage) - : errorMessage(kj::mv(errorMessage)) {} - - inline const Maybe& getError() const { return errorMessage; } - inline Maybe releaseError() { return kj::mv(errorMessage); } - - private: - Maybe errorMessage; - friend class MainBuilder; - }; - - MainBuilder& addOption(std::initializer_list names, Function callback, - StringPtr helpText); - // Defines a new option (flag). `names` is a list of characters and strings that can be used to - // specify the option on the command line. Single-character names are used with "-" while string - // names are used with "--". `helpText` is a natural-language description of the flag. - // - // `callback` is called when the option is seen. Its return value indicates whether the option - // was accepted. If not, further option processing stops, and error is written, and the process - // exits. - // - // Example: - // - // builder.addOption({'a', "all"}, KJ_BIND_METHOD(*this, showAll), "Show all files."); - // - // This option could be specified in the following ways: - // - // -a - // --all - // - // Note that single-character option names can be combined into a single argument. For example, - // `-abcd` is equivalent to `-a -b -c -d`. - // - // The help text for this option would look like: - // - // -a, --all - // Show all files. - // - // Note that help text is automatically word-wrapped. - - MainBuilder& addOptionWithArg(std::initializer_list names, - Function callback, - StringPtr argumentTitle, StringPtr helpText); - // Like `addOption()`, but adds an option which accepts an argument. `argumentTitle` is used in - // the help text. The argument text is passed to the callback. - // - // Example: - // - // builder.addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to ."); - // - // This option could be specified with an argument of "foo" in the following ways: - // - // -ofoo - // -o foo - // --output=foo - // --output foo - // - // Note that single-character option names can be combined, but only the last option can have an - // argument, since the characters after the option letter are interpreted as the argument. E.g. - // `-abofoo` would be equivalent to `-a -b -o foo`. - // - // The help text for this option would look like: - // - // -o FILENAME, --output=FILENAME - // Output to FILENAME. - - MainBuilder& addSubCommand(StringPtr name, Function getSubParser, - StringPtr briefHelpText); - // If exactly the given name is seen as an argument, invoke getSubParser() and then pass all - // remaining arguments to the parser it returns. This is useful for implementing commands which - // have lots of sub-commands, like "git" (which has sub-commands "checkout", "branch", "pull", - // etc.). - // - // `getSubParser` is only called if the command is seen. This avoids building main functions - // for commands that aren't used. - // - // `briefHelpText` should be brief enough to show immediately after the command name on a single - // line. It will not be wrapped. Users can use the built-in "help" command to get extended - // help on a particular command. - - MainBuilder& expectArg(StringPtr title, Function callback); - MainBuilder& expectOptionalArg(StringPtr title, Function callback); - MainBuilder& expectZeroOrMoreArgs(StringPtr title, Function callback); - MainBuilder& expectOneOrMoreArgs(StringPtr title, Function callback); - // Set callbacks to handle arguments. `expectArg()` and `expectOptionalArg()` specify positional - // arguments with special handling, while `expect{Zero,One}OrMoreArgs()` specifies a handler for - // an argument list (the handler is called once for each argument in the list). `title` - // specifies how the argument should be represented in the usage text. - // - // All options callbacks are called before argument callbacks, regardless of their ordering on - // the command line. This matches GNU getopt's behavior of permuting non-flag arguments to the - // end of the argument list. Also matching getopt, the special option "--" indicates that the - // rest of the command line is all arguments, not options, even if they start with '-'. - // - // The interpretation of positional arguments is fairly flexible. The non-optional arguments can - // be expected at the beginning, end, or in the middle. If more arguments are specified than - // the number of non-optional args, they are assigned to the optional argument handlers in the - // order of registration. - // - // For example, say you called: - // builder.expectArg("", ...); - // builder.expectOptionalArg("", ...); - // builder.expectArg("", ...); - // builder.expectZeroOrMoreArgs("", ...); - // builder.expectArg("", ...); - // - // This command requires at least three arguments: foo, baz, and corge. If four arguments are - // given, the second is assigned to bar. If five or more arguments are specified, then the - // arguments between the third and last are assigned to qux. Note that it never makes sense - // to call `expect*OrMoreArgs()` more than once since only the first call would ever be used. - // - // In practice, you probably shouldn't create such complicated commands as in the above example. - // But, this flexibility seems necessary to support commands where the first argument is special - // as well as commands (like `cp`) where the last argument is special. - - MainBuilder& callAfterParsing(Function callback); - // Call the given function after all arguments have been parsed. - - MainFunc build(); - // Build the "main" function, which simply parses the arguments. Once this returns, the - // `MainBuilder` is no longer valid. - -private: - struct Impl; - Own impl; - - class MainImpl; -}; - -} // namespace kj - -#endif // KJ_MAIN_H_ diff --git a/phonelibs/capnp-cpp/include/kj/memory.h b/phonelibs/capnp-cpp/include/kj/memory.h deleted file mode 100644 index 60912b0a34..0000000000 --- a/phonelibs/capnp-cpp/include/kj/memory.h +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MEMORY_H_ -#define KJ_MEMORY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -// ======================================================================================= -// Disposer -- Implementation details. - -class Disposer { - // Abstract interface for a thing that "disposes" of objects, where "disposing" usually means - // calling the destructor followed by freeing the underlying memory. `Own` encapsulates an - // object pointer with corresponding Disposer. - // - // Few developers will ever touch this interface. It is primarily useful for those implementing - // custom memory allocators. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for each HeapDisposer - // instance. Eww! - - virtual void disposeImpl(void* pointer) const = 0; - // Disposes of the object, given a pointer to the beginning of the object. If the object is - // polymorphic, this pointer is determined by dynamic_cast(). For non-polymorphic types, - // Own does not allow any casting, so the pointer exactly matches the original one given to - // Own. - -public: - - template - void dispose(T* object) const; - // Helper wrapper around disposeImpl(). - // - // If T is polymorphic, calls `disposeImpl(dynamic_cast(object))`, otherwise calls - // `disposeImpl(implicitCast(object))`. - // - // Callers must not call dispose() on the same pointer twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -template -class DestructorOnlyDisposer: public Disposer { - // A disposer that merely calls the type's destructor and nothing else. - -public: - static const DestructorOnlyDisposer instance; - - void disposeImpl(void* pointer) const override { - reinterpret_cast(pointer)->~T(); - } -}; - -template -const DestructorOnlyDisposer DestructorOnlyDisposer::instance = DestructorOnlyDisposer(); - -class NullDisposer: public Disposer { - // A disposer that does nothing. - -public: - static const NullDisposer instance; - - void disposeImpl(void* pointer) const override {} -}; - -// ======================================================================================= -// Own -- An owned pointer. - -template -class Own { - // A transferrable title to a T. When an Own goes out of scope, the object's Disposer is - // called to dispose of it. An Own can be efficiently passed by move, without relocating the - // underlying object; this transfers ownership. - // - // This is much like std::unique_ptr, except: - // - You cannot release(). An owned object is not necessarily allocated with new (see next - // point), so it would be hard to use release() correctly. - // - The deleter is made polymorphic by virtual call rather than by template. This is much - // more powerful -- it allows the use of custom allocators, freelists, etc. This could - // _almost_ be accomplished with unique_ptr by forcing everyone to use something like - // std::unique_ptr, except that things get hairy in the presence of multiple - // inheritance and upcasting, and anyway if you force everyone to use a custom deleter - // then you've lost any benefit to interoperating with the "standard" unique_ptr. - -public: - KJ_DISALLOW_COPY(Own); - inline Own(): disposer(nullptr), ptr(nullptr) {} - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - inline Own(Own>&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - template ()>> - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { - static_assert(__is_polymorphic(T), - "Casting owned pointers requires that the target type is polymorphic."); - other.ptr = nullptr; - } - inline Own(T* ptr, const Disposer& disposer) noexcept: disposer(&disposer), ptr(ptr) {} - - ~Own() noexcept(false) { dispose(); } - - inline Own& operator=(Own&& other) { - // Move-assingnment operator. - - // Careful, this might own `other`. Therefore we have to transfer the pointers first, then - // dispose. - const Disposer* disposerCopy = disposer; - T* ptrCopy = ptr; - disposer = other.disposer; - ptr = other.ptr; - other.ptr = nullptr; - if (ptrCopy != nullptr) { - disposerCopy->dispose(const_cast*>(ptrCopy)); - } - return *this; - } - - inline Own& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - Own downcast() { - // Downcast the pointer to Own, destroying the original pointer. If this pointer does not - // actually point at an instance of U, the results are undefined (throws an exception in debug - // mode if RTTI is enabled, otherwise you're on your own). - - Own result; - if (ptr != nullptr) { - result.ptr = &kj::downcast(*ptr); - result.disposer = disposer; - ptr = nullptr; - } - return result; - } - -#define NULLCHECK KJ_IREQUIRE(ptr != nullptr, "null Own<> dereference") - inline T* operator->() { NULLCHECK; return ptr; } - inline const T* operator->() const { NULLCHECK; return ptr; } - inline T& operator*() { NULLCHECK; return *ptr; } - inline const T& operator*() const { NULLCHECK; return *ptr; } -#undef NULLCHECK - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - const Disposer* disposer; // Only valid if ptr != nullptr. - T* ptr; - - inline explicit Own(decltype(nullptr)): disposer(nullptr), ptr(nullptr) {} - - inline bool operator==(decltype(nullptr)) { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) { return ptr != nullptr; } - // Only called by Maybe>. - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - if (ptrCopy != nullptr) { - ptr = nullptr; - disposer->dispose(const_cast*>(ptrCopy)); - } - } - - template - friend class Own; - friend class Maybe>; -}; - -namespace _ { // private - -template -class OwnOwn { -public: - inline OwnOwn(Own&& value) noexcept: value(kj::mv(value)) {} - - inline Own& operator*() & { return value; } - inline const Own& operator*() const & { return value; } - inline Own&& operator*() && { return kj::mv(value); } - inline const Own&& operator*() const && { return kj::mv(value); } - inline Own* operator->() { return &value; } - inline const Own* operator->() const { return &value; } - inline operator Own*() { return value ? &value : nullptr; } - inline operator const Own*() const { return value ? &value : nullptr; } - -private: - Own value; -}; - -template -OwnOwn readMaybe(Maybe>&& maybe) { return OwnOwn(kj::mv(maybe.ptr)); } -template -Own* readMaybe(Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } -template -const Own* readMaybe(const Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } - -} // namespace _ (private) - -template -class Maybe> { -public: - inline Maybe(): ptr(nullptr) {} - inline Maybe(Own&& t) noexcept: ptr(kj::mv(t)) {} - inline Maybe(Maybe&& other) noexcept: ptr(kj::mv(other.ptr)) {} - - template - inline Maybe(Maybe>&& other): ptr(mv(other.ptr)) {} - template - inline Maybe(Own&& other): ptr(mv(other)) {} - - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline operator Maybe() { return ptr.get(); } - inline operator Maybe() const { return ptr.get(); } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - Own& orDefault(Own& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - const Own& orDefault(const Own& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - - template - auto map(Func&& f) & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - -private: - Own ptr; - - template - friend class Maybe; - template - friend _::OwnOwn _::readMaybe(Maybe>&& maybe); - template - friend Own* _::readMaybe(Maybe>& maybe); - template - friend const Own* _::readMaybe(const Maybe>& maybe); -}; - -namespace _ { // private - -template -class HeapDisposer final: public Disposer { -public: - virtual void disposeImpl(void* pointer) const override { delete reinterpret_cast(pointer); } - - static const HeapDisposer instance; -}; - -template -const HeapDisposer HeapDisposer::instance = HeapDisposer(); - -} // namespace _ (private) - -template -Own heap(Params&&... params) { - // heap(...) allocates a T on the heap, forwarding the parameters to its constructor. The - // exact heap implementation is unspecified -- for now it is operator new, but you should not - // assume this. (Since we know the object size at delete time, we could actually implement an - // allocator that is more efficient than operator new.) - - return Own(new T(kj::fwd(params)...), _::HeapDisposer::instance); -} - -template -Own> heap(T&& orig) { - // Allocate a copy (or move) of the argument on the heap. - // - // The purpose of this overload is to allow you to omit the template parameter as there is only - // one argument and the purpose is to copy it. - - typedef Decay T2; - return Own(new T2(kj::fwd(orig)), _::HeapDisposer::instance); -} - -// ======================================================================================= -// SpaceFor -- assists in manual allocation - -template -class SpaceFor { - // A class which has the same size and alignment as T but does not call its constructor or - // destructor automatically. Instead, call construct() to construct a T in the space, which - // returns an Own which will take care of calling T's destructor later. - -public: - inline SpaceFor() {} - inline ~SpaceFor() {} - - template - Own construct(Params&&... params) { - ctor(value, kj::fwd(params)...); - return Own(&value, DestructorOnlyDisposer::instance); - } - -private: - union { - T value; - }; -}; - -// ======================================================================================= -// Inline implementation details - -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - // Note that dynamic_cast does not require RTTI to be enabled, because the offset to - // the top of the object is in the vtable -- as it obviously needs to be to correctly implement - // operator delete. - disposer.disposeImpl(dynamic_cast(object)); - } -}; -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - disposer.disposeImpl(static_cast(object)); - } -}; - -template -void Disposer::dispose(T* object) const { - Dispose_::dispose(object, *this); -} - -} // namespace kj - -#endif // KJ_MEMORY_H_ diff --git a/phonelibs/capnp-cpp/include/kj/mutex.h b/phonelibs/capnp-cpp/include/kj/mutex.h deleted file mode 100644 index d211ebfeb1..0000000000 --- a/phonelibs/capnp-cpp/include/kj/mutex.h +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MUTEX_H_ -#define KJ_MUTEX_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include - -#if __linux__ && !defined(KJ_USE_FUTEX) -#define KJ_USE_FUTEX 1 -#endif - -#if !KJ_USE_FUTEX && !_WIN32 -// On Linux we use futex. On other platforms we wrap pthreads. -// TODO(someday): Write efficient low-level locking primitives for other platforms. -#include -#endif - -namespace kj { - -// ======================================================================================= -// Private details -- public interfaces follow below. - -namespace _ { // private - -class Mutex { - // Internal implementation details. See `MutexGuarded`. - -public: - Mutex(); - ~Mutex(); - KJ_DISALLOW_COPY(Mutex); - - enum Exclusivity { - EXCLUSIVE, - SHARED - }; - - void lock(Exclusivity exclusivity); - void unlock(Exclusivity exclusivity); - - void assertLockedByCaller(Exclusivity exclusivity); - // In debug mode, assert that the mutex is locked by the calling thread, or if that is - // non-trivial, assert that the mutex is locked (which should be good enough to catch problems - // in unit tests). In non-debug builds, do nothing. - -private: -#if KJ_USE_FUTEX - uint futex; - // bit 31 (msb) = set if exclusive lock held - // bit 30 (msb) = set if threads are waiting for exclusive lock - // bits 0-29 = count of readers; If an exclusive lock is held, this is the count of threads - // waiting for a read lock, otherwise it is the count of threads that currently hold a read - // lock. - - static constexpr uint EXCLUSIVE_HELD = 1u << 31; - static constexpr uint EXCLUSIVE_REQUESTED = 1u << 30; - static constexpr uint SHARED_COUNT_MASK = EXCLUSIVE_REQUESTED - 1; - -#elif _WIN32 - uintptr_t srwLock; // Actually an SRWLOCK, but don't want to #include in header. - -#else - mutable pthread_rwlock_t mutex; -#endif -}; - -class Once { - // Internal implementation details. See `Lazy`. - -public: -#if KJ_USE_FUTEX - inline Once(bool startInitialized = false) - : futex(startInitialized ? INITIALIZED : UNINITIALIZED) {} -#else - Once(bool startInitialized = false); - ~Once(); -#endif - KJ_DISALLOW_COPY(Once); - - class Initializer { - public: - virtual void run() = 0; - }; - - void runOnce(Initializer& init); - -#if _WIN32 // TODO(perf): Can we make this inline on win32 somehow? - bool isInitialized() noexcept; - -#else - inline bool isInitialized() noexcept { - // Fast path check to see if runOnce() would simply return immediately. -#if KJ_USE_FUTEX - return __atomic_load_n(&futex, __ATOMIC_ACQUIRE) == INITIALIZED; -#else - return __atomic_load_n(&state, __ATOMIC_ACQUIRE) == INITIALIZED; -#endif - } -#endif - - void reset(); - // Returns the state from initialized to uninitialized. It is an error to call this when - // not already initialized, or when runOnce() or isInitialized() might be called concurrently in - // another thread. - -private: -#if KJ_USE_FUTEX - uint futex; - - enum State { - UNINITIALIZED, - INITIALIZING, - INITIALIZING_WITH_WAITERS, - INITIALIZED - }; - -#elif _WIN32 - uintptr_t initOnce; // Actually an INIT_ONCE, but don't want to #include in header. - -#else - enum State { - UNINITIALIZED, - INITIALIZED - }; - State state; - pthread_mutex_t mutex; -#endif -}; - -} // namespace _ (private) - -// ======================================================================================= -// Public interface - -template -class Locked { - // Return type for `MutexGuarded::lock()`. `Locked` provides access to the bounded object - // and unlocks the mutex when it goes out of scope. - -public: - KJ_DISALLOW_COPY(Locked); - inline Locked(): mutex(nullptr), ptr(nullptr) {} - inline Locked(Locked&& other): mutex(other.mutex), ptr(other.ptr) { - other.mutex = nullptr; - other.ptr = nullptr; - } - inline ~Locked() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - } - - inline Locked& operator=(Locked&& other) { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = other.mutex; - ptr = other.ptr; - other.mutex = nullptr; - other.ptr = nullptr; - return *this; - } - - inline void release() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = nullptr; - ptr = nullptr; - } - - inline T* operator->() { return ptr; } - inline const T* operator->() const { return ptr; } - inline T& operator*() { return *ptr; } - inline const T& operator*() const { return *ptr; } - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - _::Mutex* mutex; - T* ptr; - - inline Locked(_::Mutex& mutex, T& value): mutex(&mutex), ptr(&value) {} - - template - friend class MutexGuarded; -}; - -template -class MutexGuarded { - // An object of type T, bounded by a mutex. In order to access the object, you must lock it. - // - // Write locks are not "recursive" -- trying to lock again in a thread that already holds a lock - // will deadlock. Recursive write locks are usually a sign of bad design. - // - // Unfortunately, **READ LOCKS ARE NOT RECURSIVE** either. Common sense says they should be. - // But on many operating systems (BSD, OSX), recursively read-locking a pthread_rwlock is - // actually unsafe. The problem is that writers are "prioritized" over readers, so a read lock - // request will block if any write lock requests are outstanding. So, if thread A takes a read - // lock, thread B requests a write lock (and starts waiting), and then thread A tries to take - // another read lock recursively, the result is deadlock. - -public: - template - explicit MutexGuarded(Params&&... params); - // Initialize the mutex-bounded object by passing the given parameters to its constructor. - - Locked lockExclusive() const; - // Exclusively locks the object and returns it. The returned `Locked` can be passed by - // move, similar to `Own`. - // - // This method is declared `const` in accordance with KJ style rules which say that constness - // should be used to indicate thread-safety. It is safe to share a const pointer between threads, - // but it is not safe to share a mutable pointer. Since the whole point of MutexGuarded is to - // be shared between threads, its methods should be const, even though locking it produces a - // non-const pointer to the contained object. - - Locked lockShared() const; - // Lock the value for shared access. Multiple shared locks can be taken concurrently, but cannot - // be held at the same time as a non-shared lock. - - inline const T& getWithoutLock() const { return value; } - inline T& getWithoutLock() { return value; } - // Escape hatch for cases where some external factor guarantees that it's safe to get the - // value. You should treat these like const_cast -- be highly suspicious of any use. - - inline const T& getAlreadyLockedShared() const; - inline T& getAlreadyLockedShared(); - inline T& getAlreadyLockedExclusive() const; - // Like `getWithoutLock()`, but asserts that the lock is already held by the calling thread. - -private: - mutable _::Mutex mutex; - mutable T value; -}; - -template -class MutexGuarded { - // MutexGuarded cannot guard a const type. This would be pointless anyway, and would complicate - // the implementation of Locked, which uses constness to decide what kind of lock it holds. - static_assert(sizeof(T) < 0, "MutexGuarded's type cannot be const."); -}; - -template -class Lazy { - // A lazily-initialized value. - -public: - template - T& get(Func&& init); - template - const T& get(Func&& init) const; - // The first thread to call get() will invoke the given init function to construct the value. - // Other threads will block until construction completes, then return the same value. - // - // `init` is a functor(typically a lambda) which takes `SpaceFor&` as its parameter and returns - // `Own`. If `init` throws an exception, the exception is propagated out of that thread's - // call to `get()`, and subsequent calls behave as if `get()` hadn't been called at all yet -- - // in other words, subsequent calls retry initialization until it succeeds. - -private: - mutable _::Once once; - mutable SpaceFor space; - mutable Own value; - - template - class InitImpl; -}; - -// ======================================================================================= -// Inline implementation details - -template -template -inline MutexGuarded::MutexGuarded(Params&&... params) - : value(kj::fwd(params)...) {} - -template -inline Locked MutexGuarded::lockExclusive() const { - mutex.lock(_::Mutex::EXCLUSIVE); - return Locked(mutex, value); -} - -template -inline Locked MutexGuarded::lockShared() const { - mutex.lock(_::Mutex::SHARED); - return Locked(mutex, value); -} - -template -inline const T& MutexGuarded::getAlreadyLockedShared() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedShared() { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedExclusive() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::EXCLUSIVE); -#endif - return const_cast(value); -} - -template -template -class Lazy::InitImpl: public _::Once::Initializer { -public: - inline InitImpl(const Lazy& lazy, Func&& func): lazy(lazy), func(kj::fwd(func)) {} - - void run() override { - lazy.value = func(lazy.space); - } - -private: - const Lazy& lazy; - Func func; -}; - -template -template -inline T& Lazy::get(Func&& init) { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -template -template -inline const T& Lazy::get(Func&& init) const { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -} // namespace kj - -#endif // KJ_MUTEX_H_ diff --git a/phonelibs/capnp-cpp/include/kj/one-of.h b/phonelibs/capnp-cpp/include/kj/one-of.h deleted file mode 100644 index 6e143c44cf..0000000000 --- a/phonelibs/capnp-cpp/include/kj/one-of.h +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ONE_OF_H_ -#define KJ_ONE_OF_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -namespace _ { // private - -template -struct TypeIndex_ { static constexpr uint value = TypeIndex_::value; }; -template -struct TypeIndex_ { static constexpr uint value = i; }; - -} // namespace _ (private) - -template -class OneOf { - template - static inline constexpr uint typeIndex() { return _::TypeIndex_<1, Key, Variants...>::value; } - // Get the 1-based index of Key within the type list Types. - -public: - inline OneOf(): tag(0) {} - OneOf(const OneOf& other) { copyFrom(other); } - OneOf(OneOf&& other) { moveFrom(other); } - ~OneOf() { destroy(); } - - OneOf& operator=(const OneOf& other) { if (tag != 0) destroy(); copyFrom(other); return *this; } - OneOf& operator=(OneOf&& other) { if (tag != 0) destroy(); moveFrom(other); return *this; } - - inline bool operator==(decltype(nullptr)) const { return tag == 0; } - inline bool operator!=(decltype(nullptr)) const { return tag != 0; } - - template - bool is() const { - return tag == typeIndex(); - } - - template - T& get() { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - template - const T& get() const { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - - template - T& init(Params&&... params) { - if (tag != 0) destroy(); - ctor(*reinterpret_cast(space), kj::fwd(params)...); - tag = typeIndex(); - return *reinterpret_cast(space); - } - -private: - uint tag; - - static inline constexpr size_t maxSize(size_t a) { - return a; - } - template - static inline constexpr size_t maxSize(size_t a, size_t b, Rest... rest) { - return maxSize(kj::max(a, b), rest...); - } - // Returns the maximum of all the parameters. - // TODO(someday): Generalize the above template and make it common. I tried, but C++ decided to - // be difficult so I cut my losses. - - static constexpr auto spaceSize = maxSize(sizeof(Variants)...); - // TODO(msvc): This constant could just as well go directly inside space's bracket's, where it's - // used, but MSVC suffers a parse error on `...`. - - union { - byte space[spaceSize]; - - void* forceAligned; - // TODO(someday): Use C++11 alignas() once we require GCC 4.8 / Clang 3.3. - }; - - template - inline void doAll(T... t) {} - - template - inline bool destroyVariant() { - if (tag == typeIndex()) { - tag = 0; - dtor(*reinterpret_cast(space)); - } - return false; - } - void destroy() { - doAll(destroyVariant()...); - } - - template - inline bool copyVariantFrom(const OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), other.get()); - } - return false; - } - void copyFrom(const OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(copyVariantFrom(other)...); - } - - template - inline bool moveVariantFrom(OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), kj::mv(other.get())); - } - return false; - } - void moveFrom(OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(moveVariantFrom(other)...); - } -}; - -} // namespace kj - -#endif // KJ_ONE_OF_H_ diff --git a/phonelibs/capnp-cpp/include/kj/parse/char.h b/phonelibs/capnp-cpp/include/kj/parse/char.h deleted file mode 100644 index 2e6d51921d..0000000000 --- a/phonelibs/capnp-cpp/include/kj/parse/char.h +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains parsers useful for character stream inputs, including parsers to parse -// common kinds of tokens like identifiers, numbers, and quoted strings. - -#ifndef KJ_PARSE_CHAR_H_ -#define KJ_PARSE_CHAR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "../string.h" -#include - -namespace kj { -namespace parse { - -// ======================================================================================= -// Exact char/string. - -class ExactString_ { -public: - constexpr inline ExactString_(const char* str): str(str) {} - - template - Maybe> operator()(Input& input) const { - const char* ptr = str; - - while (*ptr != '\0') { - if (input.atEnd() || input.current() != *ptr) return nullptr; - input.next(); - ++ptr; - } - - return Tuple<>(); - } - -private: - const char* str; -}; - -constexpr inline ExactString_ exactString(const char* str) { - return ExactString_(str); -} - -template -constexpr ExactlyConst_ exactChar() { - // Returns a parser that matches exactly the character given by the template argument (returning - // no result). - return ExactlyConst_(); -} - -// ======================================================================================= -// Char ranges / sets - -class CharGroup_ { -public: - constexpr inline CharGroup_(): bits{0, 0, 0, 0} {} - - constexpr inline CharGroup_ orRange(unsigned char first, unsigned char last) const { - return CharGroup_(bits[0] | (oneBits(last + 1) & ~oneBits(first )), - bits[1] | (oneBits(last - 63) & ~oneBits(first - 64)), - bits[2] | (oneBits(last - 127) & ~oneBits(first - 128)), - bits[3] | (oneBits(last - 191) & ~oneBits(first - 192))); - } - - constexpr inline CharGroup_ orAny(const char* chars) const { - return *chars == 0 ? *this : orChar(*chars).orAny(chars + 1); - } - - constexpr inline CharGroup_ orChar(unsigned char c) const { - return CharGroup_(bits[0] | bit(c), - bits[1] | bit(c - 64), - bits[2] | bit(c - 128), - bits[3] | bit(c - 256)); - } - - constexpr inline CharGroup_ orGroup(CharGroup_ other) const { - return CharGroup_(bits[0] | other.bits[0], - bits[1] | other.bits[1], - bits[2] | other.bits[2], - bits[3] | other.bits[3]); - } - - constexpr inline CharGroup_ invert() const { - return CharGroup_(~bits[0], ~bits[1], ~bits[2], ~bits[3]); - } - - constexpr inline bool contains(unsigned char c) const { - return (bits[c / 64] & (1ll << (c % 64))) != 0; - } - - template - Maybe operator()(Input& input) const { - if (input.atEnd()) return nullptr; - unsigned char c = input.current(); - if (contains(c)) { - input.next(); - return c; - } else { - return nullptr; - } - } - -private: - typedef unsigned long long Bits64; - - constexpr inline CharGroup_(Bits64 a, Bits64 b, Bits64 c, Bits64 d): bits{a, b, c, d} {} - Bits64 bits[4]; - - static constexpr inline Bits64 oneBits(int count) { - return count <= 0 ? 0ll : count >= 64 ? -1ll : ((1ll << count) - 1); - } - static constexpr inline Bits64 bit(int index) { - return index < 0 ? 0 : index >= 64 ? 0 : (1ll << index); - } -}; - -constexpr inline CharGroup_ charRange(char first, char last) { - // Create a parser which accepts any character in the range from `first` to `last`, inclusive. - // For example: `charRange('a', 'z')` matches all lower-case letters. The parser's result is the - // character matched. - // - // The returned object has methods which can be used to match more characters. The following - // produces a parser which accepts any letter as well as '_', '+', '-', and '.'. - // - // charRange('a', 'z').orRange('A', 'Z').orChar('_').orAny("+-.") - // - // You can also use `.invert()` to match the opposite set of characters. - - return CharGroup_().orRange(first, last); -} - -#if _MSC_VER -#define anyOfChars(chars) CharGroup_().orAny(chars) -// TODO(msvc): MSVC ICEs on the proper definition of `anyOfChars()`, which in turn prevents us from -// building the compiler or schema parser. We don't know why this happens, but Harris found that -// this horrible, horrible hack makes things work. This is awful, but it's better than nothing. -// Hopefully, MSVC will get fixed soon and we'll be able to remove this. -#else -constexpr inline CharGroup_ anyOfChars(const char* chars) { - // Returns a parser that accepts any of the characters in the given string (which should usually - // be a literal). The returned parser is of the same type as returned by `charRange()` -- see - // that function for more info. - - return CharGroup_().orAny(chars); -} -#endif - -// ======================================================================================= - -namespace _ { // private - -struct ArrayToString { - inline String operator()(const Array& arr) const { - return heapString(arr); - } -}; - -} // namespace _ (private) - -template -constexpr inline auto charsToString(SubParser&& subParser) - -> decltype(transform(kj::fwd(subParser), _::ArrayToString())) { - // Wraps a parser that returns Array such that it returns String instead. - return parse::transform(kj::fwd(subParser), _::ArrayToString()); -} - -// ======================================================================================= -// Basic character classes. - -constexpr auto alpha = charRange('a', 'z').orRange('A', 'Z'); -constexpr auto digit = charRange('0', '9'); -constexpr auto alphaNumeric = alpha.orGroup(digit); -constexpr auto nameStart = alpha.orChar('_'); -constexpr auto nameChar = alphaNumeric.orChar('_'); -constexpr auto hexDigit = charRange('0', '9').orRange('a', 'f').orRange('A', 'F'); -constexpr auto octDigit = charRange('0', '7'); -constexpr auto whitespaceChar = anyOfChars(" \f\n\r\t\v"); -constexpr auto controlChar = charRange(0, 0x1f).invert().orGroup(whitespaceChar).invert(); - -constexpr auto whitespace = many(anyOfChars(" \f\n\r\t\v")); - -constexpr auto discardWhitespace = discard(many(discard(anyOfChars(" \f\n\r\t\v")))); -// Like discard(whitespace) but avoids some memory allocation. - -// ======================================================================================= -// Identifiers - -namespace _ { // private - -struct IdentifierToString { - inline String operator()(char first, const Array& rest) const { - String result = heapString(rest.size() + 1); - result[0] = first; - memcpy(result.begin() + 1, rest.begin(), rest.size()); - return result; - } -}; - -} // namespace _ (private) - -constexpr auto identifier = transform(sequence(nameStart, many(nameChar)), _::IdentifierToString()); -// Parses an identifier (e.g. a C variable name). - -// ======================================================================================= -// Integers - -namespace _ { // private - -inline char parseDigit(char c) { - if (c < 'A') return c - '0'; - if (c < 'a') return c - 'A' + 10; - return c - 'a' + 10; -} - -template -struct ParseInteger { - inline uint64_t operator()(const Array& digits) const { - return operator()('0', digits); - } - uint64_t operator()(char first, const Array& digits) const { - uint64_t result = parseDigit(first); - for (char digit: digits) { - result = result * base + parseDigit(digit); - } - return result; - } -}; - - -} // namespace _ (private) - -constexpr auto integer = sequence( - oneOf( - transform(sequence(exactChar<'0'>(), exactChar<'x'>(), oneOrMore(hexDigit)), _::ParseInteger<16>()), - transform(sequence(exactChar<'0'>(), many(octDigit)), _::ParseInteger<8>()), - transform(sequence(charRange('1', '9'), many(digit)), _::ParseInteger<10>())), - notLookingAt(alpha.orAny("_."))); - -// ======================================================================================= -// Numbers (i.e. floats) - -namespace _ { // private - -struct ParseFloat { - double operator()(const Array& digits, - const Maybe>& fraction, - const Maybe, Array>>& exponent) const; -}; - -} // namespace _ (private) - -constexpr auto number = transform( - sequence( - oneOrMore(digit), - optional(sequence(exactChar<'.'>(), many(digit))), - optional(sequence(discard(anyOfChars("eE")), optional(anyOfChars("+-")), many(digit))), - notLookingAt(alpha.orAny("_."))), - _::ParseFloat()); - -// ======================================================================================= -// Quoted strings - -namespace _ { // private - -struct InterpretEscape { - char operator()(char c) const { - switch (c) { - case 'a': return '\a'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'n': return '\n'; - case 'r': return '\r'; - case 't': return '\t'; - case 'v': return '\v'; - default: return c; - } - } -}; - -struct ParseHexEscape { - inline char operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseHexByte { - inline byte operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseOctEscape { - inline char operator()(char first, Maybe second, Maybe third) const { - char result = first - '0'; - KJ_IF_MAYBE(digit1, second) { - result = (result << 3) | (*digit1 - '0'); - KJ_IF_MAYBE(digit2, third) { - result = (result << 3) | (*digit2 - '0'); - } - } - return result; - } -}; - -} // namespace _ (private) - -constexpr auto escapeSequence = - sequence(exactChar<'\\'>(), oneOf( - transform(anyOfChars("abfnrtv'\"\\\?"), _::InterpretEscape()), - transform(sequence(exactChar<'x'>(), hexDigit, hexDigit), _::ParseHexEscape()), - transform(sequence(octDigit, optional(octDigit), optional(octDigit)), - _::ParseOctEscape()))); -// A parser that parses a C-string-style escape sequence (starting with a backslash). Returns -// a char. - -constexpr auto doubleQuotedString = charsToString(sequence( - exactChar<'\"'>(), - many(oneOf(anyOfChars("\\\n\"").invert(), escapeSequence)), - exactChar<'\"'>())); -// Parses a C-style double-quoted string. - -constexpr auto singleQuotedString = charsToString(sequence( - exactChar<'\''>(), - many(oneOf(anyOfChars("\\\n\'").invert(), escapeSequence)), - exactChar<'\''>())); -// Parses a C-style single-quoted string. - -constexpr auto doubleQuotedHexBinary = sequence( - exactChar<'0'>(), exactChar<'x'>(), exactChar<'\"'>(), - oneOrMore(transform(sequence(discardWhitespace, hexDigit, hexDigit), _::ParseHexByte())), - discardWhitespace, - exactChar<'\"'>()); -// Parses a double-quoted hex binary literal. Returns Array. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_CHAR_H_ diff --git a/phonelibs/capnp-cpp/include/kj/parse/common.h b/phonelibs/capnp-cpp/include/kj/parse/common.h deleted file mode 100644 index 3af3a8760d..0000000000 --- a/phonelibs/capnp-cpp/include/kj/parse/common.h +++ /dev/null @@ -1,824 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Parser combinator framework! -// -// This file declares several functions which construct parsers, usually taking other parsers as -// input, thus making them parser combinators. -// -// A valid parser is any functor which takes a reference to an input cursor (defined below) as its -// input and returns a Maybe. The parser returns null on parse failure, or returns the parsed -// result on success. -// -// An "input cursor" is any type which implements the same interface as IteratorInput, below. Such -// a type acts as a pointer to the current input location. When a parser returns successfully, it -// will have updated the input cursor to point to the position just past the end of what was parsed. -// On failure, the cursor position is unspecified. - -#ifndef KJ_PARSE_COMMON_H_ -#define KJ_PARSE_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../common.h" -#include "../memory.h" -#include "../array.h" -#include "../tuple.h" -#include "../vector.h" -#if _MSC_VER -#include // result_of_t -#endif - -namespace kj { -namespace parse { - -template -class IteratorInput { - // A parser input implementation based on an iterator range. - -public: - IteratorInput(Iterator begin, Iterator end) - : parent(nullptr), pos(begin), end(end), best(begin) {} - explicit IteratorInput(IteratorInput& parent) - : parent(&parent), pos(parent.pos), end(parent.end), best(parent.pos) {} - ~IteratorInput() { - if (parent != nullptr) { - parent->best = kj::max(kj::max(pos, best), parent->best); - } - } - KJ_DISALLOW_COPY(IteratorInput); - - void advanceParent() { - parent->pos = pos; - } - void forgetParent() { - parent = nullptr; - } - - bool atEnd() { return pos == end; } - auto current() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos; - } - auto consume() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos++; - } - void next() { - KJ_IREQUIRE(!atEnd()); - ++pos; - } - - Iterator getBest() { return kj::max(pos, best); } - - Iterator getPosition() { return pos; } - -private: - IteratorInput* parent; - Iterator pos; - Iterator end; - Iterator best; // furthest we got with any sub-input -}; - -template struct OutputType_; -template struct OutputType_> { typedef T Type; }; -template -using OutputType = typename OutputType_< -#if _MSC_VER - std::result_of_t - // The instance() based version below results in: - // C2064: term does not evaluate to a function taking 1 arguments -#else - decltype(instance()(instance())) -#endif - >::Type; -// Synonym for the output type of a parser, given the parser type and the input type. - -// ======================================================================================= - -template -class ParserRef { - // Acts as a reference to some other parser, with simplified type. The referenced parser - // is polymorphic by virtual call rather than templates. For grammars of non-trivial size, - // it is important to inject refs into the grammar here and there to prevent the parser types - // from becoming ridiculous. Using too many of them can hurt performance, though. - -public: - ParserRef(): parser(nullptr), wrapper(nullptr) {} - ParserRef(const ParserRef&) = default; - ParserRef(ParserRef&&) = default; - ParserRef& operator=(const ParserRef& other) = default; - ParserRef& operator=(ParserRef&& other) = default; - - template - constexpr ParserRef(Other&& other) - : parser(&other), wrapper(&WrapperImplInstance>::instance) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - } - - template - inline ParserRef& operator=(Other&& other) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - parser = &other; - wrapper = &WrapperImplInstance>::instance; - return *this; - } - - KJ_ALWAYS_INLINE(Maybe operator()(Input& input) const) { - // Always inline in the hopes that this allows branch prediction to kick in so the virtual call - // doesn't hurt so much. - return wrapper->parse(parser, input); - } - -private: - struct Wrapper { - virtual Maybe parse(const void* parser, Input& input) const = 0; - }; - template - struct WrapperImpl: public Wrapper { - Maybe parse(const void* parser, Input& input) const override { - return (*reinterpret_cast(parser))(input); - } - }; - template - struct WrapperImplInstance { -#if _MSC_VER - // TODO(msvc): MSVC currently fails to initialize vtable pointers for constexpr values so - // we have to make this just const instead. - static const WrapperImpl instance; -#else - static constexpr WrapperImpl instance = WrapperImpl(); -#endif - }; - - const void* parser; - const Wrapper* wrapper; -}; - -template -template -#if _MSC_VER -const typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance = WrapperImpl(); -#else -constexpr typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance; -#endif - -template -constexpr ParserRef> ref(ParserImpl& impl) { - // Constructs a ParserRef. You must specify the input type explicitly, e.g. - // `ref(myParser)`. - - return ParserRef>(impl); -} - -// ------------------------------------------------------------------- -// any -// Output = one token - -class Any_ { -public: - template - Maybe().consume())>> operator()(Input& input) const { - if (input.atEnd()) { - return nullptr; - } else { - return input.consume(); - } - } -}; - -constexpr Any_ any = Any_(); -// A parser which matches any token and simply returns it. - -// ------------------------------------------------------------------- -// exactly() -// Output = Tuple<> - -template -class Exactly_ { -public: - explicit constexpr Exactly_(T&& expected): expected(expected) {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } - -private: - T expected; -}; - -template -constexpr Exactly_ exactly(T&& expected) { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. - - return Exactly_(kj::fwd(expected)); -} - -// ------------------------------------------------------------------- -// exactlyConst() -// Output = Tuple<> - -template -class ExactlyConst_ { -public: - explicit constexpr ExactlyConst_() {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } -}; - -template -constexpr ExactlyConst_ exactlyConst() { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. This parser is templated on the token value which may cause - // it to perform better -- or worse. Be sure to measure. - - return ExactlyConst_(); -} - -// ------------------------------------------------------------------- -// constResult() - -template -class ConstResult_ { -public: - explicit constexpr ConstResult_(SubParser&& subParser, Result&& result) - : subParser(kj::fwd(subParser)), result(kj::fwd(result)) {} - - template - Maybe operator()(Input& input) const { - if (subParser(input) == nullptr) { - return nullptr; - } else { - return result; - } - } - -private: - SubParser subParser; - Result result; -}; - -template -constexpr ConstResult_ constResult(SubParser&& subParser, Result&& result) { - // Constructs a parser which returns exactly `result` if `subParser` is successful. - return ConstResult_(kj::fwd(subParser), kj::fwd(result)); -} - -template -constexpr ConstResult_> discard(SubParser&& subParser) { - // Constructs a parser which wraps `subParser` but discards the result. - return constResult(kj::fwd(subParser), Tuple<>()); -} - -// ------------------------------------------------------------------- -// sequence() -// Output = Flattened Tuple of outputs of sub-parsers. - -template class Sequence_; - -template -class Sequence_ { -public: - template - explicit constexpr Sequence_(T&& firstSubParser, U&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - // TODO(msvc): The trailing return types on `operator()` and `parseNext()` expose at least two - // bugs in MSVC: - // - // 1. An ICE. - // 2. 'error C2672: 'operator __surrogate_func': no matching overloaded function found)', - // which crops up in numerous places when trying to build the capnp command line tools. - // - // The only workaround I found for both bugs is to omit the trailing return types and instead - // rely on C++14's return type deduction. - - template - auto operator()(Input& input) const -#ifndef _MSC_VER - -> Maybe>(), - instance>()...))> -#endif - { - return parseNext(input); - } - - template - auto parseNext(Input& input, InitialParams&&... initialParams) const -#ifndef _MSC_VER - -> Maybe(initialParams)..., - instance>(), - instance>()...))> -#endif - { - KJ_IF_MAYBE(firstResult, first(input)) { - return rest.parseNext(input, kj::fwd(initialParams)..., - kj::mv(*firstResult)); - } else { - // TODO(msvc): MSVC depends on return type deduction to compile this function, so we need to - // help it deduce the right type on this code path. - return Maybe(initialParams)..., - instance>(), - instance>()...))>{nullptr}; - } - } - -private: - FirstSubParser first; - Sequence_ rest; -}; - -template <> -class Sequence_<> { -public: - template - Maybe> operator()(Input& input) const { - return parseNext(input); - } - - template - auto parseNext(Input& input, Params&&... params) const -> - Maybe(params)...))> { - return tuple(kj::fwd(params)...); - } -}; - -template -constexpr Sequence_ sequence(SubParsers&&... subParsers) { - // Constructs a parser that executes each of the parameter parsers in sequence and returns a - // tuple of their results. - - return Sequence_(kj::fwd(subParsers)...); -} - -// ------------------------------------------------------------------- -// many() -// Output = Array of output of sub-parser, or just a uint count if the sub-parser returns Tuple<>. - -template -class Many_ { - template > - struct Impl; -public: - explicit constexpr Many_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)); - -private: - SubParser subParser; -}; - -template -template -struct Many_::Impl { - static Maybe> apply(const SubParser& subParser, Input& input) { - typedef Vector> Results; - Results results; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - results.add(kj::mv(*subResult)); - } else { - break; - } - } - - if (atLeastOne && results.empty()) { - return nullptr; - } - - return results.releaseAsArray(); - } -}; - -template -template -struct Many_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe apply(const SubParser& subParser, Input& input) { - uint count = 0; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - ++count; - } else { - break; - } - } - - if (atLeastOne && count == 0) { - return nullptr; - } - - return count; - } -}; - -template -template -auto Many_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)) { - return Impl>::apply(subParser, input); -} - -template -constexpr Many_ many(SubParser&& subParser) { - // Constructs a parser that repeatedly executes the given parser until it fails, returning an - // Array of the results (or a uint count if `subParser` returns an empty tuple). - return Many_(kj::fwd(subParser)); -} - -template -constexpr Many_ oneOrMore(SubParser&& subParser) { - // Like `many()` but the parser must parse at least one item to be successful. - return Many_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// times() -// Output = Array of output of sub-parser, or Tuple<> if sub-parser returns Tuple<>. - -template -class Times_ { - template > - struct Impl; -public: - explicit constexpr Times_(SubParser&& subParser, uint count) - : subParser(kj::fwd(subParser)), count(count) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)); - -private: - SubParser subParser; - uint count; -}; - -template -template -struct Times_::Impl { - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - auto results = heapArrayBuilder>(count); - - while (results.size() < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - results.add(kj::mv(*subResult)); - } else { - return nullptr; - } - } - - return results.finish(); - } -}; - -template -template -struct Times_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - uint actualCount = 0; - - while (actualCount < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - ++actualCount; - } else { - return nullptr; - } - } - - return tuple(); - } -}; - -template -template -auto Times_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)) { - return Impl>::apply(subParser, count, input); -} - -template -constexpr Times_ times(SubParser&& subParser, uint count) { - // Constructs a parser that repeats the subParser exactly `count` times. - return Times_(kj::fwd(subParser), count); -} - -// ------------------------------------------------------------------- -// optional() -// Output = Maybe - -template -class Optional_ { -public: - explicit constexpr Optional_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe>> operator()(Input& input) const { - typedef Maybe> Result; - - Input subInput(input); - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - return Result(kj::mv(*subResult)); - } else { - return Result(nullptr); - } - } - -private: - SubParser subParser; -}; - -template -constexpr Optional_ optional(SubParser&& subParser) { - // Constructs a parser that accepts zero or one of the given sub-parser, returning a Maybe - // of the sub-parser's result. - return Optional_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// oneOf() -// All SubParsers must have same output type, which becomes the output type of the -// OneOfParser. - -template -class OneOf_; - -template -class OneOf_ { -public: - explicit constexpr OneOf_(FirstSubParser&& firstSubParser, SubParsers&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - template - Maybe> operator()(Input& input) const { - { - Input subInput(input); - Maybe> firstResult = first(subInput); - - if (firstResult != nullptr) { - subInput.advanceParent(); - return kj::mv(firstResult); - } - } - - // Hoping for some tail recursion here... - return rest(input); - } - -private: - FirstSubParser first; - OneOf_ rest; -}; - -template <> -class OneOf_<> { -public: - template - decltype(nullptr) operator()(Input& input) const { - return nullptr; - } -}; - -template -constexpr OneOf_ oneOf(SubParsers&&... parsers) { - // Constructs a parser that accepts one of a set of options. The parser behaves as the first - // sub-parser in the list which returns successfully. All of the sub-parsers must return the - // same type. - return OneOf_(kj::fwd(parsers)...); -} - -// ------------------------------------------------------------------- -// transform() -// Output = Result of applying transform functor to input value. If input is a tuple, it is -// unpacked to form the transformation parameters. - -template -struct Span { -public: - inline const Position& begin() const { return begin_; } - inline const Position& end() const { return end_; } - - Span() = default; - inline constexpr Span(Position&& begin, Position&& end): begin_(mv(begin)), end_(mv(end)) {} - -private: - Position begin_; - Position end_; -}; - -template -constexpr Span> span(Position&& start, Position&& end) { - return Span>(kj::fwd(start), kj::fwd(end)); -} - -template -class Transform_ { -public: - explicit constexpr Transform_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance&&>()))> - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformOrReject_ { -public: - explicit constexpr TransformOrReject_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - decltype(kj::apply(instance(), instance&&>())) - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformWithLocation_ { -public: - explicit constexpr TransformWithLocation_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance().getPosition())>>>(), - instance&&>()))> - operator()(Input& input) const { - auto start = input.getPosition(); - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, Span(kj::mv(start), input.getPosition()), - kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -constexpr Transform_ transform( - SubParser&& subParser, TransformFunc&& functor) { - // Constructs a parser which executes some other parser and then transforms the result by invoking - // `functor` on it. Typically `functor` is a lambda. It is invoked using `kj::apply`, - // meaning tuples will be unpacked as arguments. - return Transform_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformOrReject_ transformOrReject( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform()` except that `functor` returns a `Maybe`. If it returns null, parsing fails, - // otherwise the parser's result is the content of the `Maybe`. - return TransformOrReject_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformWithLocation_ transformWithLocation( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform` except that `functor` also takes a `Span` as its first parameter specifying - // the location of the parsed content. The span's position type is whatever the parser input's - // getPosition() returns. - return TransformWithLocation_( - kj::fwd(subParser), kj::fwd(functor)); -} - -// ------------------------------------------------------------------- -// notLookingAt() -// Fails if the given parser succeeds at the current location. - -template -class NotLookingAt_ { -public: - explicit constexpr NotLookingAt_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe> operator()(Input& input) const { - Input subInput(input); - subInput.forgetParent(); - if (subParser(subInput) == nullptr) { - return Tuple<>(); - } else { - return nullptr; - } - } - -private: - SubParser subParser; -}; - -template -constexpr NotLookingAt_ notLookingAt(SubParser&& subParser) { - // Constructs a parser which fails at any position where the given parser succeeds. Otherwise, - // it succeeds without consuming any input and returns an empty tuple. - return NotLookingAt_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// endOfInput() -// Output = Tuple<>, only succeeds if at end-of-input - -class EndOfInput_ { -public: - template - Maybe> operator()(Input& input) const { - if (input.atEnd()) { - return Tuple<>(); - } else { - return nullptr; - } - } -}; - -constexpr EndOfInput_ endOfInput = EndOfInput_(); -// A parser that succeeds only if it is called with no input. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_COMMON_H_ diff --git a/phonelibs/capnp-cpp/include/kj/refcount.h b/phonelibs/capnp-cpp/include/kj/refcount.h deleted file mode 100644 index a24e4bf5b9..0000000000 --- a/phonelibs/capnp-cpp/include/kj/refcount.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include "memory.h" - -#ifndef KJ_REFCOUNT_H_ -#define KJ_REFCOUNT_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { - -class Refcounted: private Disposer { - // Subclass this to create a class that contains a reference count. Then, use - // `kj::refcounted()` to allocate a new refcounted pointer. - // - // Do NOT use this lightly. Refcounting is a crutch. Good designs should strive to make object - // ownership clear, so that refcounting is not necessary. All that said, reference counting can - // sometimes simplify code that would otherwise become convoluted with explicit ownership, even - // when ownership relationships are clear at an abstract level. - // - // NOT THREADSAFE: This refcounting implementation assumes that an object's references are - // manipulated only in one thread, because atomic (thread-safe) refcounting is surprisingly slow. - // - // In general, abstract classes should _not_ subclass this. The concrete class at the bottom - // of the hierarchy should be the one to decide how it implements refcounting. Interfaces should - // expose only an `addRef()` method that returns `Own`. There are two reasons for - // this rule: - // 1. Interfaces would need to virtually inherit Refcounted, otherwise two refcounted interfaces - // could not be inherited by the same subclass. Virtual inheritance is awkward and - // inefficient. - // 2. An implementation may decide that it would rather return a copy than a refcount, or use - // some other strategy. - // - // TODO(cleanup): Rethink above. Virtual inheritance is not necessarily that bad. OTOH, a - // virtual function call for every refcount is sad in its own way. A Ref type to replace - // Own could also be nice. - -public: - virtual ~Refcounted() noexcept(false); - - inline bool isShared() const { return refcount > 1; } - // Check if there are multiple references to this object. This is sometimes useful for deciding - // whether it's safe to modify the object vs. make a copy. - -private: - mutable uint refcount = 0; - // "mutable" because disposeImpl() is const. Bleh. - - void disposeImpl(void* pointer) const override; - template - static Own addRefInternal(T* object); - - template - friend Own addRef(T& object); - template - friend Own refcounted(Params&&... params); -}; - -template -inline Own refcounted(Params&&... params) { - // Allocate a new refcounted instance of T, passing `params` to its constructor. Returns an - // initial reference to the object. More references can be created with `kj::addRef()`. - - return Refcounted::addRefInternal(new T(kj::fwd(params)...)); -} - -template -Own addRef(T& object) { - // Return a new reference to `object`, which must subclass Refcounted and have been allocated - // using `kj::refcounted<>()`. It is suggested that subclasses implement a non-static addRef() - // method which wraps this and returns the appropriate type. - - KJ_IREQUIRE(object.Refcounted::refcount > 0, "Object not allocated with kj::refcounted()."); - return Refcounted::addRefInternal(&object); -} - -template -Own Refcounted::addRefInternal(T* object) { - Refcounted* refcounted = object; - ++refcounted->refcount; - return Own(object, *refcounted); -} - -} // namespace kj - -#endif // KJ_REFCOUNT_H_ diff --git a/phonelibs/capnp-cpp/include/kj/std/iostream.h b/phonelibs/capnp-cpp/include/kj/std/iostream.h deleted file mode 100644 index 627e0fcf86..0000000000 --- a/phonelibs/capnp-cpp/include/kj/std/iostream.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/* - * Compatibility layer for stdlib iostream - */ - -#ifndef KJ_STD_IOSTREAM_H_ -#define KJ_STD_IOSTREAM_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../io.h" -#include - -namespace kj { -namespace std { - -class StdOutputStream: public kj::OutputStream { - -public: - explicit StdOutputStream(::std::ostream& stream) : stream_(stream) {} - ~StdOutputStream() noexcept(false) {} - - virtual void write(const void* src, size_t size) override { - // Always writes the full size. - - stream_.write((char*)src, size); - } - - virtual void write(ArrayPtr> pieces) override { - // Equivalent to write()ing each byte array in sequence, which is what the - // default implementation does. Override if you can do something better, - // e.g. use writev() to do the write in a single syscall. - - for (auto piece : pieces) { - write(piece.begin(), piece.size()); - } - } - -private: - ::std::ostream& stream_; - -}; - -class StdInputStream: public kj::InputStream { - -public: - explicit StdInputStream(::std::istream& stream) : stream_(stream) {} - ~StdInputStream() noexcept(false) {} - - virtual size_t tryRead( - void* buffer, size_t minBytes, size_t maxBytes) override { - // Like read(), but may return fewer than minBytes on EOF. - - stream_.read((char*)buffer, maxBytes); - return stream_.gcount(); - } - -private: - ::std::istream& stream_; - -}; - -} // namespace std -} // namespace kj - -#endif // KJ_STD_IOSTREAM_H_ diff --git a/phonelibs/capnp-cpp/include/kj/string-tree.h b/phonelibs/capnp-cpp/include/kj/string-tree.h deleted file mode 100644 index 70a46319ef..0000000000 --- a/phonelibs/capnp-cpp/include/kj/string-tree.h +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_TREE_H_ -#define KJ_STRING_TREE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" - -namespace kj { - -class StringTree { - // A long string, represented internally as a tree of strings. This data structure is like a - // String, but optimized for concatenation and iteration at the expense of seek time. The - // structure is intended to be used for building large text blobs from many small pieces, where - // repeatedly concatenating smaller strings into larger ones would waste copies. This structure - // is NOT intended for use cases requiring random access or computing substrings. For those, - // you should use a Rope, which is a much more complicated data structure. - // - // The proper way to construct a StringTree is via kj::strTree(...), which works just like - // kj::str(...) but returns a StringTree rather than a String. - // - // KJ_STRINGIFY() functions that construct large strings from many smaller strings are encouraged - // to return StringTree rather than a flat char container. - -public: - inline StringTree(): size_(0) {} - inline StringTree(String&& text): size_(text.size()), text(kj::mv(text)) {} - - StringTree(Array&& pieces, StringPtr delim); - // Build a StringTree by concatenating the given pieces, delimited by the given delimiter - // (e.g. ", "). - - inline size_t size() const { return size_; } - - template - void visit(Func&& func) const; - - String flatten() const; - // Return the contents as a string. - - // TODO(someday): flatten() when *this is an rvalue and when branches.size() == 0 could simply - // return `kj::mv(text)`. Requires reference qualifiers (Clang 3.3 / GCC 4.8). - - void flattenTo(char* __restrict__ target) const; - // Copy the contents to the given character array. Does not add a NUL terminator. - -private: - size_t size_; - String text; - - struct Branch; - Array branches; // In order. - - inline void fill(char* pos, size_t branchIndex); - template - void fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, Array&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest); - - template - static StringTree concat(Params&&... params); - static StringTree&& concat(StringTree&& param) { return kj::mv(param); } - - template - static inline size_t flatSize(const T& t) { return t.size(); } - static inline size_t flatSize(String&& s) { return 0; } - static inline size_t flatSize(StringTree&& s) { return 0; } - - template - static inline size_t branchCount(const T& t) { return 0; } - static inline size_t branchCount(String&& s) { return 1; } - static inline size_t branchCount(StringTree&& s) { return 1; } - - template - friend StringTree strTree(Params&&... params); -}; - -inline StringTree&& KJ_STRINGIFY(StringTree&& tree) { return kj::mv(tree); } -inline const StringTree& KJ_STRINGIFY(const StringTree& tree) { return tree; } - -inline StringTree KJ_STRINGIFY(Array&& trees) { return StringTree(kj::mv(trees), ""); } - -template -StringTree strTree(Params&&... params); -// Build a StringTree by stringifying the given parameters and concatenating the results. -// If any of the parameters stringify to StringTree rvalues, they will be incorporated as -// branches to avoid a copy. - -// ======================================================================================= -// Inline implementation details - -namespace _ { // private - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest) { - // Make str() work with stringifiers that return StringTree by patching fill(). - - first.flattenTo(target); - return fill(target + first.size(), kj::fwd(rest)...); -} - -template constexpr bool isStringTree() { return false; } -template <> constexpr bool isStringTree() { return true; } - -inline StringTree&& toStringTreeOrCharSequence(StringTree&& tree) { return kj::mv(tree); } -inline StringTree toStringTreeOrCharSequence(String&& str) { return StringTree(kj::mv(str)); } - -template -inline auto toStringTreeOrCharSequence(T&& value) - -> decltype(toCharSequence(kj::fwd(value))) { - static_assert(!isStringTree>(), - "When passing a StringTree into kj::strTree(), either pass it by rvalue " - "(use kj::mv(value)) or explicitly call value.flatten() to make a copy."); - - return toCharSequence(kj::fwd(value)); -} - -} // namespace _ (private) - -struct StringTree::Branch { - size_t index; - // Index in `text` where this branch should be inserted. - - StringTree content; -}; - -template -void StringTree::visit(Func&& func) const { - size_t pos = 0; - for (auto& branch: branches) { - if (branch.index > pos) { - func(text.slice(pos, branch.index)); - pos = branch.index; - } - branch.content.visit(func); - } - if (text.size() > pos) { - func(text.slice(pos, text.size())); - } -} - -inline void StringTree::fill(char* pos, size_t branchIndex) { - KJ_IREQUIRE(pos == text.end() && branchIndex == branches.size(), - kj::str(text.end() - pos, ' ', branches.size() - branchIndex).cStr()); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest) { - pos = _::fill(pos, kj::fwd(first)); - fill(pos, branchIndex, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = kj::mv(first); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = StringTree(kj::mv(first)); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -StringTree StringTree::concat(Params&&... params) { - StringTree result; - result.size_ = _::sum({params.size()...}); - result.text = heapString( - _::sum({StringTree::flatSize(kj::fwd(params))...})); - result.branches = heapArray( - _::sum({StringTree::branchCount(kj::fwd(params))...})); - result.fill(result.text.begin(), 0, kj::fwd(params)...); - return result; -} - -template -StringTree strTree(Params&&... params) { - return StringTree::concat(_::toStringTreeOrCharSequence(kj::fwd(params))...); -} - -} // namespace kj - -#endif // KJ_STRING_TREE_H_ diff --git a/phonelibs/capnp-cpp/include/kj/string.h b/phonelibs/capnp-cpp/include/kj/string.h deleted file mode 100644 index 9048be2417..0000000000 --- a/phonelibs/capnp-cpp/include/kj/string.h +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_H_ -#define KJ_STRING_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "array.h" -#include - -namespace kj { - -class StringPtr; -class String; - -class StringTree; // string-tree.h - -// Our STL string SFINAE trick does not work with GCC 4.7, but it works with Clang and GCC 4.8, so -// we'll just preprocess it out if not supported. -#if __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || _MSC_VER -#define KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP 1 -#endif - -// ======================================================================================= -// StringPtr -- A NUL-terminated ArrayPtr containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. - -class StringPtr { -public: - inline StringPtr(): content("", 1) {} - inline StringPtr(decltype(nullptr)): content("", 1) {} - inline StringPtr(const char* value): content(value, strlen(value) + 1) {} - inline StringPtr(const char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - inline StringPtr(const char* begin, const char* end): StringPtr(begin, end - begin) {} - inline StringPtr(const String& value); - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline StringPtr(const T& t): StringPtr(t.c_str()) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. - - template ().c_str())> - inline operator T() const { return cStr(); } - // Allow implicit conversion to any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif - - inline operator ArrayPtr() const; - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const; - inline bool operator!=(const StringPtr& other) const { return !(*this == other); } - inline bool operator< (const StringPtr& other) const; - inline bool operator> (const StringPtr& other) const { return other < *this; } - inline bool operator<=(const StringPtr& other) const { return !(other < *this); } - inline bool operator>=(const StringPtr& other) const { return !(*this < other); } - - inline StringPtr slice(size_t start) const; - inline ArrayPtr slice(size_t start, size_t end) const; - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - - inline bool startsWith(const StringPtr& other) const; - inline bool endsWith(const StringPtr& other) const; - - inline Maybe findFirst(char c) const; - inline Maybe findLast(char c) const; - - template - T parseAs() const; - // Parse string as template number type. - // Integer numbers prefixed by "0x" and "0X" are parsed in base 16 (like strtoi with base 0). - // Integer numbers prefixed by "0" are parsed in base 10 (unlike strtoi with base 0). - // Overflowed integer numbers throw exception. - // Overflowed floating numbers return inf. - -private: - inline StringPtr(ArrayPtr content): content(content) {} - - ArrayPtr content; -}; - -inline bool operator==(const char* a, const StringPtr& b) { return b == a; } -inline bool operator!=(const char* a, const StringPtr& b) { return b != a; } - -template <> char StringPtr::parseAs() const; -template <> signed char StringPtr::parseAs() const; -template <> unsigned char StringPtr::parseAs() const; -template <> short StringPtr::parseAs() const; -template <> unsigned short StringPtr::parseAs() const; -template <> int StringPtr::parseAs() const; -template <> unsigned StringPtr::parseAs() const; -template <> long StringPtr::parseAs() const; -template <> unsigned long StringPtr::parseAs() const; -template <> long long StringPtr::parseAs() const; -template <> unsigned long long StringPtr::parseAs() const; -template <> float StringPtr::parseAs() const; -template <> double StringPtr::parseAs() const; - -// ======================================================================================= -// String -- A NUL-terminated Array containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. -// -// To allocate a String, you must call kj::heapString(). We do not implement implicit copying to -// the heap because this hides potential inefficiency from the developer. - -class String { -public: - String() = default; - inline String(decltype(nullptr)): content(nullptr) {} - inline String(char* value, size_t size, const ArrayDisposer& disposer); - // Does not copy. `size` does not include NUL terminator, but `value` must be NUL-terminated. - inline explicit String(Array buffer); - // Does not copy. Requires `buffer` ends with `\0`. - - inline operator ArrayPtr(); - inline operator ArrayPtr() const; - inline ArrayPtr asArray(); - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() { return asArray().asBytes(); } - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline Array releaseArray() { return kj::mv(content); } - // Disowns the backing array (which includes the NUL terminator) and returns it. The String value - // is clobbered (as if moved away). - - inline const char* cStr() const; - - inline size_t size() const; - // Result does not include NUL terminator. - - inline char operator[](size_t index) const; - inline char& operator[](size_t index); - - inline char* begin(); - inline char* end(); - inline const char* begin() const; - inline const char* end() const; - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const { return StringPtr(*this) == other; } - inline bool operator!=(const StringPtr& other) const { return StringPtr(*this) != other; } - inline bool operator< (const StringPtr& other) const { return StringPtr(*this) < other; } - inline bool operator> (const StringPtr& other) const { return StringPtr(*this) > other; } - inline bool operator<=(const StringPtr& other) const { return StringPtr(*this) <= other; } - inline bool operator>=(const StringPtr& other) const { return StringPtr(*this) >= other; } - - inline bool startsWith(const StringPtr& other) const { return StringPtr(*this).startsWith(other);} - inline bool endsWith(const StringPtr& other) const { return StringPtr(*this).endsWith(other); } - - inline StringPtr slice(size_t start) const { return StringPtr(*this).slice(start); } - inline ArrayPtr slice(size_t start, size_t end) const { - return StringPtr(*this).slice(start, end); - } - - inline Maybe findFirst(char c) const { return StringPtr(*this).findFirst(c); } - inline Maybe findLast(char c) const { return StringPtr(*this).findLast(c); } - - template - T parseAs() const { return StringPtr(*this).parseAs(); } - // Parse as number - -private: - Array content; -}; - -inline bool operator==(const char* a, const String& b) { return b == a; } -inline bool operator!=(const char* a, const String& b) { return b != a; } - -String heapString(size_t size); -// Allocate a String of the given size on the heap, not including NUL terminator. The NUL -// terminator will be initialized automatically but the rest of the content is not initialized. - -String heapString(const char* value); -String heapString(const char* value, size_t size); -String heapString(StringPtr value); -String heapString(const String& value); -String heapString(ArrayPtr value); -// Allocates a copy of the given value on the heap. - -// ======================================================================================= -// Magic str() function which transforms parameters to text and concatenates them into one big -// String. - -namespace _ { // private - -inline size_t sum(std::initializer_list nums) { - size_t result = 0; - for (auto num: nums) { - result += num; - } - return result; -} - -inline char* fill(char* ptr) { return ptr; } - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest); -// Make str() work with stringifiers that return StringTree by patching fill(). -// -// Defined in string-tree.h. - -template -char* fill(char* __restrict__ target, const First& first, Rest&&... rest) { - auto i = first.begin(); - auto end = first.end(); - while (i != end) { - *target++ = *i++; - } - return fill(target, kj::fwd(rest)...); -} - -template -String concat(Params&&... params) { - // Concatenate a bunch of containers into a single Array. The containers can be anything that - // is iterable and whose elements can be converted to `char`. - - String result = heapString(sum({params.size()...})); - fill(result.begin(), kj::fwd(params)...); - return result; -} - -inline String concat(String&& arr) { - return kj::mv(arr); -} - -struct Stringifier { - // This is a dummy type with only one instance: STR (below). To make an arbitrary type - // stringifiable, define `operator*(Stringifier, T)` to return an iterable container of `char`. - // The container type must have a `size()` method. Be sure to declare the operator in the same - // namespace as `T` **or** in the global scope. - // - // A more usual way to accomplish what we're doing here would be to require that you define - // a function like `toString(T)` and then rely on argument-dependent lookup. However, this has - // the problem that it pollutes other people's namespaces and even the global namespace. For - // example, some other project may already have functions called `toString` which do something - // different. Declaring `operator*` with `Stringifier` as the left operand cannot conflict with - // anything. - - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - template - inline ArrayPtr operator*(const CappedArray& s) const { return s; } - template - inline ArrayPtr operator*(const FixedArray& s) const { return s; } - inline ArrayPtr operator*(const char* s) const { return arrayPtr(s, strlen(s)); } - inline ArrayPtr operator*(const String& s) const { return s.asArray(); } - inline ArrayPtr operator*(const StringPtr& s) const { return s.asArray(); } - - inline Range operator*(const Range& r) const { return r; } - inline Repeat operator*(const Repeat& r) const { return r; } - - inline FixedArray operator*(char c) const { - FixedArray result; - result[0] = c; - return result; - } - - StringPtr operator*(decltype(nullptr)) const; - StringPtr operator*(bool b) const; - - CappedArray operator*(signed char i) const; - CappedArray operator*(unsigned char i) const; - CappedArray operator*(short i) const; - CappedArray operator*(unsigned short i) const; - CappedArray operator*(int i) const; - CappedArray operator*(unsigned int i) const; - CappedArray operator*(long i) const; - CappedArray operator*(unsigned long i) const; - CappedArray operator*(long long i) const; - CappedArray operator*(unsigned long long i) const; - CappedArray operator*(float f) const; - CappedArray operator*(double f) const; - CappedArray operator*(const void* s) const; - - template - String operator*(ArrayPtr arr) const; - template - String operator*(const Array& arr) const; - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP // supports expression SFINAE? - template ().toString())> - inline Result operator*(T&& value) const { return kj::fwd(value).toString(); } -#endif -}; -static KJ_CONSTEXPR(const) Stringifier STR = Stringifier(); - -} // namespace _ (private) - -template -auto toCharSequence(T&& value) -> decltype(_::STR * kj::fwd(value)) { - // Returns an iterable of chars that represent a textual representation of the value, suitable - // for debugging. - // - // Most users should use str() instead, but toCharSequence() may occasionally be useful to avoid - // heap allocation overhead that str() implies. - // - // To specialize this function for your type, see KJ_STRINGIFY. - - return _::STR * kj::fwd(value); -} - -CappedArray hex(unsigned char i); -CappedArray hex(unsigned short i); -CappedArray hex(unsigned int i); -CappedArray hex(unsigned long i); -CappedArray hex(unsigned long long i); - -template -String str(Params&&... params) { - // Magic function which builds a string from a bunch of arbitrary values. Example: - // str(1, " / ", 2, " = ", 0.5) - // returns: - // "1 / 2 = 0.5" - // To teach `str` how to stringify a type, see `Stringifier`. - - return _::concat(toCharSequence(kj::fwd(params))...); -} - -inline String str(String&& s) { return mv(s); } -// Overload to prevent redundant allocation. - -template -String strArray(T&& arr, const char* delim) { - size_t delimLen = strlen(delim); - KJ_STACK_ARRAY(decltype(_::STR * arr[0]), pieces, kj::size(arr), 8, 32); - size_t size = 0; - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) size += delimLen; - pieces[i] = _::STR * arr[i]; - size += pieces[i].size(); - } - - String result = heapString(size); - char* pos = result.begin(); - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) { - memcpy(pos, delim, delimLen); - pos += delimLen; - } - pos = _::fill(pos, pieces[i]); - } - return result; -} - -namespace _ { // private - -template -inline String Stringifier::operator*(ArrayPtr arr) const { - return strArray(arr, ", "); -} - -template -inline String Stringifier::operator*(const Array& arr) const { - return strArray(arr, ", "); -} - -} // namespace _ (private) - -#define KJ_STRINGIFY(...) operator*(::kj::_::Stringifier, __VA_ARGS__) -// Defines a stringifier for a custom type. Example: -// -// class Foo {...}; -// inline StringPtr KJ_STRINGIFY(const Foo& foo) { return foo.name(); } -// -// This allows Foo to be passed to str(). -// -// The function should be declared either in the same namespace as the target type or in the global -// namespace. It can return any type which is an iterable container of chars. - -// ======================================================================================= -// Inline implementation details. - -inline StringPtr::StringPtr(const String& value): content(value.begin(), value.size() + 1) {} - -inline StringPtr::operator ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline ArrayPtr StringPtr::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline bool StringPtr::operator==(const StringPtr& other) const { - return content.size() == other.content.size() && - memcmp(content.begin(), other.content.begin(), content.size() - 1) == 0; -} - -inline bool StringPtr::operator<(const StringPtr& other) const { - bool shorter = content.size() < other.content.size(); - int cmp = memcmp(content.begin(), other.content.begin(), - shorter ? content.size() : other.content.size()); - return cmp < 0 || (cmp == 0 && shorter); -} - -inline StringPtr StringPtr::slice(size_t start) const { - return StringPtr(content.slice(start, content.size())); -} -inline ArrayPtr StringPtr::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline bool StringPtr::startsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(content.begin(), other.content.begin(), other.size()) == 0; -} -inline bool StringPtr::endsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(end() - other.size(), other.content.begin(), other.size()) == 0; -} - -inline Maybe StringPtr::findFirst(char c) const { - const char* pos = reinterpret_cast(memchr(content.begin(), c, size())); - if (pos == nullptr) { - return nullptr; - } else { - return pos - content.begin(); - } -} - -inline Maybe StringPtr::findLast(char c) const { - for (size_t i = size(); i > 0; --i) { - if (content[i-1] == c) { - return i-1; - } - } - return nullptr; -} - -inline String::operator ArrayPtr() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline String::operator ArrayPtr() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline ArrayPtr String::asArray() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline ArrayPtr String::asArray() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline const char* String::cStr() const { return content == nullptr ? "" : content.begin(); } - -inline size_t String::size() const { return content == nullptr ? 0 : content.size() - 1; } - -inline char String::operator[](size_t index) const { return content[index]; } -inline char& String::operator[](size_t index) { return content[index]; } - -inline char* String::begin() { return content == nullptr ? nullptr : content.begin(); } -inline char* String::end() { return content == nullptr ? nullptr : content.end() - 1; } -inline const char* String::begin() const { return content == nullptr ? nullptr : content.begin(); } -inline const char* String::end() const { return content == nullptr ? nullptr : content.end() - 1; } - -inline String::String(char* value, size_t size, const ArrayDisposer& disposer) - : content(value, size + 1, disposer) { - KJ_IREQUIRE(value[size] == '\0', "String must be NUL-terminated."); -} - -inline String::String(Array buffer): content(kj::mv(buffer)) { - KJ_IREQUIRE(content.size() > 0 && content.back() == '\0', "String must be NUL-terminated."); -} - -inline String heapString(const char* value) { - return heapString(value, strlen(value)); -} -inline String heapString(StringPtr value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(const String& value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(ArrayPtr value) { - return heapString(value.begin(), value.size()); -} - -} // namespace kj - -#endif // KJ_STRING_H_ diff --git a/phonelibs/capnp-cpp/include/kj/test.h b/phonelibs/capnp-cpp/include/kj/test.h deleted file mode 100644 index 69e1c80840..0000000000 --- a/phonelibs/capnp-cpp/include/kj/test.h +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TEST_H_ -#define KJ_TEST_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "debug.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class TestRunner; - -class TestCase { -public: - TestCase(const char* file, uint line, const char* description); - ~TestCase(); - - virtual void run() = 0; - -private: - const char* file; - uint line; - const char* description; - TestCase* next; - TestCase** prev; - bool matchedFilter; - - friend class TestRunner; -}; - -#define KJ_TEST(description) \ - /* Make sure the linker fails if tests are not in anonymous namespaces. */ \ - extern int KJ_CONCAT(YouMustWrapTestsInAnonymousNamespace, __COUNTER__) KJ_UNUSED; \ - class KJ_UNIQUE_NAME(TestCase): public ::kj::TestCase { \ - public: \ - KJ_UNIQUE_NAME(TestCase)(): ::kj::TestCase(__FILE__, __LINE__, description) {} \ - void run() override; \ - } KJ_UNIQUE_NAME(testCase); \ - void KJ_UNIQUE_NAME(TestCase)::run() - -#if _MSC_VER -#define KJ_INDIRECT_EXPAND(m, vargs) m vargs -#define KJ_FAIL_EXPECT(...) \ - KJ_INDIRECT_EXPAND(KJ_LOG, (ERROR , __VA_ARGS__)); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_INDIRECT_EXPAND(KJ_FAIL_EXPECT, ("failed: expected " #cond , __VA_ARGS__)) -#else -#define KJ_FAIL_EXPECT(...) \ - KJ_LOG(ERROR, ##__VA_ARGS__); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_FAIL_EXPECT("failed: expected " #cond, ##__VA_ARGS__) -#endif - -#define KJ_EXPECT_THROW_RECOVERABLE(type, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(e->getType() == ::kj::Exception::Type::type, \ - "code threw wrong exception type: " #code, e->getType()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#define KJ_EXPECT_THROW_RECOVERABLE_MESSAGE(message, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(::kj::_::hasSubstring(e->getDescription(), message), \ - "exception description didn't contain expected substring", e->getDescription()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#if KJ_NO_EXCEPTIONS -#define KJ_EXPECT_THROW(type, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(type, nullptr, [&]() { code; })); \ - } while (false) -#define KJ_EXPECT_THROW_MESSAGE(message, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, kj::StringPtr(message), [&]() { code; })); \ - } while (false) -#else -#define KJ_EXPECT_THROW KJ_EXPECT_THROW_RECOVERABLE -#define KJ_EXPECT_THROW_MESSAGE KJ_EXPECT_THROW_RECOVERABLE_MESSAGE -#endif - -#define KJ_EXPECT_LOG(level, substring) \ - ::kj::_::LogExpectation KJ_UNIQUE_NAME(_kjLogExpectation)(::kj::LogSeverity::level, substring) -// Expects that a log message with the given level and substring text will be printed within -// the current scope. This message will not cause the test to fail, even if it is an error. - -// ======================================================================================= - -namespace _ { // private - -bool hasSubstring(kj::StringPtr haystack, kj::StringPtr needle); - -#if KJ_NO_EXCEPTIONS -bool expectFatalThrow(Maybe type, Maybe message, - Function code); -// Expects that the given code will throw a fatal exception matching the given type and/or message. -// Since exceptions are disabled, the test will fork() and run in a subprocess. On Windows, where -// fork() is not available, this always returns true. -#endif - -class LogExpectation: public ExceptionCallback { -public: - LogExpectation(LogSeverity severity, StringPtr substring); - ~LogExpectation(); - - void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - -private: - LogSeverity severity; - StringPtr substring; - bool seen; - UnwindDetector unwindDetector; -}; - -class GlobFilter { - // Implements glob filters for the --filter flag. - // - // Exposed in header only for testing. - -public: - explicit GlobFilter(const char* pattern); - explicit GlobFilter(ArrayPtr pattern); - - bool matches(StringPtr name); - -private: - String pattern; - Vector states; - - void applyState(char c, int state); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_TEST_H_ diff --git a/phonelibs/capnp-cpp/include/kj/thread.h b/phonelibs/capnp-cpp/include/kj/thread.h deleted file mode 100644 index b17b88c520..0000000000 --- a/phonelibs/capnp-cpp/include/kj/thread.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREAD_H_ -#define KJ_THREAD_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "function.h" -#include "exception.h" - -namespace kj { - -class Thread { - // A thread! Pass a lambda to the constructor, and it runs in the thread. The destructor joins - // the thread. If the function throws an exception, it is rethrown from the thread's destructor - // (if not unwinding from another exception). - -public: - explicit Thread(Function func); - KJ_DISALLOW_COPY(Thread); - - ~Thread() noexcept(false); - -#if !_WIN32 - void sendSignal(int signo); - // Send a Unix signal to the given thread, using pthread_kill or an equivalent. -#endif - - void detach(); - // Don't join the thread in ~Thread(). - -private: - struct ThreadState { - Function func; - kj::Maybe exception; - - unsigned int refcount; - // Owned by the parent thread and the child thread. - - void unref(); - }; - ThreadState* state; - -#if _WIN32 - void* threadHandle; -#else - unsigned long long threadId; // actually pthread_t -#endif - bool detached = false; - -#if _WIN32 - static unsigned long __stdcall runThread(void* ptr); -#else - static void* runThread(void* ptr); -#endif -}; - -} // namespace kj - -#endif // KJ_THREAD_H_ diff --git a/phonelibs/capnp-cpp/include/kj/threadlocal.h b/phonelibs/capnp-cpp/include/kj/threadlocal.h deleted file mode 100644 index 67d0db60ef..0000000000 --- a/phonelibs/capnp-cpp/include/kj/threadlocal.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014, Jason Choy -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREADLOCAL_H_ -#define KJ_THREADLOCAL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif -// This file declares a macro `KJ_THREADLOCAL_PTR` for declaring thread-local pointer-typed -// variables. Use like: -// KJ_THREADLOCAL_PTR(MyType) foo = nullptr; -// This is equivalent to: -// thread_local MyType* foo = nullptr; -// This can only be used at the global scope. -// -// AVOID USING THIS. Use of thread-locals is discouraged because they often have many of the same -// properties as singletons: http://www.object-oriented-security.org/lets-argue/singletons -// -// Also, thread-locals tend to be hostile to event-driven code, which can be particularly -// surprising when using fibers (all fibers in the same thread will share the same threadlocals, -// even though they do not share a stack). -// -// That said, thread-locals are sometimes needed for runtime logistics in the KJ framework. For -// example, the current exception callback and current EventLoop are stored as thread-local -// pointers. Since KJ only ever needs to store pointers, not values, we avoid the question of -// whether these values' destructors need to be run, and we avoid the need for heap allocation. - -#include "common.h" - -#if !defined(KJ_USE_PTHREAD_THREADLOCAL) && defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -// iOS apparently does not support __thread (nor C++11 thread_local). -#define KJ_USE_PTHREAD_TLS 1 -#endif -#endif - -#if KJ_USE_PTHREAD_TLS -#include -#endif - -namespace kj { - -#if KJ_USE_PTHREAD_TLS -// If __thread is unavailable, we'll fall back to pthreads. - -#define KJ_THREADLOCAL_PTR(type) \ - namespace { struct KJ_UNIQUE_NAME(_kj_TlpTag); } \ - static ::kj::_::ThreadLocalPtr< type, KJ_UNIQUE_NAME(_kj_TlpTag)> -// Hack: In order to ensure each thread-local results in a unique template instance, we declare -// a one-off dummy type to use as the second type parameter. - -namespace _ { // private - -template -class ThreadLocalPtr { - // Hacky type to emulate __thread T*. We need a separate instance of the ThreadLocalPtr template - // for every thread-local variable, because we don't want to require a global constructor, and in - // order to initialize the TLS on first use we need to use a local static variable (in getKey()). - // Each template instance will get a separate such local static variable, fulfilling our need. - -public: - ThreadLocalPtr() = default; - constexpr ThreadLocalPtr(decltype(nullptr)) {} - // Allow initialization to nullptr without a global constructor. - - inline ThreadLocalPtr& operator=(T* val) { - pthread_setspecific(getKey(), val); - return *this; - } - - inline operator T*() const { - return get(); - } - - inline T& operator*() const { - return *get(); - } - - inline T* operator->() const { - return get(); - } - -private: - inline T* get() const { - return reinterpret_cast(pthread_getspecific(getKey())); - } - - inline static pthread_key_t getKey() { - static pthread_key_t key = createKey(); - return key; - } - - static pthread_key_t createKey() { - pthread_key_t key; - pthread_key_create(&key, 0); - return key; - } -}; - -} // namespace _ (private) - -#elif __GNUC__ - -#define KJ_THREADLOCAL_PTR(type) static __thread type* -// GCC's __thread is lighter-weight than thread_local and is good enough for our purposes. - -#else - -#define KJ_THREADLOCAL_PTR(type) static thread_local type* - -#endif // KJ_USE_PTHREAD_TLS - -} // namespace kj - -#endif // KJ_THREADLOCAL_H_ diff --git a/phonelibs/capnp-cpp/include/kj/time.h b/phonelibs/capnp-cpp/include/kj/time.h deleted file mode 100644 index 37d7b8a90e..0000000000 --- a/phonelibs/capnp-cpp/include/kj/time.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2014 Google Inc. (contributed by Remy Blank ) -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TIME_H_ -#define KJ_TIME_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "units.h" -#include - -namespace kj { -namespace _ { // private - -class NanosecondLabel; -class TimeLabel; -class DateLabel; - -} // namespace _ (private) - -using Duration = Quantity; -// A time value, in nanoseconds. - -constexpr Duration NANOSECONDS = unit(); -constexpr Duration MICROSECONDS = 1000 * NANOSECONDS; -constexpr Duration MILLISECONDS = 1000 * MICROSECONDS; -constexpr Duration SECONDS = 1000 * MILLISECONDS; -constexpr Duration MINUTES = 60 * SECONDS; -constexpr Duration HOURS = 60 * MINUTES; -constexpr Duration DAYS = 24 * HOURS; - -using TimePoint = Absolute; -// An absolute time measured by some particular instance of `Timer`. `Time`s from two different -// `Timer`s may be measured from different origins and so are not necessarily compatible. - -using Date = Absolute; -// A point in real-world time, measured relative to the Unix epoch (Jan 1, 1970 00:00:00 UTC). - -constexpr Date UNIX_EPOCH = origin(); -// The `Date` representing Jan 1, 1970 00:00:00 UTC. - -class Clock { - // Interface to read the current date and time. -public: - virtual Date now() = 0; -}; - -Clock& nullClock(); -// A clock which always returns UNIX_EPOCH as the current time. Useful when you don't care about -// time. - -class Timer { - // Interface to time and timer functionality. - // - // Each `Timer` may have a different origin, and some `Timer`s may in fact tick at a different - // rate than real time (e.g. a `Timer` could represent CPU time consumed by a thread). However, - // all `Timer`s are monotonic: time will never appear to move backwards, even if the calendar - // date as tracked by the system is manually modified. - -public: - virtual TimePoint now() = 0; - // Returns the current value of a clock that moves steadily forward, independent of any - // changes in the wall clock. The value is updated every time the event loop waits, - // and is constant in-between waits. - - virtual Promise atTime(TimePoint time) = 0; - // Returns a promise that returns as soon as now() >= time. - - virtual Promise afterDelay(Duration delay) = 0; - // Equivalent to atTime(now() + delay). - - template - Promise timeoutAt(TimePoint time, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed by `time`. The thrown exception is of type - // "OVERLOADED". - - template - Promise timeoutAfter(Duration delay, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed after `delay` from now. The thrown exception is of - // type "OVERLOADED". - -private: - static kj::Exception makeTimeoutException(); -}; - -class TimerImpl final: public Timer { - // Implementation of Timer that expects an external caller -- usually, the EventPort - // implementation -- to tell it when time has advanced. - -public: - TimerImpl(TimePoint startTime); - ~TimerImpl() noexcept(false); - - Maybe nextEvent(); - // Returns the time at which the next scheduled timer event will occur, or null if no timer - // events are scheduled. - - Maybe timeoutToNextEvent(TimePoint start, Duration unit, uint64_t max); - // Convenience method which computes a timeout value to pass to an event-waiting system call to - // cause it to time out when the next timer event occurs. - // - // `start` is the time at which the timeout starts counting. This is typically not the same as - // now() since some time may have passed since the last time advanceTo() was called. - // - // `unit` is the time unit in which the timeout is measured. This is often MILLISECONDS. Note - // that this method will fractional values *up*, to guarantee that the returned timeout waits - // until just *after* the time the event is scheduled. - // - // The timeout will be clamped to `max`. Use this to avoid an overflow if e.g. the OS wants a - // 32-bit value or a signed value. - // - // Returns nullptr if there are no future events. - - void advanceTo(TimePoint newTime); - // Set the time to `time` and fire any at() events that have been passed. - - // implements Timer ---------------------------------------------------------- - TimePoint now() override; - Promise atTime(TimePoint time) override; - Promise afterDelay(Duration delay) override; - -private: - struct Impl; - class TimerPromiseAdapter; - TimePoint time; - Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -Promise Timer::timeoutAt(TimePoint time, Promise&& promise) { - return promise.exclusiveJoin(atTime(time).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -template -Promise Timer::timeoutAfter(Duration delay, Promise&& promise) { - return promise.exclusiveJoin(afterDelay(delay).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -inline TimePoint TimerImpl::now() { return time; } - -} // namespace kj - -#endif // KJ_TIME_H_ diff --git a/phonelibs/capnp-cpp/include/kj/tuple.h b/phonelibs/capnp-cpp/include/kj/tuple.h deleted file mode 100644 index 2ea7276ec5..0000000000 --- a/phonelibs/capnp-cpp/include/kj/tuple.h +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines a notion of tuples that is simpler that `std::tuple`. It works as follows: -// - `kj::Tuple is the type of a tuple of an A, a B, and a C. -// - `kj::tuple(a, b, c)` returns a tuple containing a, b, and c. If any of these are themselves -// tuples, they are flattened, so `tuple(a, tuple(b, c), d)` is equivalent to `tuple(a, b, c, d)`. -// - `kj::get(myTuple)` returns the element of `myTuple` at index n. -// - `kj::apply(func, ...)` calls func on the following arguments after first expanding any tuples -// in the argument list. So `kj::apply(foo, a, tuple(b, c), d)` would call `foo(a, b, c, d)`. -// -// Note that: -// - The type `Tuple` is a synonym for T. This is why `get` and `apply` are not members of the -// type. -// - It is illegal for an element of `Tuple` to itself be a tuple, as tuples are meant to be -// flattened. -// - It is illegal for an element of `Tuple` to be a reference, due to problems this would cause -// with type inference and `tuple()`. - -#ifndef KJ_TUPLE_H_ -#define KJ_TUPLE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { -namespace _ { // private - -template -struct TypeByIndex_; -template -struct TypeByIndex_<0, First, Rest...> { - typedef First Type; -}; -template -struct TypeByIndex_ - : public TypeByIndex_ {}; -template -struct TypeByIndex_ { - static_assert(index != index, "Index out-of-range."); -}; -template -using TypeByIndex = typename TypeByIndex_::Type; -// Chose a particular type out of a list of types, by index. - -template -struct Indexes {}; -// Dummy helper type that just encapsulates a sequential list of indexes, so that we can match -// templates against them and unpack them with '...'. - -template -struct MakeIndexes_: public MakeIndexes_ {}; -template -struct MakeIndexes_<0, prefix...> { - typedef Indexes Type; -}; -template -using MakeIndexes = typename MakeIndexes_::Type; -// Equivalent to Indexes<0, 1, 2, ..., end>. - -template -class Tuple; -template -inline TypeByIndex& getImpl(Tuple& tuple); -template -inline TypeByIndex&& getImpl(Tuple&& tuple); -template -inline const TypeByIndex& getImpl(const Tuple& tuple); - -template -struct TupleElement { - // Encapsulates one element of a tuple. The actual tuple implementation multiply-inherits - // from a TupleElement for each element, which is more efficient than a recursive definition. - - T value; - TupleElement() = default; - constexpr inline TupleElement(const T& value): value(value) {} - constexpr inline TupleElement(T&& value): value(kj::mv(value)) {} -}; - -template -struct TupleElement { - // If tuples contained references, one of the following would have to be true: - // - `auto x = tuple(y, z)` would cause x to be a tuple of references to y and z, which is - // probably not what you expected. - // - `Tuple x = tuple(a, b)` would not work, because `tuple()` returned - // Tuple. - static_assert(sizeof(T*) == 0, "Sorry, tuples cannot contain references."); -}; - -template -struct TupleElement> { - static_assert(sizeof(Tuple*) == 0, - "Tuples cannot contain other tuples -- they should be flattened."); -}; - -template -struct TupleImpl; - -template -struct TupleImpl, Types...> - : public TupleElement... { - // Implementation of Tuple. The only reason we need this rather than rolling this into class - // Tuple (below) is so that we can get "indexes" as an unpackable list. - - static_assert(sizeof...(indexes) == sizeof...(Types), "Incorrect use of TupleImpl."); - - template - inline TupleImpl(Params&&... params) - : TupleElement(kj::fwd(params))... { - // Work around Clang 3.2 bug 16303 where this is not detected. (Unfortunately, Clang sometimes - // segfaults instead.) - static_assert(sizeof...(params) == sizeof...(indexes), - "Wrong number of parameters to Tuple constructor."); - } - - template - constexpr inline TupleImpl(Tuple&& other) - : TupleElement(kj::mv(getImpl(other)))... {} - template - constexpr inline TupleImpl(Tuple& other) - : TupleElement(getImpl(other))... {} - template - constexpr inline TupleImpl(const Tuple& other) - : TupleElement(getImpl(other))... {} -}; - -struct MakeTupleFunc; - -template -class Tuple { - // The actual Tuple class (used for tuples of size other than 1). - -public: - template - constexpr inline Tuple(Tuple&& other): impl(kj::mv(other)) {} - template - constexpr inline Tuple(Tuple& other): impl(other) {} - template - constexpr inline Tuple(const Tuple& other): impl(other) {} - -private: - template - constexpr Tuple(Params&&... params): impl(kj::fwd(params)...) {} - - TupleImpl, T...> impl; - - template - friend inline TypeByIndex& getImpl(Tuple& tuple); - template - friend inline TypeByIndex&& getImpl(Tuple&& tuple); - template - friend inline const TypeByIndex& getImpl(const Tuple& tuple); - friend struct MakeTupleFunc; -}; - -template <> -class Tuple<> { - // Simplified zero-member version of Tuple. In particular this is important to make sure that - // Tuple<>() is constexpr. -}; - -template -class Tuple; -// Single-element tuple should never be used. The public API should ensure this. - -template -inline TypeByIndex& getImpl(Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline TypeByIndex&& getImpl(Tuple&& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return kj::mv(implicitCast>&>(tuple.impl).value); -} -template -inline const TypeByIndex& getImpl(const Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline T&& getImpl(T&& value) { - // Get member of a Tuple by index, e.g. `getImpl<2>(myTuple)`. - - // Non-tuples are equivalent to one-element tuples. - static_assert(index == 0, "Tuple element index out-of-bounds."); - return kj::fwd(value); -} - - -template -struct ExpandAndApplyResult_; -// Template which computes the return type of applying Func to T... after flattening tuples. -// SoFar starts as Tuple<> and accumulates the flattened parameter types -- so after this template -// is recursively expanded, T... is empty and SoFar is a Tuple containing all the parameters. - -template -struct ExpandAndApplyResult_, First, Rest...> - : public ExpandAndApplyResult_, Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple, Rest...> - : public ExpandAndApplyResult_, FirstTypes&&..., Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple&, Rest...> - : public ExpandAndApplyResult_, FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_, const Tuple&, Rest...> - : public ExpandAndApplyResult_, const FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_> { - typedef decltype(instance()(instance()...)) Type; -}; -template -using ExpandAndApplyResult = typename ExpandAndApplyResult_, T...>::Type; -// Computes the expected return type of `expandAndApply()`. - -template -inline auto expandAndApply(Func&& func) -> ExpandAndApplyResult { - return func(); -} - -template -struct ExpandAndApplyFunc { - Func&& func; - First&& first; - ExpandAndApplyFunc(Func&& func, First&& first) - : func(kj::fwd(func)), first(kj::fwd(first)) {} - template - auto operator()(T&&... params) - -> decltype(this->func(kj::fwd(first), kj::fwd(params)...)) { - return this->func(kj::fwd(first), kj::fwd(params)...); - } -}; - -template -inline auto expandAndApply(Func&& func, First&& first, Rest&&... rest) - -> ExpandAndApplyResult { - - return expandAndApply( - ExpandAndApplyFunc(kj::fwd(func), kj::fwd(first)), - kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), kj::mv(first), kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), kj::mv(getImpl(first))..., - kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), getImpl(first)..., - kj::fwd(rest)...); -} - -struct MakeTupleFunc { - template - Tuple...> operator()(Params&&... params) { - return Tuple...>(kj::fwd(params)...); - } - template - Decay operator()(Param&& param) { - return kj::fwd(param); - } -}; - -} // namespace _ (private) - -template struct Tuple_ { typedef _::Tuple Type; }; -template struct Tuple_ { typedef T Type; }; - -template using Tuple = typename Tuple_::Type; -// Tuple type. `Tuple` (i.e. a single-element tuple) is a synonym for `T`. Tuples of size -// other than 1 expand to an internal type. Either way, you can construct a Tuple using -// `kj::tuple(...)`, get an element by index `i` using `kj::get(myTuple)`, and expand the tuple -// as arguments to a function using `kj::apply(func, myTuple)`. -// -// Tuples are always flat -- that is, no element of a Tuple is ever itself a Tuple. If you -// construct a tuple from other tuples, the elements are flattened and concatenated. - -template -inline auto tuple(Params&&... params) - -> decltype(_::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...)) { - // Construct a new tuple from the given values. Any tuples in the argument list will be - // flattened into the result. - return _::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...); -} - -template -inline auto get(Tuple&& tuple) -> decltype(_::getImpl(kj::fwd(tuple))) { - // Unpack and return the tuple element at the given index. The index is specified as a template - // parameter, e.g. `kj::get<3>(myTuple)`. - return _::getImpl(kj::fwd(tuple)); -} - -template -inline auto apply(Func&& func, Params&&... params) - -> decltype(_::expandAndApply(kj::fwd(func), kj::fwd(params)...)) { - // Apply a function to some arguments, expanding tuples into separate arguments. - return _::expandAndApply(kj::fwd(func), kj::fwd(params)...); -} - -template struct TupleSize_ { static constexpr size_t size = 1; }; -template struct TupleSize_<_::Tuple> { - static constexpr size_t size = sizeof...(T); -}; - -template -constexpr size_t tupleSize() { return TupleSize_::size; } -// Returns size of the tuple T. - -} // namespace kj - -#endif // KJ_TUPLE_H_ diff --git a/phonelibs/capnp-cpp/include/kj/units.h b/phonelibs/capnp-cpp/include/kj/units.h deleted file mode 100644 index 8bba40338b..0000000000 --- a/phonelibs/capnp-cpp/include/kj/units.h +++ /dev/null @@ -1,1172 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef KJ_UNITS_H_ -#define KJ_UNITS_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include - -namespace kj { - -// ======================================================================================= -// IDs - -template -struct Id { - // A type-safe numeric ID. `UnderlyingType` is the underlying integer representation. `Label` - // distinguishes this Id from other Id types. Sample usage: - // - // class Foo; - // typedef Id FooId; - // - // class Bar; - // typedef Id BarId; - // - // You can now use the FooId and BarId types without any possibility of accidentally using a - // FooId when you really wanted a BarId or vice-versa. - - UnderlyingType value; - - inline constexpr Id(): value(0) {} - inline constexpr explicit Id(int value): value(value) {} - - inline constexpr bool operator==(const Id& other) const { return value == other.value; } - inline constexpr bool operator!=(const Id& other) const { return value != other.value; } - inline constexpr bool operator<=(const Id& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Id& other) const { return value >= other.value; } - inline constexpr bool operator< (const Id& other) const { return value < other.value; } - inline constexpr bool operator> (const Id& other) const { return value > other.value; } -}; - -// ======================================================================================= -// Quantity and UnitRatio -- implement unit analysis via the type system - -struct Unsafe_ {}; -constexpr Unsafe_ unsafe = Unsafe_(); -// Use as a parameter to constructors that are unsafe to indicate that you really do mean it. - -template -class Bounded; -template -class BoundedConst; - -template constexpr bool isIntegral() { return false; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } - -template -struct IsIntegralOrBounded_ { static constexpr bool value = isIntegral(); }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; - -template -inline constexpr bool isIntegralOrBounded() { return IsIntegralOrBounded_::value; } - -template -class UnitRatio { - // A multiplier used to convert Quantities of one unit to Quantities of another unit. See - // Quantity, below. - // - // Construct this type by dividing one Quantity by another of a different unit. Use this type - // by multiplying it by a Quantity, or dividing a Quantity by it. - - static_assert(isIntegralOrBounded(), - "Underlying type for UnitRatio must be integer."); - -public: - inline UnitRatio() {} - - constexpr UnitRatio(Number unit1PerUnit2, decltype(unsafe)): unit1PerUnit2(unit1PerUnit2) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr UnitRatio(const UnitRatio& other) - : unit1PerUnit2(other.unit1PerUnit2) {} - - template - inline constexpr UnitRatio - operator+(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 + other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator-(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 - other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U3 / U1 = U3 / U2 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U2 / U3 = U1 / U3 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U1 / U3) = U3 / U2 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U3 / U2) = U1 / U3 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - - template - inline decltype(Number() / OtherNumber()) - operator/(UnitRatio other) const { - return unit1PerUnit2 / other.unit1PerUnit2; - } - - inline bool operator==(UnitRatio other) const { return unit1PerUnit2 == other.unit1PerUnit2; } - inline bool operator!=(UnitRatio other) const { return unit1PerUnit2 != other.unit1PerUnit2; } - -private: - Number unit1PerUnit2; - - template - friend class Quantity; - template - friend class UnitRatio; - - template - friend inline constexpr UnitRatio - operator*(N1, UnitRatio); -}; - -template () && isIntegralOrBounded()>> -inline constexpr UnitRatio - operator*(N1 n, UnitRatio r) { - return UnitRatio(n * r.unit1PerUnit2, unsafe); -} - -template -class Quantity { - // A type-safe numeric quantity, specified in terms of some unit. Two Quantities cannot be used - // in arithmetic unless they use the same unit. The `Unit` type parameter is only used to prevent - // accidental mixing of units; this type is never instantiated and can very well be incomplete. - // `Number` is the underlying primitive numeric type. - // - // Quantities support most basic arithmetic operators, intelligently handling units, and - // automatically casting the underlying type in the same way that the compiler would. - // - // To convert a primitive number to a Quantity, multiply it by unit>(). - // To convert a Quantity to a primitive number, divide it by unit>(). - // To convert a Quantity of one unit to another unit, multiply or divide by a UnitRatio. - // - // The Quantity class is not well-suited to hardcore physics as it does not allow multiplying - // one quantity by another. For example, multiplying meters by meters won't get you square - // meters; it will get you a compiler error. It would be interesting to see if template - // metaprogramming could properly deal with such things but this isn't needed for the present - // use case. - // - // Sample usage: - // - // class SecondsLabel; - // typedef Quantity Seconds; - // constexpr Seconds SECONDS = unit(); - // - // class MinutesLabel; - // typedef Quantity Minutes; - // constexpr Minutes MINUTES = unit(); - // - // constexpr UnitRatio SECONDS_PER_MINUTE = - // 60 * SECONDS / MINUTES; - // - // void waitFor(Seconds seconds) { - // sleep(seconds / SECONDS); - // } - // void waitFor(Minutes minutes) { - // waitFor(minutes * SECONDS_PER_MINUTE); - // } - // - // void waitThreeMinutes() { - // waitFor(3 * MINUTES); - // } - - static_assert(isIntegralOrBounded(), - "Underlying type for Quantity must be integer."); - -public: - inline constexpr Quantity() = default; - - inline constexpr Quantity(MaxValue_): value(maxValue) {} - inline constexpr Quantity(MinValue_): value(minValue) {} - // Allow initialization from maxValue and minValue. - // TODO(msvc): decltype(maxValue) and decltype(minValue) deduce unknown-type for these function - // parameters, causing the compiler to complain of a duplicate constructor definition, so we - // specify MaxValue_ and MinValue_ types explicitly. - - inline constexpr Quantity(Number value, decltype(unsafe)): value(value) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr Quantity(const Quantity& other) - : value(other.value) {} - - template - inline Quantity& operator=(const Quantity& other) { - value = other.value; - return *this; - } - - template - inline constexpr Quantity - operator+(const Quantity& other) const { - return Quantity(value + other.value, unsafe); - } - template - inline constexpr Quantity - operator-(const Quantity& other) const { - return Quantity(value - other.value, unsafe); - } - template ()>> - inline constexpr Quantity - operator*(OtherNumber other) const { - return Quantity(value * other, unsafe); - } - template ()>> - inline constexpr Quantity - operator/(OtherNumber other) const { - return Quantity(value / other, unsafe); - } - template - inline constexpr decltype(Number() / OtherNumber()) - operator/(const Quantity& other) const { - return value / other.value; - } - template - inline constexpr Quantity - operator%(const Quantity& other) const { - return Quantity(value % other.value, unsafe); - } - - template - inline constexpr Quantity - operator*(UnitRatio ratio) const { - return Quantity( - value * ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator/(UnitRatio ratio) const { - return Quantity( - value / ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator%(UnitRatio ratio) const { - return Quantity( - value % ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(Quantity other) const { - return UnitRatio( - value / other.value, unsafe); - } - - template - inline constexpr bool operator==(const Quantity& other) const { - return value == other.value; - } - template - inline constexpr bool operator!=(const Quantity& other) const { - return value != other.value; - } - template - inline constexpr bool operator<=(const Quantity& other) const { - return value <= other.value; - } - template - inline constexpr bool operator>=(const Quantity& other) const { - return value >= other.value; - } - template - inline constexpr bool operator<(const Quantity& other) const { - return value < other.value; - } - template - inline constexpr bool operator>(const Quantity& other) const { - return value > other.value; - } - - template - inline Quantity& operator+=(const Quantity& other) { - value += other.value; - return *this; - } - template - inline Quantity& operator-=(const Quantity& other) { - value -= other.value; - return *this; - } - template - inline Quantity& operator*=(OtherNumber other) { - value *= other; - return *this; - } - template - inline Quantity& operator/=(OtherNumber other) { - value /= other.value; - return *this; - } - -private: - Number value; - - template - friend class Quantity; - - template - friend inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity; -}; - -template struct Unit_ { - static inline constexpr T get() { return T(1); } -}; -template -struct Unit_> { - static inline constexpr Quantity::get()), U> get() { - return Quantity::get()), U>(Unit_::get(), unsafe); - } -}; - -template -inline constexpr auto unit() -> decltype(Unit_::get()) { return Unit_::get(); } -// unit>() returns a Quantity of value 1. It also, intentionally, works on basic -// numeric types. - -template -inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity { - return Quantity(a * b.value, unsafe); -} - -template -inline constexpr auto operator*(UnitRatio ratio, - Quantity measure) - -> decltype(measure * ratio) { - return measure * ratio; -} - -// ======================================================================================= -// Absolute measures - -template -class Absolute { - // Wraps some other value -- typically a Quantity -- but represents a value measured based on - // some absolute origin. For example, if `Duration` is a type representing a time duration, - // Absolute might be a calendar date. - // - // Since Absolute represents measurements relative to some arbitrary origin, the only sensible - // arithmetic to perform on them is addition and subtraction. - - // TODO(someday): Do the same automatic expansion of integer width that Quantity does? Doesn't - // matter for our time use case, where we always use 64-bit anyway. Note that fixing this - // would implicitly allow things like multiplying an Absolute by a UnitRatio to change its - // units, which is actually totally logical and kind of neat. - -public: - inline constexpr Absolute operator+(const T& other) const { return Absolute(value + other); } - inline constexpr Absolute operator-(const T& other) const { return Absolute(value - other); } - inline constexpr T operator-(const Absolute& other) const { return value - other.value; } - - inline Absolute& operator+=(const T& other) { value += other; return *this; } - inline Absolute& operator-=(const T& other) { value -= other; return *this; } - - inline constexpr bool operator==(const Absolute& other) const { return value == other.value; } - inline constexpr bool operator!=(const Absolute& other) const { return value != other.value; } - inline constexpr bool operator<=(const Absolute& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Absolute& other) const { return value >= other.value; } - inline constexpr bool operator< (const Absolute& other) const { return value < other.value; } - inline constexpr bool operator> (const Absolute& other) const { return value > other.value; } - -private: - T value; - - explicit constexpr Absolute(T value): value(value) {} - - template - friend inline constexpr U origin(); -}; - -template -inline constexpr Absolute operator+(const T& a, const Absolute& b) { - return b + a; -} - -template struct UnitOf_ { typedef T Type; }; -template struct UnitOf_> { typedef T Type; }; -template -using UnitOf = typename UnitOf_::Type; -// UnitOf> is T. UnitOf is AnythingElse. - -template -inline constexpr T origin() { return T(0 * unit>()); } -// origin>() returns an Absolute of value 0. It also, intentionally, works on basic -// numeric types. - -// ======================================================================================= -// Overflow avoidance - -template -struct BitCount_ { - static constexpr uint value = BitCount_<(n >> 1), accum + 1>::value; -}; -template -struct BitCount_<0, accum> { - static constexpr uint value = accum; -}; - -template -inline constexpr uint bitCount() { return BitCount_::value; } -// Number of bits required to represent the number `n`. - -template struct AtLeastUInt_ { - static_assert(bitCountBitCount < 7, "don't know how to represent integers over 64 bits"); -}; -template <> struct AtLeastUInt_<0> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<1> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<2> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<3> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<4> { typedef uint16_t Type; }; -template <> struct AtLeastUInt_<5> { typedef uint32_t Type; }; -template <> struct AtLeastUInt_<6> { typedef uint64_t Type; }; - -template -using AtLeastUInt = typename AtLeastUInt_()>::Type; -// AtLeastUInt is an unsigned integer of at least n bits. E.g. AtLeastUInt<12> is uint16_t. - -// ------------------------------------------------------------------- - -template -class BoundedConst { - // A constant integer value on which we can do bit size analysis. - -public: - BoundedConst() = default; - - inline constexpr uint unwrap() const { return value; } - -#define OP(op, check) \ - template \ - inline constexpr BoundedConst<(value op other)> \ - operator op(BoundedConst) const { \ - static_assert(check, "overflow in BoundedConst arithmetic"); \ - return BoundedConst<(value op other)>(); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(BoundedConst) const { \ - return value op other; \ - } - - OP(+, value + other >= value) - OP(-, value - other <= value) - OP(*, value * other / other == value) - OP(/, true) // div by zero already errors out; no other division ever overflows - OP(%, true) // mod by zero already errors out; no other modulus ever overflows - OP(<<, value << other >= value) - OP(>>, true) // right shift can't overflow - OP(&, true) // bitwise ops can't overflow - OP(|, true) // bitwise ops can't overflow - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) -#undef OP -#undef COMPARE_OP -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -inline constexpr BoundedConst bounded() { - return BoundedConst(); -} - -template -static constexpr uint64_t boundedAdd() { - static_assert(a + b >= a, "possible overflow detected"); - return a + b; -} -template -static constexpr uint64_t boundedSub() { - static_assert(a - b <= a, "possible underflow detected"); - return a - b; -} -template -static constexpr uint64_t boundedMul() { - static_assert(a * b / b == a, "possible overflow detected"); - return a * b; -} -template -static constexpr uint64_t boundedLShift() { - static_assert(a << b >= a, "possible overflow detected"); - return a << b; -} - -template -inline constexpr BoundedConst min(BoundedConst, BoundedConst) { - return bounded(); -} -template -inline constexpr BoundedConst max(BoundedConst, BoundedConst) { - return bounded(); -} -// We need to override min() and max() between constants because the ternary operator in the -// default implementation would complain. - -// ------------------------------------------------------------------- - -template -class Bounded { -public: - static_assert(maxN <= T(kj::maxValue), "possible overflow detected"); - - Bounded() = default; - - Bounded(const Bounded& other) = default; - template ()>> - inline constexpr Bounded(OtherInt value): value(value) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(const Bounded& other) - : value(other.value) { - static_assert(otherMax <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(BoundedConst) - : value(otherValue) { - static_assert(otherValue <= maxN, "overflow detected"); - } - - Bounded& operator=(const Bounded& other) = default; - template ()>> - Bounded& operator=(OtherInt other) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - value = other; - return *this; - } - template - inline Bounded& operator=(const Bounded& other) { - static_assert(otherMax <= maxN, "possible overflow detected"); - value = other.value; - return *this; - } - template - inline Bounded& operator=(BoundedConst) { - static_assert(otherValue <= maxN, "overflow detected"); - value = otherValue; - return *this; - } - - inline constexpr T unwrap() const { return value; } - -#define OP(op, newMax) \ - template \ - inline constexpr Bounded \ - operator op(const Bounded& other) const { \ - return Bounded(value op other.value, unsafe); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(const Bounded& other) const { \ - return value op other.value; \ - } - - OP(+, (boundedAdd())) - OP(*, (boundedMul())) - OP(/, maxN) - OP(%, otherMax - 1) - - // operator- is intentionally omitted because we mostly use this with unsigned types, and - // subtraction requires proof that subtrahend is not greater than the minuend. - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) - -#undef OP -#undef COMPARE_OP - - template - inline Bounded assertMax(ErrorFunc&& func) const { - // Assert that the number is no more than `newMax`. Otherwise, call `func`. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - if (KJ_UNLIKELY(value > newMax)) func(); - return Bounded(value, unsafe); - } - - template - inline Bounded subtractChecked( - const Bounded& other, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - if (KJ_UNLIKELY(value < other.value)) func(); - return Bounded(value - other.value, unsafe); - } - - template - inline Bounded subtractChecked( - BoundedConst, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - static_assert(otherValue <= maxN, "underflow detected"); - if (KJ_UNLIKELY(value < otherValue)) func(); - return Bounded(value - otherValue, unsafe); - } - - template - inline Maybe> trySubtract( - const Bounded& other) const { - // Subtract a number, calling func() if the result would underflow. - if (value < other.value) { - return nullptr; - } else { - return Bounded(value - other.value, unsafe); - } - } - - template - inline Maybe> trySubtract(BoundedConst) const { - // Subtract a number, calling func() if the result would underflow. - if (value < otherValue) { - return nullptr; - } else { - return Bounded(value - otherValue, unsafe); - } - } - - inline constexpr Bounded(T value, decltype(unsafe)): value(value) {} - template - inline constexpr Bounded(Bounded value, decltype(unsafe)) - : value(value.value) {} - // Mainly for internal use. - // - // Only use these as a last resort, with ample commentary on why you think it's safe. - -private: - T value; - - template - friend class Bounded; -}; - -template -inline constexpr Bounded bounded(Number value) { - return Bounded(value, unsafe); -} - -inline constexpr Bounded<1, uint8_t> bounded(bool value) { - return Bounded<1, uint8_t>(value, unsafe); -} - -template -inline constexpr Bounded(), Number> assumeBits(Number value) { - return Bounded(), Number>(value, unsafe); -} - -template -inline constexpr Bounded(), T> assumeBits(Bounded value) { - return Bounded(), T>(value, unsafe); -} - -template -inline constexpr auto assumeBits(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeBits(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(Number value) { - return Bounded(value, unsafe); -} - -template -inline constexpr Bounded assumeMax(Bounded value) { - return Bounded(value, unsafe); -} - -template -inline constexpr auto assumeMax(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeMax(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Number value) { - return assumeMax(value); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Bounded value) { - return assumeMax(value); -} - -template -inline constexpr auto assumeMax(Quantity, Unit>, Quantity value) - -> decltype(assumeMax(value)) { - return assumeMax(value); -} - -template -inline Bounded assertMax(Bounded value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return value.template assertMax(kj::fwd(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit> value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return (value / unit()).template assertMax( - kj::fwd(errorFunc)) * unit(); -} - -template -inline Bounded assertMax( - BoundedConst, Bounded value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit>, - Quantity, Unit> value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Bounded(), T> assertMaxBits( - Bounded value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline Quantity(), T>, Unit> assertMaxBits( - Quantity, Unit> value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline constexpr Bounded upgradeBound(Bounded value) { - return value; -} - -template -inline constexpr Quantity, Unit> upgradeBound( - Quantity, Unit> value) { - return value; -} - -template -inline auto subtractChecked(Bounded value, Other other, ErrorFunc&& errorFunc) - -> decltype(value.subtractChecked(other, kj::fwd(errorFunc))) { - return value.subtractChecked(other, kj::fwd(errorFunc)); -} - -template -inline auto subtractChecked(Quantity value, Quantity other, ErrorFunc&& errorFunc) - -> Quantity(errorFunc))), Unit> { - return subtractChecked(value / unit>(), - other / unit>(), - kj::fwd(errorFunc)) - * unit>(); -} - -template -inline auto trySubtract(Bounded value, Other other) - -> decltype(value.trySubtract(other)) { - return value.trySubtract(other); -} - -template -inline auto trySubtract(Quantity value, Quantity other) - -> Maybe> { - return trySubtract(value / unit>(), - other / unit>()) - .map([](decltype(subtractChecked(T(), U(), int())) x) { - return x * unit>(); - }); -} - -template -inline constexpr Bounded> -min(Bounded a, Bounded b) { - return Bounded>(kj::min(a.unwrap(), b.unwrap()), unsafe); -} -template -inline constexpr Bounded> -max(Bounded a, Bounded b) { - return Bounded>(kj::max(a.unwrap(), b.unwrap()), unsafe); -} -// We need to override min() and max() because: -// 1) WiderType<> might not choose the correct bounds. -// 2) One of the two sides of the ternary operator in the default implementation would fail to -// typecheck even though it is OK in practice. - -// ------------------------------------------------------------------- -// Operators between Bounded and BoundedConst - -#define OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(T() op uint())> operator op( \ - Bounded value, BoundedConst) { \ - return Bounded<(newMax), decltype(T() op uint())>(value.unwrap() op cvalue, unsafe); \ -} - -#define REVERSE_OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(uint() op T())> operator op( \ - BoundedConst, Bounded value) { \ - return Bounded<(newMax), decltype(uint() op T())>(cvalue op value.unwrap(), unsafe); \ -} - -#define COMPARE_OP(op) \ -template \ -inline constexpr bool operator op(Bounded value, BoundedConst) { \ - return value.unwrap() op cvalue; \ -} \ -template \ -inline constexpr bool operator op(BoundedConst, Bounded value) { \ - return cvalue op value.unwrap(); \ -} - -OP(+, (boundedAdd())) -REVERSE_OP(+, (boundedAdd())) - -OP(*, (boundedMul())) -REVERSE_OP(*, (boundedAdd())) - -OP(/, maxN / cvalue) -REVERSE_OP(/, cvalue) // denominator could be 1 - -OP(%, cvalue - 1) -REVERSE_OP(%, maxN - 1) - -OP(<<, (boundedLShift())) -REVERSE_OP(<<, (boundedLShift())) - -OP(>>, maxN >> cvalue) -REVERSE_OP(>>, cvalue >> maxN) - -OP(&, maxValueForBits()>() & cvalue) -REVERSE_OP(&, maxValueForBits()>() & cvalue) - -OP(|, maxN | cvalue) -REVERSE_OP(|, maxN | cvalue) - -COMPARE_OP(==) -COMPARE_OP(!=) -COMPARE_OP(< ) -COMPARE_OP(> ) -COMPARE_OP(<=) -COMPARE_OP(>=) - -#undef OP -#undef REVERSE_OP -#undef COMPARE_OP - -template -inline constexpr Bounded - operator-(BoundedConst, Bounded value) { - // We allow subtraction of a variable from a constant only if the constant is greater than or - // equal to the maximum possible value of the variable. Since the variable could be zero, the - // result can be as large as the constant. - // - // We do not allow subtraction of a constant from a variable because there's never a guarantee it - // won't underflow (unless the constant is zero, which is silly). - static_assert(cvalue >= maxN, "possible underflow detected"); - return Bounded(cvalue - value.unwrap(), unsafe); -} - -template -inline constexpr Bounded min(Bounded a, BoundedConst) { - return Bounded(kj::min(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded min(BoundedConst, Bounded a) { - return Bounded(kj::min(a.unwrap(), b), unsafe); -} -template -inline constexpr Bounded max(Bounded a, BoundedConst) { - return Bounded(kj::max(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded max(BoundedConst, Bounded a) { - return Bounded(kj::max(a.unwrap(), b), unsafe); -} -// We need to override min() between a Bounded and a constant since: -// 1) WiderType<> might choose BoundedConst over a 1-byte Bounded, which is wrong. -// 2) To clamp the bounds of the output type. -// 3) Same ternary operator typechecking issues. - -// ------------------------------------------------------------------- - -template -class SafeUnwrapper { -public: - inline explicit constexpr SafeUnwrapper(Bounded value): value(value.unwrap()) {} - - template ()>> - inline constexpr operator U() const { - static_assert(maxN <= U(maxValue), "possible truncation detected"); - return value; - } - - inline constexpr operator bool() const { - static_assert(maxN <= 1, "possible truncation detected"); - return value; - } - -private: - T value; -}; - -template -inline constexpr SafeUnwrapper unbound(Bounded bounded) { - // Unwraps the bounded value, returning a value that can be implicitly cast to any integer type. - // If this implicit cast could truncate, a compile-time error will be raised. - return SafeUnwrapper(bounded); -} - -template -class SafeConstUnwrapper { -public: - template ()>> - inline constexpr operator T() const { - static_assert(value <= T(maxValue), "this operation will truncate"); - return value; - } - - inline constexpr operator bool() const { - static_assert(value <= 1, "this operation will truncate"); - return value; - } -}; - -template -inline constexpr SafeConstUnwrapper unbound(BoundedConst) { - return SafeConstUnwrapper(); -} - -template -inline constexpr T unboundAs(U value) { - return unbound(value); -} - -template -inline constexpr T unboundMax(Bounded value) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(maxN <= requestedMax, "possible overflow detected"); - return value.unwrap(); -} - -template -inline constexpr uint unboundMax(BoundedConst) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(value <= requestedMax, "overflow detected"); - return value; -} - -template -inline constexpr auto unboundMaxBits(T value) -> - decltype(unboundMax()>(value)) { - // Explicitly ungaurd expecting a value that fits into `bits` bits. - return unboundMax()>(value); -} - -#define OP(op) \ -template \ -inline constexpr auto operator op(T a, SafeUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} \ -template \ -inline constexpr auto operator op(T a, SafeConstUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeConstUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} - -OP(+) -OP(-) -OP(*) -OP(/) -OP(%) -OP(<<) -OP(>>) -OP(&) -OP(|) -OP(==) -OP(!=) -OP(<=) -OP(>=) -OP(<) -OP(>) - -#undef OP - -// ------------------------------------------------------------------- - -template -class Range> { -public: - inline constexpr Range(Bounded begin, Bounded end) - : inner(unbound(begin), unbound(end)) {} - inline explicit constexpr Range(Bounded end) - : inner(unbound(end)) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Bounded operator* () const { return Bounded(*inner, unsafe); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -class Range> { -public: - inline constexpr Range(Quantity begin, Quantity end) - : inner(begin / unit>(), end / unit>()) {} - inline explicit constexpr Range(Quantity end) - : inner(end / unit>()) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Quantity operator* () const { return *inner * unit>(); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -inline constexpr Range> zeroTo(BoundedConst end) { - return Range>(end); -} - -template -inline constexpr Range, Unit>> - zeroTo(Quantity, Unit> end) { - return Range, Unit>>(end); -} - -} // namespace kj - -#endif // KJ_UNITS_H_ diff --git a/phonelibs/capnp-cpp/include/kj/vector.h b/phonelibs/capnp-cpp/include/kj/vector.h deleted file mode 100644 index 44613f3331..0000000000 --- a/phonelibs/capnp-cpp/include/kj/vector.h +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_VECTOR_H_ -#define KJ_VECTOR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" - -namespace kj { - -template -class Vector { - // Similar to std::vector, but based on KJ framework. - // - // This implementation always uses move constructors when growing the backing array. If the - // move constructor throws, the Vector is left in an inconsistent state. This is acceptable - // under KJ exception theory which assumes that exceptions leave things in inconsistent states. - - // TODO(someday): Allow specifying a custom allocator. - -public: - inline Vector() = default; - inline explicit Vector(size_t capacity): builder(heapArrayBuilder(capacity)) {} - - inline operator ArrayPtr() { return builder; } - inline operator ArrayPtr() const { return builder; } - inline ArrayPtr asPtr() { return builder.asPtr(); } - inline ArrayPtr asPtr() const { return builder.asPtr(); } - - inline size_t size() const { return builder.size(); } - inline bool empty() const { return size() == 0; } - inline size_t capacity() const { return builder.capacity(); } - inline T& operator[](size_t index) const { return builder[index]; } - - inline const T* begin() const { return builder.begin(); } - inline const T* end() const { return builder.end(); } - inline const T& front() const { return builder.front(); } - inline const T& back() const { return builder.back(); } - inline T* begin() { return builder.begin(); } - inline T* end() { return builder.end(); } - inline T& front() { return builder.front(); } - inline T& back() { return builder.back(); } - - inline Array releaseAsArray() { - // TODO(perf): Avoid a copy/move by allowing Array to point to incomplete space? - if (!builder.isFull()) { - setCapacity(size()); - } - return builder.finish(); - } - - template - inline T& add(Params&&... params) { - if (builder.isFull()) grow(); - return builder.add(kj::fwd(params)...); - } - - template - inline void addAll(Iterator begin, Iterator end) { - size_t needed = builder.size() + (end - begin); - if (needed > builder.capacity()) grow(needed); - builder.addAll(begin, end); - } - - template - inline void addAll(Container&& container) { - addAll(container.begin(), container.end()); - } - - inline void removeLast() { - builder.removeLast(); - } - - inline void resize(size_t size) { - if (size > builder.capacity()) grow(size); - builder.resize(size); - } - - inline void operator=(decltype(nullptr)) { - builder = nullptr; - } - - inline void clear() { - while (builder.size() > 0) { - builder.removeLast(); - } - } - - inline void truncate(size_t size) { - builder.truncate(size); - } - - inline void reserve(size_t size) { - if (size > builder.capacity()) { - setCapacity(size); - } - } - -private: - ArrayBuilder builder; - - void grow(size_t minCapacity = 0) { - setCapacity(kj::max(minCapacity, capacity() == 0 ? 4 : capacity() * 2)); - } - void setCapacity(size_t newSize) { - if (builder.size() > newSize) { - builder.truncate(newSize); - } - ArrayBuilder newBuilder = heapArrayBuilder(newSize); - newBuilder.addAll(kj::mv(builder)); - builder = kj::mv(newBuilder); - } -}; - -template -inline auto KJ_STRINGIFY(const Vector& v) -> decltype(toCharSequence(v.asPtr())) { - return toCharSequence(v.asPtr()); -} - -} // namespace kj - -#endif // KJ_VECTOR_H_ diff --git a/phonelibs/capnp-cpp/include/kj/windows-sanity.h b/phonelibs/capnp-cpp/include/kj/windows-sanity.h deleted file mode 100644 index 766ba2cbd6..0000000000 --- a/phonelibs/capnp-cpp/include/kj/windows-sanity.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_WINDOWS_SANITY_H_ -#define KJ_WINDOWS_SANITY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef _INC_WINDOWS -#error "windows.h needs to be included before kj/windows-sanity.h (or perhaps you don't need either?)" -#endif - -namespace win32 { - const auto ERROR_ = ERROR; -#undef ERROR - const auto ERROR = ERROR_; -} - -using win32::ERROR; - -#endif // KJ_WINDOWS_SANITY_H_ diff --git a/phonelibs/capnp-cpp/larch64/include b/phonelibs/capnp-cpp/larch64/include deleted file mode 120000 index 198e3f2957..0000000000 --- a/phonelibs/capnp-cpp/larch64/include +++ /dev/null @@ -1 +0,0 @@ -../../../external/capnparm/include \ No newline at end of file diff --git a/phonelibs/capnp-cpp/larch64/lib b/phonelibs/capnp-cpp/larch64/lib deleted file mode 120000 index bf768993ee..0000000000 --- a/phonelibs/capnp-cpp/larch64/lib +++ /dev/null @@ -1 +0,0 @@ -../../../external/capnparm/lib \ No newline at end of file diff --git a/phonelibs/capnp-cpp/mac/include/capnp/any.h b/phonelibs/capnp-cpp/mac/include/capnp/any.h deleted file mode 100644 index 6df9dc8dc2..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/any.h +++ /dev/null @@ -1,1073 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ANY_H_ -#define CAPNP_ANY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "pointer-helpers.h" -#include "orphan.h" -#include "list.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -class InterfaceSchema; -class Orphanage; -class ClientHook; -class PipelineHook; -struct PipelineOp; -struct AnyPointer; - -struct AnyList { - AnyList() = delete; - - class Reader; - class Builder; -}; - -struct AnyStruct { - AnyStruct() = delete; - - class Reader; - class Builder; - class Pipeline; -}; - -template<> -struct List { - List() = delete; - - class Reader; - class Builder; -}; - -namespace _ { // private -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -} // namespace _ (private) - -// ======================================================================================= -// AnyPointer! - -enum class Equality { - NOT_EQUAL, - EQUAL, - UNKNOWN_CONTAINS_CAPS -}; - -kj::StringPtr KJ_STRINGIFY(Equality res); - -struct AnyPointer { - // Reader/Builder for the `AnyPointer` field type, i.e. a pointer that can point to an arbitrary - // object. - - AnyPointer() = delete; - - class Reader { - public: - typedef AnyPointer Reads; - - Reader() = default; - inline Reader(_::PointerReader reader): reader(reader) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType() const; - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() const { return getPointerType() == PointerType::STRUCT; } - inline bool isList() const { return getPointerType() == PointerType::LIST; } - inline bool isCapability() const { return getPointerType() == PointerType::CAPABILITY; } - - Equality equals(AnyPointer::Reader right); - bool operator==(AnyPointer::Reader right); - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - template - inline ReaderFor getAs() const; - // Valid for T = any generated struct type, interface type, List, Text, or Data. - - template - inline ReaderFor getAs(StructSchema schema) const; - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline ReaderFor getAs(ListSchema schema) const; - // Only valid for T = DynamicList. Requires `#include `. - - template - inline ReaderFor getAs(InterfaceSchema schema) const; - // Only valid for T = DynamicCapability. Requires `#include `. - -#if !CAPNP_LITE - kj::Own getPipelinedCap(kj::ArrayPtr ops) const; - // Used by RPC system to implement pipelining. Applications generally shouldn't use this - // directly. -#endif // !CAPNP_LITE - - private: - _::PointerReader reader; - friend struct AnyPointer; - friend class Orphanage; - friend class CapReaderContext; - friend struct _::PointerHelpers; - }; - - class Builder { - public: - typedef AnyPointer Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline Builder(_::PointerBuilder builder): builder(builder) {} - - inline MessageSize targetSize() const; - // Get the total size of the target object and all its children. - - inline PointerType getPointerType(); - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - inline bool isStruct() { return getPointerType() == PointerType::STRUCT; } - inline bool isList() { return getPointerType() == PointerType::LIST; } - inline bool isCapability() { return getPointerType() == PointerType::CAPABILITY; } - - inline Equality equals(AnyPointer::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyPointer::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyPointer::Reader right) { - return !(*this == right); - } - - inline void clear(); - // Set to null. - - template - inline BuilderFor getAs(); - // Valid for T = any generated struct type, List, Text, or Data. - - template - inline BuilderFor getAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor getAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline BuilderFor getAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - template - inline BuilderFor initAs(); - // Valid for T = any generated struct type. - - template - inline BuilderFor initAs(uint elementCount); - // Valid for T = List, Text, or Data. - - template - inline BuilderFor initAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline BuilderFor initAs(ListSchema schema, uint elementCount); - // Only valid for T = DynamicList. Requires `#include `. - - inline AnyList::Builder initAsAnyList(ElementSize elementSize, uint elementCount); - // Note: Does not accept INLINE_COMPOSITE for elementSize. - - inline List::Builder initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount); - - inline AnyStruct::Builder initAsAnyStruct(uint16_t dataWordCount, uint16_t pointerCount); - - template - inline void setAs(ReaderFor value); - // Valid for ReaderType = T::Reader for T = any generated struct type, List, Text, Data, - // DynamicStruct, or DynamicList (the dynamic types require `#include `). - - template - inline void setAs(std::initializer_list>> list); - // Valid for T = List. - - template - inline void setCanonicalAs(ReaderFor value); - - inline void set(Reader value) { builder.copyFrom(value.reader); } - // Set to a copy of another AnyPointer. - - inline void setCanonical(Reader value) { builder.copyFrom(value.reader, true); } - - template - inline void adopt(Orphan&& orphan); - // Valid for T = any generated struct type, List, Text, Data, DynamicList, DynamicStruct, - // or DynamicValue (the dynamic types require `#include `). - - template - inline Orphan disownAs(); - // Valid for T = any generated struct type, List, Text, Data. - - template - inline Orphan disownAs(StructSchema schema); - // Only valid for T = DynamicStruct. Requires `#include `. - - template - inline Orphan disownAs(ListSchema schema); - // Only valid for T = DynamicList. Requires `#include `. - - template - inline Orphan disownAs(InterfaceSchema schema); - // Only valid for T = DynamicCapability. Requires `#include `. - - inline Orphan disown(); - // Disown without a type. - - inline Reader asReader() const { return Reader(builder.asReader()); } - inline operator Reader() const { return Reader(builder.asReader()); } - - private: - _::PointerBuilder builder; - friend class Orphanage; - friend class CapBuilderContext; - friend struct _::PointerHelpers; - }; - -#if !CAPNP_LITE - class Pipeline { - public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)) {} - inline explicit Pipeline(kj::Own&& hook): hook(kj::mv(hook)) {} - - Pipeline noop(); - // Just make a copy. - - Pipeline getPointerField(uint16_t pointerIndex); - // Deprecated. In the future, we should use .asAnyStruct.getPointerField. - - inline AnyStruct::Pipeline asAnyStruct(); - - kj::Own asCap(); - // Expect that the result is a capability and construct a pipelined version of it now. - - inline kj::Own releasePipelineHook() { return kj::mv(hook); } - // For use by RPC implementations. - - template ) == Kind::INTERFACE>> - inline operator T() { return T(asCap()); } - - private: - kj::Own hook; - kj::Array ops; - - inline Pipeline(kj::Own&& hook, kj::Array&& ops) - : hook(kj::mv(hook)), ops(kj::mv(ops)) {} - - friend class LocalClient; - friend class PipelineHook; - friend class AnyStruct::Pipeline; - }; -#endif // !CAPNP_LITE -}; - -template <> -class Orphan { - // An orphaned object of unknown type. - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder) - : builder(kj::mv(builder)) {} - - Orphan& operator=(Orphan&&) = default; - - template - inline Orphan(Orphan&& other): builder(kj::mv(other.builder)) {} - template - inline Orphan& operator=(Orphan&& other) { builder = kj::mv(other.builder); return *this; } - // Cast from typed orphan. - - // It's not possible to get an AnyPointer::{Reader,Builder} directly since there is no - // underlying pointer (the pointer would normally live in the parent, but this object is - // orphaned). It is possible, however, to request typed readers/builders. - - template - inline BuilderFor getAs(); - template - inline BuilderFor getAs(StructSchema schema); - template - inline BuilderFor getAs(ListSchema schema); - template - inline typename T::Client getAs(InterfaceSchema schema); - template - inline ReaderFor getAsReader() const; - template - inline ReaderFor getAsReader(StructSchema schema) const; - template - inline ReaderFor getAsReader(ListSchema schema) const; - template - inline typename T::Client getAsReader(InterfaceSchema schema) const; - - template - inline Orphan releaseAs(); - template - inline Orphan releaseAs(StructSchema schema); - template - inline Orphan releaseAs(ListSchema schema); - template - inline Orphan releaseAs(InterfaceSchema schema); - // Down-cast the orphan to a specific type. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend class Orphan; - friend class AnyPointer::Builder; -}; - -template struct AnyTypeFor_; -template <> struct AnyTypeFor_ { typedef AnyStruct Type; }; -template <> struct AnyTypeFor_ { typedef AnyList Type; }; - -template -using AnyTypeFor = typename AnyTypeFor_::Type; - -template -inline ReaderFor>> toAny(T&& value) { - return ReaderFor>>( - _::PointerHelpers>::getInternalReader(value)); -} -template -inline BuilderFor>> toAny(T&& value) { - return BuilderFor>>( - _::PointerHelpers>::getInternalBuilder(kj::mv(value))); -} - -template <> -struct List { - // Note: This cannot be used for a list of structs, since such lists are not encoded as pointer - // lists! Use List. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyPointer::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyPointer::Reader(reader.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::POINTER) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyPointer::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyPointer::Builder(builder.getPointerElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; -}; - -class AnyStruct::Reader { -public: - typedef AnyStruct Reads; - - Reader() = default; - inline Reader(_::StructReader reader): _reader(reader) {} - - template ) == Kind::STRUCT>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} - - kj::ArrayPtr getDataSection() { - return _reader.getDataSectionAsBlob(); - } - List::Reader getPointerSection() { - return List::Reader(_reader.getPointerSectionAsList()); - } - - kj::Array canonicalize() { - return _reader.canonicalize(); - } - - Equality equals(AnyStruct::Reader right); - bool operator==(AnyStruct::Reader right); - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - template - ReaderFor as() const { - // T must be a struct type. - return typename T::Reader(_reader); - } -private: - _::StructReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyStruct::Builder { -public: - typedef AnyStruct Builds; - - inline Builder(decltype(nullptr)) {} - inline Builder(_::StructBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::STRUCT>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline kj::ArrayPtr getDataSection() { - return _builder.getDataSectionAsBlob(); - } - List::Builder getPointerSection() { - return List::Builder(_builder.getPointerSectionAsList()); - } - - inline Equality equals(AnyStruct::Reader right) { - return asReader().equals(right); - } - inline bool operator==(AnyStruct::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyStruct::Reader right) { - return !(*this == right); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - - template - BuilderFor as() { - // T must be a struct type. - return typename T::Builder(_builder); - } -private: - _::StructBuilder _builder; - friend class Orphanage; - friend class CapBuilderContext; -}; - -#if !CAPNP_LITE -class AnyStruct::Pipeline { -public: - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - inline explicit Pipeline(AnyPointer::Pipeline&& typeless) - : typeless(kj::mv(typeless)) {} - - inline AnyPointer::Pipeline getPointerField(uint16_t pointerIndex) { - // Return a new Promise representing a sub-object of the result. `pointerIndex` is the index - // of the sub-object within the pointer section of the result (the result must be a struct). - // - // TODO(perf): On GCC 4.8 / Clang 3.3, use rvalue qualifiers to avoid the need for copies. - // Also make `ops` into a Vector to optimize this. - return typeless.getPointerField(pointerIndex); - } - -private: - AnyPointer::Pipeline typeless; -}; -#endif // !CAPNP_LITE - -class List::Reader { -public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline AnyStruct::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return AnyStruct::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class List::Builder { -public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)): builder(ElementSize::INLINE_COMPOSITE) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline AnyStruct::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return AnyStruct::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - -private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; -}; - -class AnyList::Reader { -public: - typedef AnyList Reads; - - inline Reader(): _reader(ElementSize::VOID) {} - inline Reader(_::ListReader reader): _reader(reader) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Reader(T&& value) - : _reader(_::PointerHelpers>::getInternalReader(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _reader.getElementSize(); } - inline uint size() { return unbound(_reader.size() / ELEMENTS); } - - inline kj::ArrayPtr getRawBytes() { return _reader.asRawBytes(); } - - Equality equals(AnyList::Reader right); - bool operator==(AnyList::Reader right); - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template ReaderFor as() { - // T must be List. - return ReaderFor(_reader); - } -private: - _::ListReader _reader; - - template - friend struct _::PointerHelpers; - friend class Orphanage; -}; - -class AnyList::Builder { -public: - typedef AnyList Builds; - - inline Builder(decltype(nullptr)): _builder(ElementSize::VOID) {} - inline Builder(_::ListBuilder builder): _builder(builder) {} - -#if !_MSC_VER // TODO(msvc): MSVC ICEs on this. Try restoring when compiler improves. - template ) == Kind::LIST>> - inline Builder(T&& value) - : _builder(_::PointerHelpers>::getInternalBuilder(kj::fwd(value))) {} -#endif - - inline ElementSize getElementSize() { return _builder.getElementSize(); } - inline uint size() { return unbound(_builder.size() / ELEMENTS); } - - Equality equals(AnyList::Reader right); - inline bool operator==(AnyList::Reader right) { - return asReader() == right; - } - inline bool operator!=(AnyList::Reader right) { - return !(*this == right); - } - - template BuilderFor as() { - // T must be List. - return BuilderFor(_builder); - } - - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return Reader(_builder.asReader()); } - -private: - _::ListBuilder _builder; - - friend class Orphanage; -}; - -// ======================================================================================= -// Pipeline helpers -// -// These relate to capabilities, but we don't declare them in capability.h because generated code -// for structs needs to know about these, even in files that contain no interfaces. - -#if !CAPNP_LITE - -struct PipelineOp { - // Corresponds to rpc.capnp's PromisedAnswer.Op. - - enum Type { - NOOP, // for convenience - - GET_POINTER_FIELD - - // There may be other types in the future... - }; - - Type type; - union { - uint16_t pointerIndex; // for GET_POINTER_FIELD - }; -}; - -class PipelineHook { - // Represents a currently-running call, and implements pipelined requests on its result. - -public: - virtual kj::Own addRef() = 0; - // Increment this object's reference count. - - virtual kj::Own getPipelinedCap(kj::ArrayPtr ops) = 0; - // Extract a promised Capability from the results. - - virtual kj::Own getPipelinedCap(kj::Array&& ops); - // Version of getPipelinedCap() passing the array by move. May avoid a copy in some cases. - // Default implementation just calls the other version. - - template > - static inline kj::Own from(Pipeline&& pipeline); - -private: - template struct FromImpl; -}; - -#endif // !CAPNP_LITE - -// ======================================================================================= -// Inline implementation details - -inline MessageSize AnyPointer::Reader::targetSize() const { - return reader.targetSize().asPublic(); -} - -inline PointerType AnyPointer::Reader::getPointerType() const { - return reader.getPointerType(); -} - -template -inline ReaderFor AnyPointer::Reader::getAs() const { - return _::PointerHelpers::get(reader); -} - -inline MessageSize AnyPointer::Builder::targetSize() const { - return asReader().targetSize(); -} - -inline PointerType AnyPointer::Builder::getPointerType() { - return builder.getPointerType(); -} - -inline void AnyPointer::Builder::clear() { - return builder.clear(); -} - -template -inline BuilderFor AnyPointer::Builder::getAs() { - return _::PointerHelpers::get(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs() { - return _::PointerHelpers::init(builder); -} - -template -inline BuilderFor AnyPointer::Builder::initAs(uint elementCount) { - return _::PointerHelpers::init(builder, elementCount); -} - -inline AnyList::Builder AnyPointer::Builder::initAsAnyList( - ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList(elementSize, bounded(elementCount) * ELEMENTS)); -} - -inline List::Builder AnyPointer::Builder::initAsListOfAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return List::Builder(builder.initStructList(bounded(elementCount) * ELEMENTS, - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -inline AnyStruct::Builder AnyPointer::Builder::initAsAnyStruct( - uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - _::StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); -} - -template -inline void AnyPointer::Builder::setAs(ReaderFor value) { - return _::PointerHelpers::set(builder, value); -} - -template -inline void AnyPointer::Builder::setCanonicalAs(ReaderFor value) { - return _::PointerHelpers::setCanonical(builder, value); -} - -template -inline void AnyPointer::Builder::setAs( - std::initializer_list>> list) { - return _::PointerHelpers::set(builder, list); -} - -template -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - _::PointerHelpers::adopt(builder, kj::mv(orphan)); -} - -template -inline Orphan AnyPointer::Builder::disownAs() { - return _::PointerHelpers::disown(builder); -} - -inline Orphan AnyPointer::Builder::disown() { - return Orphan(builder.disown()); -} - -template <> struct ReaderFor_ { typedef AnyPointer::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyPointer::Builder Type; }; -template <> struct ReaderFor_ { typedef AnyStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef AnyStruct::Builder Type; }; - -template <> -struct Orphanage::GetInnerReader { - static inline _::PointerReader apply(const AnyPointer::Reader& t) { - return t.reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::PointerBuilder apply(AnyPointer::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const AnyStruct::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(AnyStruct::Builder& t) { - return t._builder; - } -}; - -template <> -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const AnyList::Reader& t) { - return t._reader; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(AnyList::Builder& t) { - return t._builder; - } -}; - -template -inline BuilderFor Orphan::getAs() { - return _::OrphanGetImpl::apply(builder); -} -template -inline ReaderFor Orphan::getAsReader() const { - return _::OrphanGetImpl::applyReader(builder); -} -template -inline Orphan Orphan::releaseAs() { - return Orphan(kj::mv(builder)); -} - -// Using AnyPointer as the template type should work... - -template <> -inline typename AnyPointer::Reader AnyPointer::Reader::getAs() const { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::getAs() { - return *this; -} -template <> -inline typename AnyPointer::Builder AnyPointer::Builder::initAs() { - clear(); - return *this; -} -template <> -inline void AnyPointer::Builder::setAs(AnyPointer::Reader value) { - return builder.copyFrom(value.reader); -} -template <> -inline void AnyPointer::Builder::adopt(Orphan&& orphan) { - builder.adopt(kj::mv(orphan.builder)); -} -template <> -inline Orphan AnyPointer::Builder::disownAs() { - return Orphan(builder.disown()); -} -template <> -inline Orphan Orphan::releaseAs() { - return kj::mv(*this); -} - -namespace _ { // private - -// Specialize PointerHelpers for AnyPointer. - -template <> -struct PointerHelpers { - static inline AnyPointer::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Reader(reader); - } - static inline AnyPointer::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return AnyPointer::Builder(builder); - } - static inline void set(PointerBuilder builder, AnyPointer::Reader value) { - AnyPointer::Builder(builder).set(value); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::PointerReader getInternalReader(const AnyPointer::Reader& reader) { - return reader.reader; - } - static inline _::PointerBuilder getInternalBuilder(AnyPointer::Builder&& builder) { - return builder.builder; - } -}; - -template <> -struct PointerHelpers { - static inline AnyStruct::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyStruct::Reader(reader.getStruct(defaultValue)); - } - static inline AnyStruct::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - // TODO(someday): Allow specifying the size somehow? - return AnyStruct::Builder(builder.getStruct( - _::StructSize(ZERO * WORDS, ZERO * POINTERS), defaultValue)); - } - static inline void set(PointerBuilder builder, AnyStruct::Reader value) { - builder.setStruct(value._reader); - } - static inline AnyStruct::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount) { - return AnyStruct::Builder(builder.initStruct( - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct PointerHelpers { - static inline AnyList::Reader get( - PointerReader reader, const word* defaultValue = nullptr) { - return AnyList::Reader(reader.getListAnySize(defaultValue)); - } - static inline AnyList::Builder get( - PointerBuilder builder, const word* defaultValue = nullptr) { - return AnyList::Builder(builder.getListAnySize(defaultValue)); - } - static inline void set(PointerBuilder builder, AnyList::Reader value) { - builder.setList(value._reader); - } - static inline AnyList::Builder init( - PointerBuilder builder, ElementSize elementSize, uint elementCount) { - return AnyList::Builder(builder.initList( - elementSize, bounded(elementCount) * ELEMENTS)); - } - static inline AnyList::Builder init( - PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) { - return AnyList::Builder(builder.initStructList( - bounded(elementCount) * ELEMENTS, - StructSize(bounded(dataWordCount) * WORDS, - bounded(pointerCount) * POINTERS))); - } - - static void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyStruct::Builder apply(_::OrphanBuilder& builder) { - return AnyStruct::Builder(builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline AnyStruct::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyStruct::Reader(builder.asStructReader(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::StructSize(ZERO * WORDS, ZERO * POINTERS)); - } -}; - -template <> -struct OrphanGetImpl { - static inline AnyList::Builder apply(_::OrphanBuilder& builder) { - return AnyList::Builder(builder.asListAnySize()); - } - static inline AnyList::Reader applyReader(const _::OrphanBuilder& builder) { - return AnyList::Reader(builder.asListReaderAnySize()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -} // namespace _ (private) - -#if !CAPNP_LITE - -template -struct PipelineHook::FromImpl { - static inline kj::Own apply(typename T::Pipeline&& pipeline) { - return from(kj::mv(pipeline._typeless)); - } -}; - -template <> -struct PipelineHook::FromImpl { - static inline kj::Own apply(AnyPointer::Pipeline&& pipeline) { - return kj::mv(pipeline.hook); - } -}; - -template -inline kj::Own PipelineHook::from(Pipeline&& pipeline) { - return FromImpl::apply(kj::fwd(pipeline)); -} - -#endif // !CAPNP_LITE - -} // namespace capnp - -#endif // CAPNP_ANY_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/blob.h b/phonelibs/capnp-cpp/mac/include/capnp/blob.h deleted file mode 100644 index d11f101a5a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/blob.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_BLOB_H_ -#define CAPNP_BLOB_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include - -namespace capnp { - -struct Data { - Data() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -struct Text { - Text() = delete; - class Reader; - class Builder; - class Pipeline {}; -}; - -class Data::Reader: public kj::ArrayPtr { - // Points to a blob of bytes. The usual Reader rules apply -- Data::Reader behaves like a simple - // pointer which does not own its target, can be passed by value, etc. - -public: - typedef Data Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Reader(const byte* value, size_t size): ArrayPtr(value, size) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} - inline Reader(const kj::Array& value): ArrayPtr(value) {} - inline Reader(const ArrayPtr& value): ArrayPtr(value) {} -}; - -class Text::Reader: public kj::StringPtr { - // Like Data::Reader, but points at NUL-terminated UTF-8 text. The NUL terminator is not counted - // in the size but must be present immediately after the last byte. - // - // Text::Reader's interface contract is that its data MUST be NUL-terminated. The producer of - // the Text::Reader must guarantee this, so that the consumer need not check. The data SHOULD - // also be valid UTF-8, but this is NOT guaranteed -- the consumer must verify if it cares. - -public: - typedef Text Reads; - - Reader() = default; - inline Reader(decltype(nullptr)): StringPtr(nullptr) {} - inline Reader(const char* value): StringPtr(value) {} - inline Reader(const char* value, size_t size): StringPtr(value, size) {} - inline Reader(const kj::String& value): StringPtr(value) {} - inline Reader(const StringPtr& value): StringPtr(value) {} - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline Reader(const T& t): StringPtr(t) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif -}; - -class Data::Builder: public kj::ArrayPtr { - // Like Data::Reader except the pointers aren't const. - -public: - typedef Data Builds; - - Builder() = default; - inline Builder(decltype(nullptr)): ArrayPtr(nullptr) {} - inline Builder(byte* value, size_t size): ArrayPtr(value, size) {} - inline Builder(kj::Array& value): ArrayPtr(value) {} - inline Builder(ArrayPtr value): ArrayPtr(value) {} - - inline Data::Reader asReader() const { return Data::Reader(*this); } - inline operator Reader() const { return asReader(); } -}; - -class Text::Builder: public kj::DisallowConstCopy { - // Basically identical to kj::StringPtr, except that the contents are non-const. - -public: - inline Builder(): content(nulstr, 1) {} - inline Builder(decltype(nullptr)): content(nulstr, 1) {} - inline Builder(char* value): content(value, strlen(value) + 1) {} - inline Builder(char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - - inline Reader asReader() const { return Reader(content.begin(), content.size() - 1); } - inline operator Reader() const { return asReader(); } - - inline operator kj::ArrayPtr(); - inline kj::ArrayPtr asArray(); - inline operator kj::ArrayPtr() const; - inline kj::ArrayPtr asArray() const; - inline kj::ArrayPtr asBytes() { return asArray().asBytes(); } - inline kj::ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline operator kj::StringPtr() const; - inline kj::StringPtr asString() const; - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - inline char& operator[](size_t index) { return content[index]; } - - inline char* begin() { return content.begin(); } - inline char* end() { return content.end() - 1; } - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(Builder other) const { return asString() == other.asString(); } - inline bool operator!=(Builder other) const { return asString() != other.asString(); } - inline bool operator< (Builder other) const { return asString() < other.asString(); } - inline bool operator> (Builder other) const { return asString() > other.asString(); } - inline bool operator<=(Builder other) const { return asString() <= other.asString(); } - inline bool operator>=(Builder other) const { return asString() >= other.asString(); } - - inline kj::StringPtr slice(size_t start) const; - inline kj::ArrayPtr slice(size_t start, size_t end) const; - inline Builder slice(size_t start); - inline kj::ArrayPtr slice(size_t start, size_t end); - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - -private: - inline explicit Builder(kj::ArrayPtr content): content(content) {} - - kj::ArrayPtr content; - - static char nulstr[1]; -}; - -inline kj::StringPtr KJ_STRINGIFY(Text::Builder builder) { - return builder.asString(); -} - -inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); } -inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); } - -inline Text::Builder::operator kj::StringPtr() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline kj::StringPtr Text::Builder::asString() const { - return kj::StringPtr(content.begin(), content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() { - return content.slice(0, content.size() - 1); -} - -inline Text::Builder::operator kj::ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline kj::ArrayPtr Text::Builder::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline kj::StringPtr Text::Builder::slice(size_t start) const { - return asReader().slice(start); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline Text::Builder Text::Builder::slice(size_t start) { - return Text::Builder(content.slice(start, content.size())); -} -inline kj::ArrayPtr Text::Builder::slice(size_t start, size_t end) { - return content.slice(start, end); -} - -} // namespace capnp - -#endif // CAPNP_BLOB_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp b/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp deleted file mode 100644 index 2bda547179..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xbdf87d7bb8304e81; -$namespace("capnp::annotations"); - -annotation namespace(file): Text; -annotation name(field, enumerant, struct, enum, interface, method, param, group, union): Text; diff --git a/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp.h deleted file mode 100644 index 6d9817fbde..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/c++.capnp.h +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: c++.capnp - -#ifndef CAPNP_INCLUDED_bdf87d7bb8304e81_ -#define CAPNP_INCLUDED_bdf87d7bb8304e81_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(b9c6f99ebf805f2c); -CAPNP_DECLARE_SCHEMA(f264a779fef191ce); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace annotations { - -// ======================================================================================= - -// ======================================================================================= - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_bdf87d7bb8304e81_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/capability.h b/phonelibs/capnp-cpp/mac/include/capnp/capability.h deleted file mode 100644 index 56a5e6f6de..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/capability.h +++ /dev/null @@ -1,884 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_CAPABILITY_H_ -#define CAPNP_CAPABILITY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "RPC APIs, including this header, are not available in lite mode." -#endif - -#include -#include -#include "raw-schema.h" -#include "any.h" -#include "pointer-helpers.h" - -namespace capnp { - -template -class Response; - -template -class RemotePromise: public kj::Promise>, public T::Pipeline { - // A Promise which supports pipelined calls. T is typically a struct type. T must declare - // an inner "mix-in" type "Pipeline" which implements pipelining; RemotePromise simply - // multiply-inherits that type along with Promise>. T::Pipeline must be movable, - // but does not need to be copyable (i.e. just like Promise). - // - // The promise is for an owned pointer so that the RPC system can allocate the MessageReader - // itself. - -public: - inline RemotePromise(kj::Promise>&& promise, typename T::Pipeline&& pipeline) - : kj::Promise>(kj::mv(promise)), - T::Pipeline(kj::mv(pipeline)) {} - inline RemotePromise(decltype(nullptr)) - : kj::Promise>(nullptr), - T::Pipeline(nullptr) {} - KJ_DISALLOW_COPY(RemotePromise); - RemotePromise(RemotePromise&& other) = default; - RemotePromise& operator=(RemotePromise&& other) = default; -}; - -class LocalClient; -namespace _ { // private -extern const RawSchema NULL_INTERFACE_SCHEMA; // defined in schema.c++ -class CapabilityServerSetBase; -} // namespace _ (private) - -struct Capability { - // A capability without type-safe methods. Typed capability clients wrap `Client` and typed - // capability servers subclass `Server` to dispatch to the regular, typed methods. - - class Client; - class Server; - - struct _capnpPrivate { - struct IsInterface; - static constexpr uint64_t typeId = 0x3; - static constexpr Kind kind = Kind::INTERFACE; - static constexpr _::RawSchema const* schema = &_::NULL_INTERFACE_SCHEMA; - - static const _::RawBrandedSchema* brand() { - return &_::NULL_INTERFACE_SCHEMA.defaultBrand; - } - }; -}; - -// ======================================================================================= -// Capability clients - -class RequestHook; -class ResponseHook; -class PipelineHook; -class ClientHook; - -template -class Request: public Params::Builder { - // A call that hasn't been sent yet. This class extends a Builder for the call's "Params" - // structure with a method send() that actually sends it. - // - // Given a Cap'n Proto method `foo(a :A, b :B): C`, the generated client interface will have - // a method `Request fooRequest()` (as well as a convenience method - // `RemotePromise foo(A::Reader a, B::Reader b)`). - -public: - inline Request(typename Params::Builder builder, kj::Own&& hook) - : Params::Builder(builder), hook(kj::mv(hook)) {} - inline Request(decltype(nullptr)): Params::Builder(nullptr) {} - - RemotePromise send() KJ_WARN_UNUSED_RESULT; - // Send the call and return a promise for the results. - -private: - kj::Own hook; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template -class Response: public Results::Reader { - // A completed call. This class extends a Reader for the call's answer structure. The Response - // is move-only -- once it goes out-of-scope, the underlying message will be freed. - -public: - inline Response(typename Results::Reader reader, kj::Own&& hook) - : Results::Reader(reader), hook(kj::mv(hook)) {} - -private: - kj::Own hook; - - template - friend class Request; - friend class ResponseHook; -}; - -class Capability::Client { - // Base type for capability clients. - -public: - typedef Capability Reads; - typedef Capability Calls; - - Client(decltype(nullptr)); - // If you need to declare a Client before you have anything to assign to it (perhaps because - // the assignment is going to occur in an if/else scope), you can start by initializing it to - // `nullptr`. The resulting client is not meant to be called and throws exceptions from all - // methods. - - template ()>> - Client(kj::Own&& server); - // Make a client capability that wraps the given server capability. The server's methods will - // only be executed in the given EventLoop, regardless of what thread calls the client's methods. - - template ()>> - Client(kj::Promise&& promise); - // Make a client from a promise for a future client. The resulting client queues calls until the - // promise resolves. - - Client(kj::Exception&& exception); - // Make a broken client that throws the given exception from all calls. - - Client(Client& other); - Client& operator=(Client& other); - // Copies by reference counting. Warning: This refcounting is not thread-safe. All copies of - // the client must remain in one thread. - - Client(Client&&) = default; - Client& operator=(Client&&) = default; - // Move constructor avoids reference counting. - - explicit Client(kj::Own&& hook); - // For use by the RPC implementation: Wrap a ClientHook. - - template - typename T::Client castAs(); - // Reinterpret the capability as implementing the given interface. Note that no error will occur - // here if the capability does not actually implement this interface, but later method calls will - // fail. It's up to the application to decide how indicate that additional interfaces are - // supported. - // - // TODO(perf): GCC 4.8 / Clang 3.3: rvalue-qualified version for better performance. - - template - typename T::Client castAs(InterfaceSchema schema); - // Dynamic version. `T` must be `DynamicCapability`, and you must `#include `. - - kj::Promise whenResolved(); - // If the capability is actually only a promise, the returned promise resolves once the - // capability itself has resolved to its final destination (or propagates the exception if - // the capability promise is rejected). This is mainly useful for error-checking in the case - // where no calls are being made. There is no reason to wait for this before making calls; if - // the capability does not resolve, the call results will propagate the error. - - Request typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - // Make a request without knowing the types of the params or results. You specify the type ID - // and method number manually. - - // TODO(someday): method(s) for Join - -protected: - Client() = default; - - template - Request newCall(uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint); - -private: - kj::Own hook; - - static kj::Own makeLocalClient(kj::Own&& server); - - template - friend struct _::PointerHelpers; - friend struct DynamicCapability; - friend class Orphanage; - friend struct DynamicStruct; - friend struct DynamicList; - template - friend struct List; - friend class _::CapabilityServerSetBase; - friend class ClientHook; -}; - -// ======================================================================================= -// Capability servers - -class CallContextHook; - -template -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - // - // The CallContext becomes invalid as soon as the call reports completion. - -public: - explicit CallContext(CallContextHook& hook); - - typename Params::Reader getParams(); - // Get the params payload. - - void releaseParams(); - // Release the params payload. getParams() will throw an exception after this is called. - // Releasing the params may allow the RPC system to free up buffer space to handle other - // requests. Long-running asynchronous methods should try to call this as early as is - // convenient. - - typename Results::Builder getResults(kj::Maybe sizeHint = nullptr); - typename Results::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(typename Results::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - // Manipulate the results payload. The "Return" message (part of the RPC protocol) will - // typically be allocated the first time one of these is called. Some RPC systems may - // allocate these messages in a limited space (such as a shared memory segment), therefore the - // application should delay calling these as long as is convenient to do so (but don't delay - // if doing so would require extra copies later). - // - // `sizeHint` indicates a guess at the message size. This will usually be used to decide how - // much space to allocate for the first message segment (don't worry: only space that is actually - // used will be sent on the wire). If omitted, the system decides. The message root pointer - // should not be included in the size. So, if you are simply going to copy some existing message - // directly into the results, just call `.totalSize()` and pass that in. - - template - kj::Promise tailCall(Request&& tailRequest); - // Resolve the call by making a tail call. `tailRequest` is a request that has been filled in - // but not yet sent. The context will send the call, then fill in the results with the result - // of the call. If tailCall() is used, {get,init,set,adopt}Results (above) *must not* be called. - // - // The RPC implementation may be able to optimize a tail call to another machine such that the - // results never actually pass through this machine. Even if no such optimization is possible, - // `tailCall()` may allow pipelined calls to be forwarded optimistically to the new call site. - // - // In general, this should be the last thing a method implementation calls, and the promise - // returned from `tailCall()` should then be returned by the method implementation. - - void allowCancellation(); - // Indicate that it is OK for the RPC system to discard its Promise for this call's result if - // the caller cancels the call, thereby transitively canceling any asynchronous operations the - // call implementation was performing. This is not done by default because it could represent a - // security risk: applications must be carefully written to ensure that they do not end up in - // a bad state if an operation is canceled at an arbitrary point. However, for long-running - // method calls that hold significant resources, prompt cancellation is often useful. - // - // Keep in mind that asynchronous cancellation cannot occur while the method is synchronously - // executing on a local thread. The method must perform an asynchronous operation or call - // `EventLoop::current().evalLater()` to yield control. - // - // Note: You might think that we should offer `onCancel()` and/or `isCanceled()` methods that - // provide notification when the caller cancels the request without forcefully killing off the - // promise chain. Unfortunately, this composes poorly with promise forking: the canceled - // path may be just one branch of a fork of the result promise. The other branches still want - // the call to continue. Promise forking is used within the Cap'n Proto implementation -- in - // particular each pipelined call forks the result promise. So, if a caller made a pipelined - // call and then dropped the original object, the call should not be canceled, but it would be - // excessively complicated for the framework to avoid notififying of cancellation as long as - // pipelined calls still exist. - -private: - CallContextHook* hook; - - friend class Capability::Server; - friend struct DynamicCapability; -}; - -class Capability::Server { - // Objects implementing a Cap'n Proto interface must subclass this. Typically, such objects - // will instead subclass a typed Server interface which will take care of implementing - // dispatchCall(). - -public: - typedef Capability Serves; - - virtual kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) = 0; - // Call the given method. `params` is the input struct, and should be released as soon as it - // is no longer needed. `context` may be used to allocate the output struct and deal with - // cancellation. - - // TODO(someday): Method which can optionally be overridden to implement Join when the object is - // a proxy. - -protected: - inline Capability::Client thisCap(); - // Get a capability pointing to this object, much like the `this` keyword. - // - // The effect of this method is undefined if: - // - No capability client has been created pointing to this object. (This is always the case in - // the server's constructor.) - // - The capability client pointing at this object has been destroyed. (This is always the case - // in the server's destructor.) - // - Multiple capability clients have been created around the same server (possible if the server - // is refcounted, which is not recommended since the client itself provides refcounting). - - template - CallContext internalGetTypedContext( - CallContext typeless); - kj::Promise internalUnimplemented(const char* actualInterfaceName, - uint64_t requestedTypeId); - kj::Promise internalUnimplemented(const char* interfaceName, - uint64_t typeId, uint16_t methodId); - kj::Promise internalUnimplemented(const char* interfaceName, const char* methodName, - uint64_t typeId, uint16_t methodId); - -private: - ClientHook* thisHook = nullptr; - friend class LocalClient; -}; - -// ======================================================================================= - -class ReaderCapabilityTable: private _::CapTableReader { - // Class which imbues Readers with the ability to read capabilities. - // - // In Cap'n Proto format, the encoding of a capability pointer is simply an integer index into - // an external table. Since these pointers fundamentally point outside the message, a - // MessageReader by default has no idea what they point at, and therefore reading capabilities - // from such a reader will throw exceptions. - // - // In order to be able to read capabilities, you must first attach a capability table, using - // this class. By "imbuing" a Reader, you get a new Reader which will interpret capability - // pointers by treating them as indexes into the ReaderCapabilityTable. - // - // Note that when using Cap'n Proto's RPC system, this is handled automatically. - -public: - explicit ReaderCapabilityTable(kj::Array>> table); - KJ_DISALLOW_COPY(ReaderCapabilityTable); - - template - T imbue(T reader); - // Return a reader equivalent to `reader` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Array>> table; - - kj::Maybe> extractCap(uint index) override; -}; - -class BuilderCapabilityTable: private _::CapTableBuilder { - // Class which imbues Builders with the ability to read and write capabilities. - // - // This is much like ReaderCapabilityTable, except for builders. The table starts out empty, - // but capabilities can be added to it over time. - -public: - BuilderCapabilityTable(); - KJ_DISALLOW_COPY(BuilderCapabilityTable); - - inline kj::ArrayPtr>> getTable() { return table; } - - template - T imbue(T builder); - // Return a builder equivalent to `builder` except that when reading capability-valued fields, - // the capabilities are looked up in this table. - -private: - kj::Vector>> table; - - kj::Maybe> extractCap(uint index) override; - uint injectCap(kj::Own&& cap) override; - void dropCap(uint index) override; -}; - -// ======================================================================================= - -namespace _ { // private - -class CapabilityServerSetBase { -public: - Capability::Client addInternal(kj::Own&& server, void* ptr); - kj::Promise getLocalServerInternal(Capability::Client& client); -}; - -} // namespace _ (private) - -template -class CapabilityServerSet: private _::CapabilityServerSetBase { - // Allows a server to recognize its own capabilities when passed back to it, and obtain the - // underlying Server objects associated with them. - // - // All objects in the set must have the same interface type T. The objects may implement various - // interfaces derived from T (and in fact T can be `capnp::Capability` to accept all objects), - // but note that if you compile with RTTI disabled then you will not be able to down-cast through - // virtual inheritance, and all inheritance between server interfaces is virtual. So, with RTTI - // disabled, you will likely need to set T to be the most-derived Cap'n Proto interface type, - // and you server class will need to be directly derived from that, so that you can use - // static_cast (or kj::downcast) to cast to it after calling getLocalServer(). (If you compile - // with RTTI, then you can freely dynamic_cast and ignore this issue!) - -public: - CapabilityServerSet() = default; - KJ_DISALLOW_COPY(CapabilityServerSet); - - typename T::Client add(kj::Own&& server); - // Create a new capability Client for the given Server and also add this server to the set. - - kj::Promise> getLocalServer(typename T::Client& client); - // Given a Client pointing to a server previously passed to add(), return the corresponding - // Server. This returns a promise because if the input client is itself a promise, this must - // wait for it to resolve. Keep in mind that the server will be deleted when all clients are - // gone, so the caller should make sure to keep the client alive (hence why this method only - // accepts an lvalue input). -}; - -// ======================================================================================= -// Hook interfaces which must be implemented by the RPC system. Applications never call these -// directly; the RPC system implements them and the types defined earlier in this file wrap them. - -class RequestHook { - // Hook interface implemented by RPC system representing a request being built. - -public: - virtual RemotePromise send() = 0; - // Send the call and return a promise for the result. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this request. This can be used by an RPC adapter to - // discover when tail call is going to be sent over its own connection and therefore can be - // optimized into a remote tail call. - - template - inline static kj::Own from(Request&& request) { - return kj::mv(request.hook); - } -}; - -class ResponseHook { - // Hook interface implemented by RPC system representing a response. - // - // At present this class has no methods. It exists only for garbage collection -- when the - // ResponseHook is destroyed, the results can be freed. - -public: - virtual ~ResponseHook() noexcept(false); - // Just here to make sure the type is dynamic. - - template - inline static kj::Own from(Response&& response) { - return kj::mv(response.hook); - } -}; - -// class PipelineHook is declared in any.h because it is needed there. - -class ClientHook { -public: - ClientHook(); - - virtual Request newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) = 0; - // Start a new call, allowing the client to allocate request/response objects as it sees fit. - // This version is used when calls are made from application code in the local process. - - struct VoidPromiseAndPipeline { - kj::Promise promise; - kj::Own pipeline; - }; - - virtual VoidPromiseAndPipeline call(uint64_t interfaceId, uint16_t methodId, - kj::Own&& context) = 0; - // Call the object, but the caller controls allocation of the request/response objects. If the - // callee insists on allocating these objects itself, it must make a copy. This version is used - // when calls come in over the network via an RPC system. Note that even if the returned - // `Promise` is discarded, the call may continue executing if any pipelined calls are - // waiting for it. - // - // Since the caller of this method chooses the CallContext implementation, it is the caller's - // responsibility to ensure that the returned promise is not canceled unless allowed via - // the context's `allowCancellation()`. - // - // The call must not begin synchronously; the callee must arrange for the call to begin in a - // later turn of the event loop. Otherwise, application code may call back and affect the - // callee's state in an unexpected way. - - virtual kj::Maybe getResolved() = 0; - // If this ClientHook is a promise that has already resolved, returns the inner, resolved version - // of the capability. The caller may permanently replace this client with the resolved one if - // desired. Returns null if the client isn't a promise or hasn't resolved yet -- use - // `whenMoreResolved()` to distinguish between them. - - virtual kj::Maybe>> whenMoreResolved() = 0; - // If this client is a settled reference (not a promise), return nullptr. Otherwise, return a - // promise that eventually resolves to a new client that is closer to being the final, settled - // client (i.e. the value eventually returned by `getResolved()`). Calling this repeatedly - // should eventually produce a settled client. - - kj::Promise whenResolved(); - // Repeatedly calls whenMoreResolved() until it returns nullptr. - - virtual kj::Own addRef() = 0; - // Return a new reference to the same capability. - - virtual const void* getBrand() = 0; - // Returns a void* that identifies who made this client. This can be used by an RPC adapter to - // discover when a capability it needs to marshal is one that it created in the first place, and - // therefore it can transfer the capability without proxying. - - static const uint NULL_CAPABILITY_BRAND; - // Value is irrelevant; used for pointer. - - inline bool isNull() { return getBrand() == &NULL_CAPABILITY_BRAND; } - // Returns true if the capability was created as a result of assigning a Client to null or by - // reading a null pointer out of a Cap'n Proto message. - - virtual void* getLocalServer(_::CapabilityServerSetBase& capServerSet); - // If this is a local capability created through `capServerSet`, return the underlying Server. - // Otherwise, return nullptr. Default implementation (which everyone except LocalClient should - // use) always returns nullptr. - - static kj::Own from(Capability::Client client) { return kj::mv(client.hook); } -}; - -class CallContextHook { - // Hook interface implemented by RPC system to manage a call on the server side. See - // CallContext. - -public: - virtual AnyPointer::Reader getParams() = 0; - virtual void releaseParams() = 0; - virtual AnyPointer::Builder getResults(kj::Maybe sizeHint) = 0; - virtual kj::Promise tailCall(kj::Own&& request) = 0; - virtual void allowCancellation() = 0; - - virtual kj::Promise onTailCall() = 0; - // If `tailCall()` is called, resolves to the PipelineHook from the tail call. An - // implementation of `ClientHook::call()` is allowed to call this at most once. - - virtual ClientHook::VoidPromiseAndPipeline directTailCall(kj::Own&& request) = 0; - // Call this when you would otherwise call onTailCall() immediately followed by tailCall(). - // Implementations of tailCall() should typically call directTailCall() and then fulfill the - // promise fulfiller for onTailCall() with the returned pipeline. - - virtual kj::Own addRef() = 0; -}; - -kj::Own newLocalPromiseClient(kj::Promise>&& promise); -// Returns a ClientHook that queues up calls until `promise` resolves, then forwards them to -// the new client. This hook's `getResolved()` and `whenMoreResolved()` methods will reflect the -// redirection to the eventual replacement client. - -kj::Own newLocalPromisePipeline(kj::Promise>&& promise); -// Returns a PipelineHook that queues up calls until `promise` resolves, then forwards them to -// the new pipeline. - -kj::Own newBrokenCap(kj::StringPtr reason); -kj::Own newBrokenCap(kj::Exception&& reason); -// Helper function that creates a capability which simply throws exceptions when called. - -kj::Own newBrokenPipeline(kj::Exception&& reason); -// Helper function that creates a pipeline which simply throws exceptions when called. - -Request newBrokenRequest( - kj::Exception&& reason, kj::Maybe sizeHint); -// Helper function that creates a Request object that simply throws exceptions when sent. - -// ======================================================================================= -// Extend PointerHelpers for interfaces - -namespace _ { // private - -template -struct PointerHelpers { - static inline typename T::Client get(PointerReader reader) { - return typename T::Client(reader.getCapability()); - } - static inline typename T::Client get(PointerBuilder builder) { - return typename T::Client(builder.getCapability()); - } - static inline void set(PointerBuilder builder, typename T::Client&& value) { - builder.setCapability(kj::mv(value.Capability::Client::hook)); - } - static inline void set(PointerBuilder builder, typename T::Client& value) { - builder.setCapability(value.Capability::Client::hook->addRef()); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -} // namespace _ (private) - -// ======================================================================================= -// Extend List for interfaces - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Client(reader.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - Builder() = delete; - inline Builder(decltype(nullptr)) {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Client operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Client(builder.getPointerElement( - bounded(index) * ELEMENTS).getCapability()); - } - inline void set(uint index, typename T::Client value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setCapability(kj::mv(value.hook)); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -// ======================================================================================= -// Inline implementation details - -template -RemotePromise Request::send() { - auto typelessPromise = hook->send(); - hook = nullptr; // prevent reuse - - // Convert the Promise to return the correct response type. - // Explicitly upcast to kj::Promise to make clear that calling .then() doesn't invalidate the - // Pipeline part of the RemotePromise. - auto typedPromise = kj::implicitCast>&>(typelessPromise) - .then([](Response&& response) -> Response { - return Response(response.getAs(), kj::mv(response.hook)); - }); - - // Wrap the typeless pipeline in a typed wrapper. - typename Results::Pipeline typedPipeline( - kj::mv(kj::implicitCast(typelessPromise))); - - return RemotePromise(kj::mv(typedPromise), kj::mv(typedPipeline)); -} - -inline Capability::Client::Client(kj::Own&& hook): hook(kj::mv(hook)) {} -template -inline Capability::Client::Client(kj::Own&& server) - : hook(makeLocalClient(kj::mv(server))) {} -template -inline Capability::Client::Client(kj::Promise&& promise) - : hook(newLocalPromiseClient(promise.then([](T&& t) { return kj::mv(t.hook); }))) {} -inline Capability::Client::Client(Client& other): hook(other.hook->addRef()) {} -inline Capability::Client& Capability::Client::operator=(Client& other) { - hook = other.hook->addRef(); - return *this; -} -template -inline typename T::Client Capability::Client::castAs() { - return typename T::Client(hook->addRef()); -} -inline kj::Promise Capability::Client::whenResolved() { - return hook->whenResolved(); -} -inline Request Capability::Client::typelessRequest( - uint64_t interfaceId, uint16_t methodId, - kj::Maybe sizeHint) { - return newCall(interfaceId, methodId, sizeHint); -} -template -inline Request Capability::Client::newCall( - uint64_t interfaceId, uint16_t methodId, kj::Maybe sizeHint) { - auto typeless = hook->newCall(interfaceId, methodId, sizeHint); - return Request(typeless.template getAs(), kj::mv(typeless.hook)); -} - -template -inline CallContext::CallContext(CallContextHook& hook): hook(&hook) {} -template -inline typename Params::Reader CallContext::getParams() { - return hook->getParams().template getAs(); -} -template -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -template -inline typename Results::Builder CallContext::getResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template getAs(); -} -template -inline typename Results::Builder CallContext::initResults( - kj::Maybe sizeHint) { - // `template` keyword needed due to: http://llvm.org/bugs/show_bug.cgi?id=17401 - return hook->getResults(sizeHint).template initAs(); -} -template -inline void CallContext::setResults(typename Results::Reader value) { - hook->getResults(value.totalSize()).template setAs(value); -} -template -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(nullptr).adopt(kj::mv(value)); -} -template -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -template -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template -CallContext Capability::Server::internalGetTypedContext( - CallContext typeless) { - return CallContext(*typeless.hook); -} - -Capability::Client Capability::Server::thisCap() { - return Client(thisHook->addRef()); -} - -template -T ReaderCapabilityTable::imbue(T reader) { - return T(_::PointerHelpers>::getInternalReader(reader).imbue(this)); -} - -template -T BuilderCapabilityTable::imbue(T builder) { - return T(_::PointerHelpers>::getInternalBuilder(kj::mv(builder)).imbue(this)); -} - -template -typename T::Client CapabilityServerSet::add(kj::Own&& server) { - void* ptr = reinterpret_cast(server.get()); - // Clang insists that `castAs` is a template-dependent member and therefore we need the - // `template` keyword here, but AFAICT this is wrong: addImpl() is not a template. - return addInternal(kj::mv(server), ptr).template castAs(); -} - -template -kj::Promise> CapabilityServerSet::getLocalServer( - typename T::Client& client) { - return getLocalServerInternal(client) - .then([](void* server) -> kj::Maybe { - if (server == nullptr) { - return nullptr; - } else { - return *reinterpret_cast(server); - } - }); -} - -template -struct Orphanage::GetInnerReader { - static inline kj::Own apply(typename T::Client t) { - return ClientHook::from(kj::mv(t)); - } -}; - -} // namespace capnp - -#endif // CAPNP_CAPABILITY_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/common.h b/phonelibs/capnp-cpp/mac/include/capnp/common.h deleted file mode 100644 index 3fc7a42112..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/common.h +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef CAPNP_COMMON_H_ -#define CAPNP_COMMON_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include - -#if CAPNP_DEBUG_TYPES -#include -#endif - -namespace capnp { - -#define CAPNP_VERSION_MAJOR 0 -#define CAPNP_VERSION_MINOR 6 -#define CAPNP_VERSION_MICRO 1 - -#define CAPNP_VERSION \ - (CAPNP_VERSION_MAJOR * 1000000 + CAPNP_VERSION_MINOR * 1000 + CAPNP_VERSION_MICRO) - -#ifndef CAPNP_LITE -#define CAPNP_LITE 0 -#endif - -typedef unsigned int uint; - -struct Void { - // Type used for Void fields. Using C++'s "void" type creates a bunch of issues since it behaves - // differently from other types. - - inline constexpr bool operator==(Void other) const { return true; } - inline constexpr bool operator!=(Void other) const { return false; } -}; - -static constexpr Void VOID = Void(); -// Constant value for `Void`, which is an empty struct. - -inline kj::StringPtr KJ_STRINGIFY(Void) { return "void"; } - -struct Text; -struct Data; - -enum class Kind: uint8_t { - PRIMITIVE, - BLOB, - ENUM, - STRUCT, - UNION, - INTERFACE, - LIST, - - OTHER - // Some other type which is often a type parameter to Cap'n Proto templates, but which needs - // special handling. This includes types like AnyPointer, Dynamic*, etc. -}; - -enum class Style: uint8_t { - PRIMITIVE, - POINTER, // other than struct - STRUCT, - CAPABILITY -}; - -enum class ElementSize: uint8_t { - // Size of a list element. - - VOID = 0, - BIT = 1, - BYTE = 2, - TWO_BYTES = 3, - FOUR_BYTES = 4, - EIGHT_BYTES = 5, - - POINTER = 6, - - INLINE_COMPOSITE = 7 -}; - -enum class PointerType { - // Various wire types a pointer field can take - - NULL_, - // Should be NULL, but that's #defined in stddef.h - - STRUCT, - LIST, - CAPABILITY -}; - -namespace schemas { - -template -struct EnumInfo; - -} // namespace schemas - -namespace _ { // private - -template struct Kind_; - -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::PRIMITIVE; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::BLOB; }; - -template struct Kind_> { - static constexpr Kind kind = Kind::STRUCT; -}; -template struct Kind_> { - static constexpr Kind kind = Kind::INTERFACE; -}; -template struct Kind_::IsEnum>> { - static constexpr Kind kind = Kind::ENUM; -}; - -} // namespace _ (private) - -template ::kind> -inline constexpr Kind kind() { - // This overload of kind() matches types which have a Kind_ specialization. - - return k; -} - -#if _MSC_VER - -#define CAPNP_KIND(T) ::capnp::_::Kind_::kind -// Avoid constexpr methods in MSVC (it remains buggy in many situations). - -#else // _MSC_VER - -#define CAPNP_KIND(T) ::capnp::kind() -// Use this macro rather than kind() in any code which must work in MSVC. - -#endif // _MSC_VER, else - -#if !CAPNP_LITE - -template ()> -inline constexpr Style style() { - return k == Kind::PRIMITIVE || k == Kind::ENUM ? Style::PRIMITIVE - : k == Kind::STRUCT ? Style::STRUCT - : k == Kind::INTERFACE ? Style::CAPABILITY : Style::POINTER; -} - -#endif // !CAPNP_LITE - -template -struct List; - -#if _MSC_VER - -template -struct List {}; -// For some reason, without this declaration, MSVC will error out on some uses of List -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -template struct ListElementType_; -template struct ListElementType_> { typedef T Type; }; -template using ListElementType = typename ListElementType_::Type; - -namespace _ { // private -template struct Kind_> { - static constexpr Kind kind = Kind::LIST; -}; -} // namespace _ (private) - -template struct ReaderFor_ { typedef typename T::Reader Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef T Type; }; -template struct ReaderFor_ { typedef typename T::Client Type; }; -template using ReaderFor = typename ReaderFor_::Type; -// The type returned by List::Reader::operator[]. - -template struct BuilderFor_ { typedef typename T::Builder Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef T Type; }; -template struct BuilderFor_ { typedef typename T::Client Type; }; -template using BuilderFor = typename BuilderFor_::Type; -// The type returned by List::Builder::operator[]. - -template struct PipelineFor_ { typedef typename T::Pipeline Type;}; -template struct PipelineFor_ { typedef typename T::Client Type; }; -template using PipelineFor = typename PipelineFor_::Type; - -template struct TypeIfEnum_; -template struct TypeIfEnum_ { typedef T Type; }; - -template -using TypeIfEnum = typename TypeIfEnum_>::Type; - -template -using FromReader = typename kj::Decay::Reads; -// FromReader = MyType (for any Cap'n Proto type). - -template -using FromBuilder = typename kj::Decay::Builds; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromPipeline = typename kj::Decay::Pipelines; -// FromBuilder = MyType (for any Cap'n Proto type). - -template -using FromClient = typename kj::Decay::Calls; -// FromReader = MyType (for any Cap'n Proto interface type). - -template -using FromServer = typename kj::Decay::Serves; -// FromBuilder = MyType (for any Cap'n Proto interface type). - -template -struct FromAny_; - -template -struct FromAny_>> { - using Type = FromReader; -}; - -template -struct FromAny_>> { - using Type = FromBuilder; -}; - -template -struct FromAny_>> { - using Type = FromPipeline; -}; - -// Note that T::Client is covered by FromReader - -template -struct FromAny_, kj::VoidSfinae>> { - using Type = FromServer; -}; - -template -struct FromAny_::kind == Kind::PRIMITIVE || _::Kind_::kind == Kind::ENUM>> { - // TODO(msvc): Ideally the EnableIf condition would be `style() == Style::PRIMITIVE`, but MSVC - // cannot yet use style() in this constexpr context. - - using Type = kj::Decay; -}; - -template -using FromAny = typename FromAny_::Type; -// Given any Cap'n Proto value type as an input, return the Cap'n Proto base type. That is: -// -// Foo::Reader -> Foo -// Foo::Builder -> Foo -// Foo::Pipeline -> Foo -// Foo::Client -> Foo -// Own -> Foo -// uint32_t -> uint32_t - -namespace _ { // private - -template -struct PointerHelpers; - -#if _MSC_VER - -template -struct PointerHelpers {}; -// For some reason, without this declaration, MSVC will error out on some uses of PointerHelpers -// claiming that "T" -- as used in the default initializer for the second template param, "k" -- -// is not defined. I do not understand this error, but adding this empty default declaration fixes -// it. - -#endif - -} // namespace _ (private) - -struct MessageSize { - // Size of a message. Every struct type has a method `.totalSize()` that returns this. - uint64_t wordCount; - uint capCount; -}; - -// ======================================================================================= -// Raw memory types and measures - -using kj::byte; - -class word { uint64_t content KJ_UNUSED_MEMBER; KJ_DISALLOW_COPY(word); public: word() = default; }; -// word is an opaque type with size of 64 bits. This type is useful only to make pointer -// arithmetic clearer. Since the contents are private, the only way to access them is to first -// reinterpret_cast to some other pointer type. -// -// Copying is disallowed because you should always use memcpy(). Otherwise, you may run afoul of -// aliasing rules. -// -// A pointer of type word* should always be word-aligned even if won't actually be dereferenced as -// that type. - -static_assert(sizeof(byte) == 1, "uint8_t is not one byte?"); -static_assert(sizeof(word) == 8, "uint64_t is not 8 bytes?"); - -#if CAPNP_DEBUG_TYPES -// Set CAPNP_DEBUG_TYPES to 1 to use kj::Quantity for "count" types. Otherwise, plain integers are -// used. All the code should still operate exactly the same, we just lose compile-time checking. -// Note that this will also change symbol names, so it's important that the library and any clients -// be compiled with the same setting here. -// -// We disable this by default to reduce symbol name size and avoid any possibility of the compiler -// failing to fully-optimize the types, but anyone modifying Cap'n Proto itself should enable this -// during development and testing. - -namespace _ { class BitLabel; class ElementLabel; struct WirePointer; } - -template -using BitCountN = kj::Quantity(), T>, _::BitLabel>; -template -using ByteCountN = kj::Quantity(), T>, byte>; -template -using WordCountN = kj::Quantity(), T>, word>; -template -using ElementCountN = kj::Quantity(), T>, _::ElementLabel>; -template -using WirePointerCountN = kj::Quantity(), T>, _::WirePointer>; - -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::bounded; -using kj::unbound; -using kj::unboundAs; -using kj::unboundMax; -using kj::unboundMaxBits; -using kj::assertMax; -using kj::assertMaxBits; -using kj::upgradeBound; -using kj::ThrowOverflow; -using kj::assumeBits; -using kj::assumeMax; -using kj::subtractChecked; -using kj::trySubtract; - -template -inline constexpr U* operator+(U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+(const U* ptr, kj::Quantity offset) { - return ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator+=(U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator+=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr + unbound(offset / kj::unit>()); -} - -template -inline constexpr U* operator-(U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-(const U* ptr, kj::Quantity offset) { - return ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr U* operator-=(U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} -template -inline constexpr const U* operator-=(const U*& ptr, kj::Quantity offset) { - return ptr = ptr - unbound(offset / kj::unit>()); -} - -constexpr auto BITS = kj::unit>(); -constexpr auto BYTES = kj::unit>(); -constexpr auto WORDS = kj::unit>(); -constexpr auto ELEMENTS = kj::unit>(); -constexpr auto POINTERS = kj::unit>(); - -constexpr auto ZERO = kj::bounded<0>(); -constexpr auto ONE = kj::bounded<1>(); - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr auto BITS_PER_BYTE KJ_UNUSED = bounded<8>() * BITS / BYTES; -constexpr auto BITS_PER_WORD KJ_UNUSED = bounded<64>() * BITS / WORDS; -constexpr auto BYTES_PER_WORD KJ_UNUSED = bounded<8>() * BYTES / WORDS; - -constexpr auto BITS_PER_POINTER KJ_UNUSED = bounded<64>() * BITS / POINTERS; -constexpr auto BYTES_PER_POINTER KJ_UNUSED = bounded<8>() * BYTES / POINTERS; -constexpr auto WORDS_PER_POINTER KJ_UNUSED = ONE * WORDS / POINTERS; - -constexpr auto POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; - -constexpr auto MAX_SEGMENT_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_LIST_ELEMENTS = - bounded()>() * ELEMENTS; -constexpr auto MAX_STUCT_DATA_WORDS = - bounded()>() * WORDS; -constexpr auto MAX_STRUCT_POINTER_COUNT = - bounded()>() * POINTERS; - -using StructDataBitCount = decltype(WordCountN() * BITS_PER_WORD); -// Number of bits in a Struct data segment (should come out to BitCountN<22>). - -using StructDataOffset = decltype(StructDataBitCount() * (ONE * ELEMENTS / BITS)); -using StructPointerOffset = StructPointerCount; -// Type of a field offset. - -inline StructDataOffset assumeDataOffset(uint32_t offset) { - return assumeMax(MAX_STUCT_DATA_WORDS * BITS_PER_WORD * (ONE * ELEMENTS / BITS), - bounded(offset) * ELEMENTS); -} - -inline StructPointerOffset assumePointerOffset(uint32_t offset) { - return assumeMax(MAX_STRUCT_POINTER_COUNT, bounded(offset) * POINTERS); -} - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef kj::Quantity, byte> TextSize; -// Not including NUL terminator. - -template -inline KJ_CONSTEXPR() decltype(bounded() * BYTES / ELEMENTS) bytesPerElement() { - return bounded() * BYTES / ELEMENTS; -} - -template -inline KJ_CONSTEXPR() decltype(bounded() * BITS / ELEMENTS) bitsPerElement() { - return bounded() * BITS / ELEMENTS; -} - -template -inline constexpr kj::Quantity, T> -intervalLength(const T* a, const T* b, kj::Quantity, T>) { - return kj::assumeMax(b - a) * kj::unit, T>>(); -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, kj::Quantity size) { - return kj::ArrayPtr(ptr, unbound(size / kj::unit>())); -} - -#else - -template -using BitCountN = T; -template -using ByteCountN = T; -template -using WordCountN = T; -template -using ElementCountN = T; -template -using WirePointerCountN = T; - - -// XXX -typedef BitCountN<8, uint8_t> BitCount8; -typedef BitCountN<16, uint16_t> BitCount16; -typedef BitCountN<32, uint32_t> BitCount32; -typedef BitCountN<64, uint64_t> BitCount64; -typedef BitCountN BitCount; - -typedef ByteCountN<8, uint8_t> ByteCount8; -typedef ByteCountN<16, uint16_t> ByteCount16; -typedef ByteCountN<32, uint32_t> ByteCount32; -typedef ByteCountN<64, uint64_t> ByteCount64; -typedef ByteCountN ByteCount; - -typedef WordCountN<8, uint8_t> WordCount8; -typedef WordCountN<16, uint16_t> WordCount16; -typedef WordCountN<32, uint32_t> WordCount32; -typedef WordCountN<64, uint64_t> WordCount64; -typedef WordCountN WordCount; - -typedef ElementCountN<8, uint8_t> ElementCount8; -typedef ElementCountN<16, uint16_t> ElementCount16; -typedef ElementCountN<32, uint32_t> ElementCount32; -typedef ElementCountN<64, uint64_t> ElementCount64; -typedef ElementCountN ElementCount; - -typedef WirePointerCountN<8, uint8_t> WirePointerCount8; -typedef WirePointerCountN<16, uint16_t> WirePointerCount16; -typedef WirePointerCountN<32, uint32_t> WirePointerCount32; -typedef WirePointerCountN<64, uint64_t> WirePointerCount64; -typedef WirePointerCountN WirePointerCount; - -template -using BitsPerElementN = decltype(BitCountN() / ElementCountN()); -template -using BytesPerElementN = decltype(ByteCountN() / ElementCountN()); -template -using WordsPerElementN = decltype(WordCountN() / ElementCountN()); -template -using PointersPerElementN = decltype(WirePointerCountN() / ElementCountN()); - -using kj::ThrowOverflow; -// YYY - -template inline constexpr uint bounded() { return i; } -template inline constexpr T bounded(T i) { return i; } -template inline constexpr T unbound(T i) { return i; } - -template inline constexpr T unboundAs(U i) { return i; } - -template inline constexpr uint unboundMax(T i) { return i; } -template inline constexpr uint unboundMaxBits(T i) { return i; } - -template -inline T assertMax(T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMax(uint newMax, T value, ErrorFunc&& func) { - if (KJ_UNLIKELY(value > newMax)) func(); - return value; -} - -template -inline T assertMaxBits(T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > kj::maxValueForBits())) func(); - return value; -} - -template -inline T assertMaxBits(uint bits, T value, ErrorFunc&& func = ErrorFunc()) { - if (KJ_UNLIKELY(value > (1ull << bits) - 1)) func(); - return value; -} - -template inline constexpr T upgradeBound(U i) { return i; } - -template inline constexpr T assumeBits(T i) { return i; } -template inline constexpr T assumeMax(T i) { return i; } - -template -inline auto subtractChecked(T a, U b, ErrorFunc&& errorFunc = ErrorFunc()) - -> decltype(a - b) { - if (b > a) errorFunc(); - return a - b; -} - -template -inline auto trySubtract(T a, U b) -> kj::Maybe { - if (b > a) { - return nullptr; - } else { - return a - b; - } -} - -constexpr uint BITS = 1; -constexpr uint BYTES = 1; -constexpr uint WORDS = 1; -constexpr uint ELEMENTS = 1; -constexpr uint POINTERS = 1; - -constexpr uint ZERO = 0; -constexpr uint ONE = 1; - -// GCC 4.7 actually gives unused warnings on these constants in opt mode... -constexpr uint BITS_PER_BYTE KJ_UNUSED = 8; -constexpr uint BITS_PER_WORD KJ_UNUSED = 64; -constexpr uint BYTES_PER_WORD KJ_UNUSED = 8; - -constexpr uint BITS_PER_POINTER KJ_UNUSED = 64; -constexpr uint BYTES_PER_POINTER KJ_UNUSED = 8; -constexpr uint WORDS_PER_POINTER KJ_UNUSED = 1; - -// XXX -constexpr uint POINTER_SIZE_IN_WORDS = ONE * POINTERS * WORDS_PER_POINTER; - -constexpr uint SEGMENT_WORD_COUNT_BITS = 29; // Number of words in a segment. -constexpr uint LIST_ELEMENT_COUNT_BITS = 29; // Number of elements in a list. -constexpr uint STRUCT_DATA_WORD_COUNT_BITS = 16; // Number of words in a Struct data section. -constexpr uint STRUCT_POINTER_COUNT_BITS = 16; // Number of pointers in a Struct pointer section. -constexpr uint BLOB_SIZE_BITS = 29; // Number of bytes in a blob. - -typedef WordCountN SegmentWordCount; -typedef ElementCountN ListElementCount; -typedef WordCountN StructDataWordCount; -typedef WirePointerCountN StructPointerCount; -typedef ByteCountN BlobSize; -// YYY - -constexpr auto MAX_SEGMENT_WORDS = kj::maxValueForBits(); -constexpr auto MAX_LIST_ELEMENTS = kj::maxValueForBits(); -constexpr auto MAX_STUCT_DATA_WORDS = kj::maxValueForBits(); -constexpr auto MAX_STRUCT_POINTER_COUNT = kj::maxValueForBits(); - -typedef uint StructDataBitCount; -typedef uint StructDataOffset; -typedef uint StructPointerOffset; - -inline StructDataOffset assumeDataOffset(uint32_t offset) { return offset; } -inline StructPointerOffset assumePointerOffset(uint32_t offset) { return offset; } - -constexpr uint MAX_TEXT_SIZE = kj::maxValueForBits() - 1; -typedef uint TextSize; - -template -inline KJ_CONSTEXPR() size_t bytesPerElement() { return sizeof(T); } - -template -inline KJ_CONSTEXPR() size_t bitsPerElement() { return sizeof(T) * 8; } - -template -inline constexpr ptrdiff_t intervalLength(const T* a, const T* b, uint) { - return b - a; -} - -template -inline constexpr kj::ArrayPtr arrayPtr(const U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} -template -inline constexpr kj::ArrayPtr arrayPtr(U* ptr, T size) { - return kj::arrayPtr(ptr, size); -} - -#endif - -} // namespace capnp - -#endif // CAPNP_COMMON_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp b/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp deleted file mode 100644 index 55188736f8..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0x8ef99297a43a5e34; - -$import "/capnp/c++.capnp".namespace("capnp"); - -struct JsonValue { - union { - null @0 :Void; - boolean @1 :Bool; - number @2 :Float64; - string @3 :Text; - array @4 :List(JsonValue); - object @5 :List(Field); - # Standard JSON values. - - call @6 :Call; - # Non-standard: A "function call", applying a named function (named by a single identifier) - # to a parameter list. Examples: - # - # BinData(0, "Zm9vCg==") - # ISODate("2015-04-15T08:44:50.218Z") - # - # Mongo DB users will recognize the above as exactly the syntax Mongo uses to represent BSON - # "binary" and "date" types in text, since JSON has no analog of these. This is basically the - # reason this extension exists. We do NOT recommend using `call` unless you specifically need - # to be compatible with some silly format that uses this syntax. - } - - struct Field { - name @0 :Text; - value @1 :JsonValue; - } - - struct Call { - function @0 :Text; - params @1 :List(JsonValue); - } -} diff --git a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp.h deleted file mode 100644 index a8877e540b..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.capnp.h +++ /dev/null @@ -1,860 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: json.capnp - -#ifndef CAPNP_INCLUDED_8ef99297a43a5e34_ -#define CAPNP_INCLUDED_8ef99297a43a5e34_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(8825ffaa852cda72); -CAPNP_DECLARE_SCHEMA(c27855d853a937cc); -CAPNP_DECLARE_SCHEMA(9bbf84153dd4bb60); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -struct JsonValue { - JsonValue() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NULL_, - BOOLEAN, - NUMBER, - STRING, - ARRAY, - OBJECT, - CALL, - }; - struct Field; - struct Call; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8825ffaa852cda72, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c27855d853a937cc, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JsonValue::Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9bbf84153dd4bb60, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class JsonValue::Reader { -public: - typedef JsonValue Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNull() const; - inline ::capnp::Void getNull() const; - - inline bool isBoolean() const; - inline bool getBoolean() const; - - inline bool isNumber() const; - inline double getNumber() const; - - inline bool isString() const; - inline bool hasString() const; - inline ::capnp::Text::Reader getString() const; - - inline bool isArray() const; - inline bool hasArray() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getArray() const; - - inline bool isObject() const; - inline bool hasObject() const; - inline ::capnp::List< ::capnp::JsonValue::Field>::Reader getObject() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::JsonValue::Call::Reader getCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Builder { -public: - typedef JsonValue Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNull(); - inline ::capnp::Void getNull(); - inline void setNull( ::capnp::Void value = ::capnp::VOID); - - inline bool isBoolean(); - inline bool getBoolean(); - inline void setBoolean(bool value); - - inline bool isNumber(); - inline double getNumber(); - inline void setNumber(double value); - - inline bool isString(); - inline bool hasString(); - inline ::capnp::Text::Builder getString(); - inline void setString( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initString(unsigned int size); - inline void adoptString(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownString(); - - inline bool isArray(); - inline bool hasArray(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getArray(); - inline void setArray( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initArray(unsigned int size); - inline void adoptArray(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownArray(); - - inline bool isObject(); - inline bool hasObject(); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder getObject(); - inline void setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value); - inline ::capnp::List< ::capnp::JsonValue::Field>::Builder initObject(unsigned int size); - inline void adoptObject(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> disownObject(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::JsonValue::Call::Builder getCall(); - inline void setCall( ::capnp::JsonValue::Call::Reader value); - inline ::capnp::JsonValue::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::JsonValue::Call>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue::Call> disownCall(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Pipeline { -public: - typedef JsonValue Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline bool hasValue() const; - inline ::capnp::JsonValue::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline bool hasValue(); - inline ::capnp::JsonValue::Builder getValue(); - inline void setValue( ::capnp::JsonValue::Reader value); - inline ::capnp::JsonValue::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::JsonValue>&& value); - inline ::capnp::Orphan< ::capnp::JsonValue> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::JsonValue::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JsonValue::Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasFunction() const; - inline ::capnp::Text::Reader getFunction() const; - - inline bool hasParams() const; - inline ::capnp::List< ::capnp::JsonValue>::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JsonValue::Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasFunction(); - inline ::capnp::Text::Builder getFunction(); - inline void setFunction( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFunction(unsigned int size); - inline void adoptFunction(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFunction(); - - inline bool hasParams(); - inline ::capnp::List< ::capnp::JsonValue>::Builder getParams(); - inline void setParams( ::capnp::List< ::capnp::JsonValue>::Reader value); - inline ::capnp::List< ::capnp::JsonValue>::Builder initParams(unsigned int size); - inline void adoptParams(::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JsonValue::Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::JsonValue::Which JsonValue::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::JsonValue::Which JsonValue::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Reader::isNull() const { - return which() == JsonValue::NULL_; -} -inline bool JsonValue::Builder::isNull() { - return which() == JsonValue::NULL_; -} -inline ::capnp::Void JsonValue::Reader::getNull() const { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void JsonValue::Builder::getNull() { - KJ_IREQUIRE((which() == JsonValue::NULL_), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNull( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NULL_); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isBoolean() const { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Builder::isBoolean() { - return which() == JsonValue::BOOLEAN; -} -inline bool JsonValue::Reader::getBoolean() const { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool JsonValue::Builder::getBoolean() { - KJ_IREQUIRE((which() == JsonValue::BOOLEAN), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setBoolean(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::BOOLEAN); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isNumber() const { - return which() == JsonValue::NUMBER; -} -inline bool JsonValue::Builder::isNumber() { - return which() == JsonValue::NUMBER; -} -inline double JsonValue::Reader::getNumber() const { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double JsonValue::Builder::getNumber() { - KJ_IREQUIRE((which() == JsonValue::NUMBER), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void JsonValue::Builder::setNumber(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::NUMBER); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool JsonValue::Reader::isString() const { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Builder::isString() { - return which() == JsonValue::STRING; -} -inline bool JsonValue::Reader::hasString() const { - if (which() != JsonValue::STRING) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasString() { - if (which() != JsonValue::STRING) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Reader::getString() const { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Builder::getString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setString( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Builder::initString(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptString( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::STRING); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Builder::disownString() { - KJ_IREQUIRE((which() == JsonValue::STRING), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isArray() const { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Builder::isArray() { - return which() == JsonValue::ARRAY; -} -inline bool JsonValue::Reader::hasArray() const { - if (which() != JsonValue::ARRAY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasArray() { - if (which() != JsonValue::ARRAY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Reader::getArray() const { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::getArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setArray( ::capnp::List< ::capnp::JsonValue>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Builder::initArray(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptArray( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::ARRAY); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Builder::disownArray() { - KJ_IREQUIRE((which() == JsonValue::ARRAY), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isObject() const { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Builder::isObject() { - return which() == JsonValue::OBJECT; -} -inline bool JsonValue::Reader::hasObject() const { - if (which() != JsonValue::OBJECT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasObject() { - if (which() != JsonValue::OBJECT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Reader JsonValue::Reader::getObject() const { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::getObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setObject( ::capnp::List< ::capnp::JsonValue::Field>::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue::Field>::Builder JsonValue::Builder::initObject(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Builder::adoptObject( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::OBJECT); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue::Field>> JsonValue::Builder::disownObject() { - KJ_IREQUIRE((which() == JsonValue::OBJECT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Reader::isCall() const { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Builder::isCall() { - return which() == JsonValue::CALL; -} -inline bool JsonValue::Reader::hasCall() const { - if (which() != JsonValue::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Builder::hasCall() { - if (which() != JsonValue::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Call::Reader JsonValue::Reader::getCall() const { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::getCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::setCall( ::capnp::JsonValue::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Call::Builder JsonValue::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Builder::adoptCall( - ::capnp::Orphan< ::capnp::JsonValue::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, JsonValue::CALL); - ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue::Call> JsonValue::Builder::disownCall() { - KJ_IREQUIRE((which() == JsonValue::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::JsonValue::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Field::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Field::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::JsonValue::Reader JsonValue::Field::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::JsonValue::Pipeline JsonValue::Field::Pipeline::getValue() { - return ::capnp::JsonValue::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void JsonValue::Field::Builder::setValue( ::capnp::JsonValue::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::JsonValue::Builder JsonValue::Field::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Field::Builder::adoptValue( - ::capnp::Orphan< ::capnp::JsonValue>&& value) { - ::capnp::_::PointerHelpers< ::capnp::JsonValue>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::JsonValue> JsonValue::Field::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::JsonValue>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasFunction() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasFunction() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader JsonValue::Call::Reader::getFunction() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::getFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setFunction( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder JsonValue::Call::Builder::initFunction(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptFunction( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> JsonValue::Call::Builder::disownFunction() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool JsonValue::Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool JsonValue::Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::JsonValue>::Reader JsonValue::Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void JsonValue::Call::Builder::setParams( ::capnp::List< ::capnp::JsonValue>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::JsonValue>::Builder JsonValue::Call::Builder::initParams(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void JsonValue::Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::JsonValue>> JsonValue::Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::JsonValue>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -} // namespace - -#endif // CAPNP_INCLUDED_8ef99297a43a5e34_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.h b/phonelibs/capnp-cpp/mac/include/capnp/compat/json.h deleted file mode 100644 index 7fa815e099..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/compat/json.h +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_COMPAT_JSON_H_ -#define CAPNP_COMPAT_JSON_H_ - -#include -#include -#include - -namespace capnp { - -class JsonCodec { - // Flexible class for encoding Cap'n Proto types as JSON, and decoding JSON back to Cap'n Proto. - // - // Typical usage: - // - // JsonCodec json; - // - // // encode - // kj::String encoded = json.encode(someStructReader); - // - // // decode - // json.decode(encoded, someStructBuilder); - // - // Advanced users can do fancy things like override the way certain types or fields are - // represented in JSON by registering handlers. See the unit test for an example. - // - // Notes: - // - When encoding, all primitive fields are always encoded, even if default-valued. Pointer - // fields are only encoded if they are non-null. - // - 64-bit integers are encoded as strings, since JSON "numbers" are double-precision floating - // points which cannot store a 64-bit integer without losing data. - // - NaNs and infinite floating point numbers are not allowed by the JSON spec, and so are encoded - // as null. This matches the behavior of `JSON.stringify` in at least Firefox and Chrome. - // - Data is encoded as an array of numbers in the range [0,255]. You probably want to register - // a handler that does something better, like maybe base64 encoding, but there are a zillion - // different ways people do this. - // - Encoding/decoding capabilities and AnyPointers requires registering a Handler, since there's - // no obvious default behavior. - // - When decoding, unrecognized field names are ignored. Note: This means that JSON is NOT a - // good format for receiving input from a human. Consider `capnp eval` or the SchemaParser - // library for human input. - -public: - JsonCodec(); - ~JsonCodec() noexcept(false); - - // --------------------------------------------------------------------------- - // standard API - - void setPrettyPrint(bool enabled); - // Enable to insert newlines, indentation, and other extra spacing into the output. The default - // is to use minimal whitespace. - - void setMaxNestingDepth(size_t maxNestingDepth); - // Set maximum nesting depth when decoding JSON to prevent highly nested input from overflowing - // the call stack. The default is 64. - - template - kj::String encode(T&& value); - // Encode any Cap'n Proto value to JSON, including primitives and - // Dynamic{Enum,Struct,List,Capability}, but not DynamicValue (see below). - - kj::String encode(DynamicValue::Reader value, Type type) const; - // Encode a DynamicValue to JSON. `type` is needed because `DynamicValue` itself does - // not distinguish between e.g. int32 and int64, which in JSON are handled differently. Most - // of the time, though, you can use the single-argument templated version of `encode()` instead. - - void decode(kj::ArrayPtr input, DynamicStruct::Builder output) const; - // Decode JSON text directly into a struct builder. This only works for structs since lists - // need to be allocated with the correct size in advance. - // - // (Remember that any Cap'n Proto struct reader type can be implicitly cast to - // DynamicStruct::Reader.) - - template - Orphan decode(kj::ArrayPtr input, Orphanage orphanage) const; - // Decode JSON text to any Cap'n Proto object (pointer value), allocated using the given - // orphanage. T must be specified explicitly and cannot be dynamic, e.g.: - // - // Orphan orphan = json.decode(text, orphanage); - - template - ReaderFor decode(kj::ArrayPtr input) const; - // Decode JSON text into a primitive or capability value. T must be specified explicitly and - // cannot be dynamic, e.g.: - // - // uint32_t n = json.decode(text); - - Orphan decode(kj::ArrayPtr input, Type type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(kj::ArrayPtr input, InterfaceSchema type) const; - DynamicEnum decode(kj::ArrayPtr input, EnumSchema type) const; - // Decode to a dynamic value, specifying the type schema. - - // --------------------------------------------------------------------------- - // layered API - // - // You can separate text <-> JsonValue from JsonValue <-> T. These are particularly useful - // for calling from Handler implementations. - - kj::String encodeRaw(JsonValue::Reader value) const; - void decodeRaw(kj::ArrayPtr input, JsonValue::Builder output) const; - // Translate JsonValue <-> text. - - template - void encode(T&& value, JsonValue::Builder output); - void encode(DynamicValue::Reader input, Type type, JsonValue::Builder output) const; - void decode(JsonValue::Reader input, DynamicStruct::Builder output) const; - template - Orphan decode(JsonValue::Reader input, Orphanage orphanage) const; - template - ReaderFor decode(JsonValue::Reader input) const; - - Orphan decode(JsonValue::Reader input, Type type, Orphanage orphanage) const; - Orphan decode(JsonValue::Reader input, ListSchema type, Orphanage orphanage) const; - Orphan decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const; - DynamicCapability::Client decode(JsonValue::Reader input, InterfaceSchema type) const; - DynamicEnum decode(JsonValue::Reader input, EnumSchema type) const; - - // --------------------------------------------------------------------------- - // specializing particular types - - template ()> - class Handler; - // Implement this interface to specify a special encoding for a particular type or field. - // - // The templates are a bit ugly, but subclasses of this type essentially implement two methods, - // one to encode values of this type and one to decode values of this type. `encode()` is simple: - // - // void encode(const JsonCodec& codec, ReaderFor input, JsonValue::Builder output) const; - // - // `decode()` is a bit trickier. When T is a struct (including DynamicStruct), it is: - // - // void decode(const JsonCodec& codec, JsonValue::Reader input, BuilderFor output) const; - // - // However, when T is a primitive, decode() is: - // - // T decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Or when T is any non-struct object (list, blob), decode() is: - // - // Orphan decode(const JsonCodec& codec, JsonValue::Reader input, Orphanage orphanage) const; - // - // Or when T is an interface: - // - // T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const; - // - // Additionally, when T is a struct you can *optionally* also implement the orphan-returning form - // of decode(), but it will only be called when the struct would be allocated as an individual - // object, not as part of a list. This allows you to return "nullptr" in these cases to say that - // the pointer value should be null. This does not apply to list elements because struct list - // elements cannot ever be null (since Cap'n Proto encodes struct lists as a flat list rather - // than list-of-pointers). - - template - void addTypeHandler(Handler& handler); - void addTypeHandler(Type type, Handler& handler); - void addTypeHandler(EnumSchema type, Handler& handler); - void addTypeHandler(StructSchema type, Handler& handler); - void addTypeHandler(ListSchema type, Handler& handler); - void addTypeHandler(InterfaceSchema type, Handler& handler); - // Arrange that whenever the type T appears in the message, your handler will be used to - // encode/decode it. - // - // Note that if you register a handler for a capability type, it will also apply to subtypes. - // Thus Handler handles all capabilities. - - template - void addFieldHandler(StructSchema::Field field, Handler& handler); - // Matches only the specific field. T can be a dynamic type. T must match the field's type. - -private: - class HandlerBase; - struct Impl; - - kj::Own impl; - - void encodeField(StructSchema::Field field, DynamicValue::Reader input, - JsonValue::Builder output) const; - void decodeArray(List::Reader input, DynamicList::Builder output) const; - void decodeObject(List::Reader input, DynamicStruct::Builder output) const; - void addTypeHandlerImpl(Type type, HandlerBase& handler); - void addFieldHandlerImpl(StructSchema::Field field, Type type, HandlerBase& handler); -}; - -// ======================================================================================= -// inline implementation details - -template -kj::String JsonCodec::encode(T&& value) { - typedef FromAny> Base; - return encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from()); -} - -template -inline Orphan JsonCodec::decode(kj::ArrayPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(kj::ArrayPtr input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - kj::ArrayPtr input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - kj::ArrayPtr input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(kj::ArrayPtr input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -template -void JsonCodec::encode(T&& value, JsonValue::Builder output) { - typedef FromAny> Base; - encode(DynamicValue::Reader(ReaderFor(kj::fwd(value))), Type::from(), output); -} - -template -inline Orphan JsonCodec::decode(JsonValue::Reader input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -template -inline ReaderFor JsonCodec::decode(JsonValue::Reader input) const { - static_assert(style() == Style::PRIMITIVE || style() == Style::CAPABILITY, - "must specify an orphanage to decode an object type"); - return decode(input, Type::from(), Orphanage()).getReader().template as(); -} - -inline Orphan JsonCodec::decode( - JsonValue::Reader input, ListSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline Orphan JsonCodec::decode( - JsonValue::Reader input, StructSchema type, Orphanage orphanage) const { - return decode(input, Type(type), orphanage).releaseAs(); -} -inline DynamicCapability::Client JsonCodec::decode( - JsonValue::Reader input, InterfaceSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} -inline DynamicEnum JsonCodec::decode(JsonValue::Reader input, EnumSchema type) const { - return decode(input, Type(type), Orphanage()).getReader().as(); -} - -// ----------------------------------------------------------------------------- - -class JsonCodec::HandlerBase { - // Internal helper; ignore. -public: - virtual void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const = 0; - virtual Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const; - virtual void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, ReaderFor input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - BuilderFor output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template <> -class JsonCodec::Handler: private JsonCodec::HandlerBase { - // Almost identical to Style::STRUCT except that we pass the struct type to decode(). - -public: - virtual void encode(const JsonCodec& codec, DynamicStruct::Reader input, - JsonValue::Builder output) const = 0; - virtual void decode(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const = 0; - virtual Orphan decode(const JsonCodec& codec, JsonValue::Reader input, - StructSchema type, Orphanage orphanage) const { - // If subclass does not override, fall back to regular version. - auto result = orphanage.newOrphan(type); - decode(codec, input, result.get()); - return result; - } - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input, type.asStruct(), orphanage); - } - void decodeStructBase(const JsonCodec& codec, JsonValue::Reader input, - DynamicStruct::Builder output) const override final { - decode(codec, input, output.as()); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, T input, JsonValue::Builder output) const = 0; - virtual T decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return decode(codec, input); - } - friend class JsonCodec; -}; - -template -class JsonCodec::Handler: private JsonCodec::HandlerBase { -public: - virtual void encode(const JsonCodec& codec, typename T::Client input, - JsonValue::Builder output) const = 0; - virtual typename T::Client decode(const JsonCodec& codec, JsonValue::Reader input) const = 0; - -private: - void encodeBase(const JsonCodec& codec, DynamicValue::Reader input, - JsonValue::Builder output) const override final { - encode(codec, input.as(), output); - } - Orphan decodeBase(const JsonCodec& codec, JsonValue::Reader input, - Type type, Orphanage orphanage) const override final { - return orphanage.newOrphanCopy(decode(codec, input)); - } - friend class JsonCodec; -}; - -template -inline void JsonCodec::addTypeHandler(Handler& handler) { - addTypeHandlerImpl(Type::from(), handler); -} -inline void JsonCodec::addTypeHandler(Type type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(EnumSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(StructSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(ListSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} -inline void JsonCodec::addTypeHandler(InterfaceSchema type, Handler& handler) { - addTypeHandlerImpl(type, handler); -} - -template -inline void JsonCodec::addFieldHandler(StructSchema::Field field, Handler& handler) { - addFieldHandlerImpl(field, Type::from(), handler); -} - -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -template <> void JsonCodec::addTypeHandler(Handler& handler) - KJ_UNAVAILABLE("JSON handlers for type sets (e.g. all structs, all lists) not implemented; " - "try specifying a specific type schema as the first parameter"); -// TODO(someday): Implement support for registering handlers that cover thinsg like "all structs" -// or "all lists". Currently you can only target a specific struct or list type. - -} // namespace capnp - -#endif // CAPNP_COMPAT_JSON_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/dynamic.h b/phonelibs/capnp-cpp/mac/include/capnp/dynamic.h deleted file mode 100644 index fcefcc3bf2..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/dynamic.h +++ /dev/null @@ -1,1643 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines classes that can be used to manipulate messages based on schemas that are not -// known until runtime. This is also useful for writing generic code that uses schemas to handle -// arbitrary types in a generic way. -// -// Each of the classes defined here has a to() template method which converts an instance back to a -// native type. This method will throw an exception if the requested type does not match the -// schema. To convert native types to dynamic, use DynamicFactory. -// -// As always, underlying data is validated lazily, so you have to actually traverse the whole -// message if you want to validate all content. - -#ifndef CAPNP_DYNAMIC_H_ -#define CAPNP_DYNAMIC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include "layout.h" -#include "message.h" -#include "any.h" -#include "capability.h" - -namespace capnp { - -class MessageReader; -class MessageBuilder; - -struct DynamicValue { - DynamicValue() = delete; - - enum Type { - UNKNOWN, - // Means that the value has unknown type and content because it comes from a newer version of - // the schema, or from a newer version of Cap'n Proto that has new features that this version - // doesn't understand. - - VOID, - BOOL, - INT, - UINT, - FLOAT, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - CAPABILITY, - ANY_POINTER - }; - - class Reader; - class Builder; - class Pipeline; -}; -class DynamicEnum; -struct DynamicStruct { - DynamicStruct() = delete; - class Reader; - class Builder; - class Pipeline; -}; -struct DynamicList { - DynamicList() = delete; - class Reader; - class Builder; -}; -struct DynamicCapability { - DynamicCapability() = delete; - class Client; - class Server; -}; -template <> class Orphan; - -template struct DynamicTypeFor_; -template <> struct DynamicTypeFor_ { typedef DynamicEnum Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicStruct Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicList Type; }; -template <> struct DynamicTypeFor_ { typedef DynamicCapability Type; }; - -template -using DynamicTypeFor = typename DynamicTypeFor_()>::Type; - -template -ReaderFor>> toDynamic(T&& value); -template -BuilderFor>> toDynamic(T&& value); -template -DynamicTypeFor> toDynamic(T&& value); -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value); - -namespace _ { // private - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -} // namespace _ (private) - -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::PRIMITIVE; } -template <> inline constexpr Style style() { return Style::STRUCT; } -template <> inline constexpr Style style() { return Style::POINTER; } -template <> inline constexpr Style style() { return Style::CAPABILITY; } - -// ------------------------------------------------------------------- - -class DynamicEnum { -public: - DynamicEnum() = default; - inline DynamicEnum(EnumSchema::Enumerant enumerant) - : schema(enumerant.getContainingEnum()), value(enumerant.getOrdinal()) {} - inline DynamicEnum(EnumSchema schema, uint16_t value) - : schema(schema), value(value) {} - - template () == Kind::ENUM>> - inline DynamicEnum(T&& value): DynamicEnum(toDynamic(value)) {} - - template - inline T as() const { return static_cast(asImpl(typeId())); } - // Cast to a native enum type. - - inline EnumSchema getSchema() const { return schema; } - - kj::Maybe getEnumerant() const; - // Get which enumerant this enum value represents. Returns nullptr if the numeric value does not - // correspond to any enumerant in the schema -- this can happen if the data was built using a - // newer schema that has more values defined. - - inline uint16_t getRaw() const { return value; } - // Returns the raw underlying enum value. - -private: - EnumSchema schema; - uint16_t value; - - uint16_t asImpl(uint64_t requestedTypeId) const; - - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - template - friend DynamicTypeFor> toDynamic(T&& value); -}; - -// ------------------------------------------------------------------- - -class DynamicStruct::Reader { -public: - typedef DynamicStruct Reads; - - Reader() = default; - - template >() == Kind::STRUCT>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - inline MessageSize totalSize() const { return reader.totalSize().asPublic(); } - - template - typename T::Reader as() const; - // Convert the dynamic struct to its compiled-in type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Reader get(StructSchema::Field field) const; - // Read the given field value. - - bool has(StructSchema::Field field) const; - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns false if the union member is not - // active, but does not necessarily return true if the member is active (depends on the field's - // value). - - kj::Maybe which() const; - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - DynamicValue::Reader get(kj::StringPtr name) const; - bool has(kj::StringPtr name) const; - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - -private: - StructSchema schema; - _::StructReader reader; - - inline Reader(StructSchema schema, _::StructReader reader) - : schema(schema), reader(reader) {} - Reader(StructSchema schema, const _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field) const; - void verifySetInUnion(StructSchema::Field field) const; - static DynamicValue::Reader getImpl(_::StructReader reader, StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend class DynamicStruct::Builder; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Builder { -public: - typedef DynamicStruct Builds; - - Builder() = default; - inline Builder(decltype(nullptr)) {} - - template >() == Kind::STRUCT>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - inline MessageSize totalSize() const { return asReader().totalSize(); } - - template - typename T::Builder as(); - // Cast to a particular struct type. - - inline StructSchema getSchema() const { return schema; } - - DynamicValue::Builder get(StructSchema::Field field); - // Read the given field value. - - inline bool has(StructSchema::Field field) { return asReader().has(field); } - // Tests whether the given field is set to its default value. For pointer values, this does - // not actually traverse the value comparing it with the default, but simply returns true if the - // pointer is non-null. For members of unions, has() returns whether the field is currently - // active and the union as a whole is non-default -- so, the only time has() will return false - // for an active union field is if it is the default active field and it has its default value. - - kj::Maybe which(); - // If the struct contains an (unnamed) union, and the currently-active field within that union - // is known, this returns that field. Otherwise, it returns null. In other words, this returns - // null if there is no union present _or_ if the union's discriminant is set to an unrecognized - // value. This could happen in particular when receiving a message from a sender who has a - // newer version of the protocol and is using a field of the union that you don't know about yet. - - void set(StructSchema::Field field, const DynamicValue::Reader& value); - // Set the given field value. - - DynamicValue::Builder init(StructSchema::Field field); - DynamicValue::Builder init(StructSchema::Field field, uint size); - // Init a struct, list, or blob field. - - void adopt(StructSchema::Field field, Orphan&& orphan); - Orphan disown(StructSchema::Field field); - // Adopt/disown. This works even for non-pointer fields: adopt() becomes equivalent to set() - // and disown() becomes like get() followed by clear(). - - void clear(StructSchema::Field field); - // Clear a field, setting it to its default value. For pointer fields, this actually makes the - // field null. - - DynamicValue::Builder get(kj::StringPtr name); - bool has(kj::StringPtr name); - void set(kj::StringPtr name, const DynamicValue::Reader& value); - void set(kj::StringPtr name, std::initializer_list value); - DynamicValue::Builder init(kj::StringPtr name); - DynamicValue::Builder init(kj::StringPtr name, uint size); - void adopt(kj::StringPtr name, Orphan&& orphan); - Orphan disown(kj::StringPtr name); - void clear(kj::StringPtr name); - // Shortcuts to access fields by name. These throw exceptions if no such field exists. - - Reader asReader() const; - -private: - StructSchema schema; - _::StructBuilder builder; - - inline Builder(StructSchema schema, _::StructBuilder builder) - : schema(schema), builder(builder) {} - Builder(StructSchema schema, _::OrphanBuilder& orphan); - - bool isSetInUnion(StructSchema::Field field); - void verifySetInUnion(StructSchema::Field field); - void setInUnion(StructSchema::Field field); - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class MessageReader; - friend class MessageBuilder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicStruct::Pipeline { -public: - typedef DynamicStruct Pipelines; - - inline Pipeline(decltype(nullptr)): typeless(nullptr) {} - - template - typename T::Pipeline releaseAs(); - // Convert the dynamic pipeline to its compiled-in type. - - inline StructSchema getSchema() { return schema; } - - DynamicValue::Pipeline get(StructSchema::Field field); - // Read the given field value. - - DynamicValue::Pipeline get(kj::StringPtr name); - // Get by string name. - -private: - StructSchema schema; - AnyPointer::Pipeline typeless; - - inline explicit Pipeline(StructSchema schema, AnyPointer::Pipeline&& typeless) - : schema(schema), typeless(kj::mv(typeless)) {} - - friend class Request; -}; - -// ------------------------------------------------------------------- - -class DynamicList::Reader { -public: - typedef DynamicList Reads; - - inline Reader(): reader(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Reader(T&& value): Reader(toDynamic(value)) {} - - template - typename T::Reader as() const; - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - DynamicValue::Reader operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - ListSchema schema; - _::ListReader reader; - - Reader(ListSchema schema, _::ListReader reader): schema(schema), reader(reader) {} - Reader(ListSchema schema, const _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend class DynamicList::Builder; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -class DynamicList::Builder { -public: - typedef DynamicList Builds; - - inline Builder(): builder(ElementSize::VOID) {} - inline Builder(decltype(nullptr)): builder(ElementSize::VOID) {} - - template >() == Kind::LIST>> - inline Builder(T&& value): Builder(toDynamic(value)) {} - - template - typename T::Builder as(); - // Try to convert to any List, Data, or Text. Throws an exception if the underlying data - // can't possibly represent the requested type. - - inline ListSchema getSchema() const { return schema; } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - DynamicValue::Builder operator[](uint index); - void set(uint index, const DynamicValue::Reader& value); - DynamicValue::Builder init(uint index, uint size); - void adopt(uint index, Orphan&& orphan); - Orphan disown(uint index); - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - void copyFrom(std::initializer_list value); - - Reader asReader() const; - -private: - ListSchema schema; - _::ListBuilder builder; - - Builder(ListSchema schema, _::ListBuilder builder): schema(schema), builder(builder) {} - Builder(ListSchema schema, _::OrphanBuilder& orphan); - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - template - friend struct ::capnp::ToDynamic_; - friend class Orphanage; - template - friend struct _::OrphanGetImpl; - friend class Orphan; - friend class Orphan; - friend class Orphan; -}; - -// ------------------------------------------------------------------- - -class DynamicCapability::Client: public Capability::Client { -public: - typedef DynamicCapability Calls; - typedef DynamicCapability Reads; - - Client() = default; - - template >() == Kind::INTERFACE>> - inline Client(T&& client); - - template ()>> - inline Client(kj::Own&& server); - - template () == Kind::INTERFACE>> - typename T::Client as(); - template () == Kind::INTERFACE>> - typename T::Client releaseAs(); - // Convert to any client type. - - Client upcast(InterfaceSchema requestedSchema); - // Upcast to a superclass. Throws an exception if `schema` is not a superclass. - - inline InterfaceSchema getSchema() { return schema; } - - Request newRequest( - InterfaceSchema::Method method, kj::Maybe sizeHint = nullptr); - Request newRequest( - kj::StringPtr methodName, kj::Maybe sizeHint = nullptr); - -private: - InterfaceSchema schema; - - Client(InterfaceSchema schema, kj::Own&& hook) - : Capability::Client(kj::mv(hook)), schema(schema) {} - - template - inline Client(InterfaceSchema schema, kj::Own&& server); - - friend struct Capability; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct DynamicValue; - friend class Orphan; - friend class Orphan; - friend class Orphan; - template - friend struct _::PointerHelpers; -}; - -class DynamicCapability::Server: public Capability::Server { -public: - typedef DynamicCapability Serves; - - Server(InterfaceSchema schema): schema(schema) {} - - virtual kj::Promise call(InterfaceSchema::Method method, - CallContext context) = 0; - - kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - CallContext context) override final; - - inline InterfaceSchema getSchema() const { return schema; } - -private: - InterfaceSchema schema; -}; - -template <> -class Request: public DynamicStruct::Builder { - // Specialization of `Request` for DynamicStruct. - -public: - inline Request(DynamicStruct::Builder builder, kj::Own&& hook, - StructSchema resultSchema) - : DynamicStruct::Builder(builder), hook(kj::mv(hook)), resultSchema(resultSchema) {} - - RemotePromise send(); - // Send the call and return a promise for the results. - -private: - kj::Own hook; - StructSchema resultSchema; - - friend class Capability::Client; - friend struct DynamicCapability; - template - friend class CallContext; - friend class RequestHook; -}; - -template <> -class CallContext: public kj::DisallowConstCopy { - // Wrapper around CallContextHook with a specific return type. - // - // Methods of this class may only be called from within the server's event loop, not from other - // threads. - -public: - explicit CallContext(CallContextHook& hook, StructSchema paramType, StructSchema resultType); - - DynamicStruct::Reader getParams(); - void releaseParams(); - DynamicStruct::Builder getResults(kj::Maybe sizeHint = nullptr); - DynamicStruct::Builder initResults(kj::Maybe sizeHint = nullptr); - void setResults(DynamicStruct::Reader value); - void adoptResults(Orphan&& value); - Orphanage getResultsOrphanage(kj::Maybe sizeHint = nullptr); - template - kj::Promise tailCall(Request&& tailRequest); - void allowCancellation(); - -private: - CallContextHook* hook; - StructSchema paramType; - StructSchema resultType; - - friend class DynamicCapability::Server; -}; - -// ------------------------------------------------------------------- - -// Make sure ReaderFor and BuilderFor work for DynamicEnum, DynamicStruct, and -// DynamicList, so that we can define DynamicValue::as(). - -template <> struct ReaderFor_ { typedef DynamicEnum Type; }; -template <> struct BuilderFor_ { typedef DynamicEnum Type; }; -template <> struct ReaderFor_ { typedef DynamicStruct::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicStruct::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicList::Reader Type; }; -template <> struct BuilderFor_ { typedef DynamicList::Builder Type; }; -template <> struct ReaderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct BuilderFor_ { typedef DynamicCapability::Client Type; }; -template <> struct PipelineFor_ { typedef DynamicCapability::Client Type; }; - -class DynamicValue::Reader { -public: - typedef DynamicValue Reads; - - inline Reader(decltype(nullptr) n = nullptr); // UNKNOWN - inline Reader(Void value); - inline Reader(bool value); - inline Reader(char value); - inline Reader(signed char value); - inline Reader(short value); - inline Reader(int value); - inline Reader(long value); - inline Reader(long long value); - inline Reader(unsigned char value); - inline Reader(unsigned short value); - inline Reader(unsigned int value); - inline Reader(unsigned long value); - inline Reader(unsigned long long value); - inline Reader(float value); - inline Reader(double value); - inline Reader(const char* value); // Text - inline Reader(const Text::Reader& value); - inline Reader(const Data::Reader& value); - inline Reader(const DynamicList::Reader& value); - inline Reader(DynamicEnum value); - inline Reader(const DynamicStruct::Reader& value); - inline Reader(const AnyPointer::Reader& value); - inline Reader(DynamicCapability::Client& value); - inline Reader(DynamicCapability::Client&& value); - template ()>> - inline Reader(kj::Own&& value); - Reader(ConstSchema constant); - - template ()))> - inline Reader(T&& value): Reader(toDynamic(kj::mv(value))) {} - - Reader(const Reader& other); - Reader(Reader&& other) noexcept; - ~Reader() noexcept(false); - Reader& operator=(const Reader& other); - Reader& operator=(Reader&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline ReaderFor as() const { return AsImpl::apply(*this); } - // Use to interpret the value as some Cap'n Proto type. Allowed types are: - // - Void, bool, [u]int{8,16,32,64}_t, float, double, any enum: Returns the raw value. - // - Text, Data, AnyPointer, any struct type: Returns the corresponding Reader. - // - List for any T listed above: Returns List::Reader. - // - DynamicEnum: Returns the corresponding type. - // - DynamicStruct, DynamicList: Returns the corresponding Reader. - // - Any capability type, including DynamicCapability: Returns the corresponding Client. - // - DynamicValue: Returns an identical Reader. Useful to avoid special-casing in generic code. - // (TODO(perf): On GCC 4.8 / Clang 3.3, provide rvalue-qualified version that avoids - // refcounting.) - // - // DynamicValue allows various implicit conversions, mostly just to make the interface friendlier. - // - Any integer can be converted to any other integer type so long as the actual value is within - // the new type's range. - // - Floating-point types can be converted to integers as long as no information would be lost - // in the conversion. - // - Integers can be converted to floating points. This may lose information, but won't throw. - // - Float32/Float64 can be converted between each other. Converting Float64 -> Float32 may lose - // information, but won't throw. - // - Text can be converted to an enum, if the Text matches one of the enumerant names (but not - // vice-versa). - // - Capabilities can be upcast (cast to a supertype), but not downcast. - // - // Any other conversion attempt will throw an exception. - - inline Type getType() const { return type; } - // Get the type of this value. - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Reader textValue; - Data::Reader dataValue; - DynamicList::Reader listValue; - DynamicEnum enumValue; - DynamicStruct::Reader structValue; - AnyPointer::Reader anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - - // Warning: Copy/move constructors assume all these types are trivially copyable except - // Capability. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphanage; // to speed up newOrphanCopy(DynamicValue::Reader) -}; - -class DynamicValue::Builder { -public: - typedef DynamicValue Builds; - - inline Builder(decltype(nullptr) n = nullptr); // UNKNOWN - inline Builder(Void value); - inline Builder(bool value); - inline Builder(char value); - inline Builder(signed char value); - inline Builder(short value); - inline Builder(int value); - inline Builder(long value); - inline Builder(long long value); - inline Builder(unsigned char value); - inline Builder(unsigned short value); - inline Builder(unsigned int value); - inline Builder(unsigned long value); - inline Builder(unsigned long long value); - inline Builder(float value); - inline Builder(double value); - inline Builder(Text::Builder value); - inline Builder(Data::Builder value); - inline Builder(DynamicList::Builder value); - inline Builder(DynamicEnum value); - inline Builder(DynamicStruct::Builder value); - inline Builder(AnyPointer::Builder value); - inline Builder(DynamicCapability::Client& value); - inline Builder(DynamicCapability::Client&& value); - - template ()))> - inline Builder(T value): Builder(toDynamic(value)) {} - - Builder(Builder& other); - Builder(Builder&& other) noexcept; - ~Builder() noexcept(false); - Builder& operator=(Builder& other); - Builder& operator=(Builder&& other); - // Unfortunately, we cannot use the implicit definitions of these since DynamicCapability is not - // trivially copyable. - - template - inline BuilderFor as() { return AsImpl::apply(*this); } - // See DynamicValue::Reader::as(). - - inline Type getType() { return type; } - // Get the type of this value. - - Reader asReader() const; - -private: - Type type; - - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - Text::Builder textValue; - Data::Builder dataValue; - DynamicList::Builder listValue; - DynamicEnum enumValue; - DynamicStruct::Builder structValue; - AnyPointer::Builder anyPointerValue; - - mutable DynamicCapability::Client capabilityValue; - // Declared mutable because `Client`s normally cannot be const. - }; - - template ()> struct AsImpl; - // Implementation backing the as() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. - - friend class Orphan; -}; - -class DynamicValue::Pipeline { -public: - typedef DynamicValue Pipelines; - - inline Pipeline(decltype(nullptr) n = nullptr); - inline Pipeline(DynamicStruct::Pipeline&& value); - inline Pipeline(DynamicCapability::Client&& value); - - Pipeline(Pipeline&& other) noexcept; - Pipeline& operator=(Pipeline&& other); - ~Pipeline() noexcept(false); - - template - inline PipelineFor releaseAs() { return AsImpl::apply(*this); } - - inline Type getType() { return type; } - // Get the type of this value. - -private: - Type type; - union { - DynamicStruct::Pipeline structValue; - DynamicCapability::Client capabilityValue; - }; - - template ()> struct AsImpl; - // Implementation backing the releaseAs() method. Needs to be a struct to allow partial - // specialization. Has a method apply() which does the work. -}; - -kj::StringTree KJ_STRINGIFY(const DynamicValue::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicValue::Builder& value); -kj::StringTree KJ_STRINGIFY(DynamicEnum value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicStruct::Builder& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Reader& value); -kj::StringTree KJ_STRINGIFY(const DynamicList::Builder& value); - -// ------------------------------------------------------------------- -// Orphan <-> Dynamic glue - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::STRUCT>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicStruct::Builder get(); - DynamicStruct::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicStruct::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - StructSchema schema; - _::OrphanBuilder builder; - - inline Orphan(StructSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; - friend class MessageBuilder; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::LIST>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicList::Builder get(); - DynamicList::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicList::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - // TODO(someday): Support truncate(). - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - ListSchema schema; - _::OrphanBuilder builder; - - inline Orphan(ListSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - - template () == Kind::INTERFACE>> - inline Orphan(Orphan&& other): schema(Schema::from()), builder(kj::mv(other.builder)) {} - - DynamicCapability::Client get(); - DynamicCapability::Client getReader() const; - - template - Orphan releaseAs(); - // Like DynamicCapability::Client::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - -private: - InterfaceSchema schema; - _::OrphanBuilder builder; - - inline Orphan(InterfaceSchema schema, _::OrphanBuilder&& builder) - : schema(schema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicList; - friend class Orphanage; - friend class Orphan; - friend class Orphan; -}; - -template <> -class Orphan { -public: - inline Orphan(decltype(nullptr) n = nullptr): type(DynamicValue::UNKNOWN) {} - inline Orphan(Void value); - inline Orphan(bool value); - inline Orphan(char value); - inline Orphan(signed char value); - inline Orphan(short value); - inline Orphan(int value); - inline Orphan(long value); - inline Orphan(long long value); - inline Orphan(unsigned char value); - inline Orphan(unsigned short value); - inline Orphan(unsigned int value); - inline Orphan(unsigned long value); - inline Orphan(unsigned long long value); - inline Orphan(float value); - inline Orphan(double value); - inline Orphan(DynamicEnum value); - Orphan(Orphan&&) = default; - template - Orphan(Orphan&&); - Orphan(Orphan&&); - Orphan(void*) = delete; // So Orphan(bool) doesn't accept pointers. - KJ_DISALLOW_COPY(Orphan); - - Orphan& operator=(Orphan&&) = default; - - inline DynamicValue::Type getType() { return type; } - - DynamicValue::Builder get(); - DynamicValue::Reader getReader() const; - - template - Orphan releaseAs(); - // Like DynamicValue::Builder::as(), but coerces the Orphan type. Since Orphans are move-only, - // the original Orphan is no longer valid after this call; ownership is - // transferred to the returned Orphan. - -private: - DynamicValue::Type type; - union { - Void voidValue; - bool boolValue; - int64_t intValue; - uint64_t uintValue; - double floatValue; - DynamicEnum enumValue; - StructSchema structSchema; - ListSchema listSchema; - InterfaceSchema interfaceSchema; - }; - - _::OrphanBuilder builder; - // Only used if `type` is a pointer type. - - Orphan(DynamicValue::Builder value, _::OrphanBuilder&& builder); - Orphan(DynamicValue::Type type, _::OrphanBuilder&& builder) - : type(type), builder(kj::mv(builder)) {} - Orphan(StructSchema structSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::STRUCT), structSchema(structSchema), builder(kj::mv(builder)) {} - Orphan(ListSchema listSchema, _::OrphanBuilder&& builder) - : type(DynamicValue::LIST), listSchema(listSchema), builder(kj::mv(builder)) {} - - template - friend struct _::PointerHelpers; - friend struct DynamicStruct; - friend struct DynamicList; - friend struct AnyPointer; - friend class Orphanage; -}; - -template -inline Orphan::Orphan(Orphan&& other) - : Orphan(other.get(), kj::mv(other.builder)) {} - -inline Orphan::Orphan(Orphan&& other) - : type(DynamicValue::ANY_POINTER), builder(kj::mv(other.builder)) {} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - return Orphan(kj::mv(builder)); -} - -template -Orphan Orphan::releaseAs() { - get().as(); // type check - type = DynamicValue::UNKNOWN; - return Orphan(kj::mv(builder)); -} - -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); -template <> -Orphan Orphan::releaseAs(); - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(DynamicStruct::Builder& t) { - return t.builder; - } -}; - -template <> -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(DynamicList::Builder& t) { - return t.builder; - } -}; - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicStruct::Reader copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicList::Reader copyFrom) const { - return Orphan(copyFrom.getSchema(), - _::OrphanBuilder::copy(arena, capTable, copyFrom.reader)); -} - -template <> -inline Orphan Orphanage::newOrphanCopy( - DynamicCapability::Client copyFrom) const { - return Orphan( - copyFrom.getSchema(), _::OrphanBuilder::copy(arena, capTable, copyFrom.hook->addRef())); -} - -template <> -Orphan Orphanage::newOrphanCopy( - DynamicValue::Reader copyFrom) const; - -namespace _ { // private - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicStruct::Reader getDynamic(PointerReader reader, StructSchema schema); - static DynamicStruct::Builder getDynamic(PointerBuilder builder, StructSchema schema); - static void set(PointerBuilder builder, const DynamicStruct::Reader& value); - static DynamicStruct::Builder init(PointerBuilder builder, StructSchema schema); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, StructSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicList::Reader getDynamic(PointerReader reader, ListSchema schema); - static DynamicList::Builder getDynamic(PointerBuilder builder, ListSchema schema); - static void set(PointerBuilder builder, const DynamicList::Reader& value); - static DynamicList::Builder init(PointerBuilder builder, ListSchema schema, uint size); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, ListSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -template <> -struct PointerHelpers { - // getDynamic() is used when an AnyPointer's get() accessor is passed arguments, because for - // non-dynamic types PointerHelpers::get() takes a default value as the third argument, and we - // don't want people to accidentally be able to provide their own default value. - static DynamicCapability::Client getDynamic(PointerReader reader, InterfaceSchema schema); - static DynamicCapability::Client getDynamic(PointerBuilder builder, InterfaceSchema schema); - static void set(PointerBuilder builder, DynamicCapability::Client& value); - static void set(PointerBuilder builder, DynamicCapability::Client&& value); - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder, InterfaceSchema schema) { - return Orphan(schema, builder.disown()); - } -}; - -} // namespace _ (private) - -template -inline ReaderFor AnyPointer::Reader::getAs(StructSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(ListSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline ReaderFor AnyPointer::Reader::getAs(InterfaceSchema schema) const { - return _::PointerHelpers::getDynamic(reader, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(StructSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(ListSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::getAs(InterfaceSchema schema) { - return _::PointerHelpers::getDynamic(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(StructSchema schema) { - return _::PointerHelpers::init(builder, schema); -} -template -inline BuilderFor AnyPointer::Builder::initAs(ListSchema schema, uint elementCount) { - return _::PointerHelpers::init(builder, schema, elementCount); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicStruct::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicList::Reader value) { - return _::PointerHelpers::set(builder, value); -} -template <> -inline void AnyPointer::Builder::setAs(DynamicCapability::Client value) { - return _::PointerHelpers::set(builder, kj::mv(value)); -} -template <> -void AnyPointer::Builder::adopt(Orphan&& orphan); -template -inline Orphan AnyPointer::Builder::disownAs(StructSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(ListSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} -template -inline Orphan AnyPointer::Builder::disownAs(InterfaceSchema schema) { - return _::PointerHelpers::disown(builder, schema); -} - -// We have to declare the methods below inline because Clang and GCC disagree about how to mangle -// their symbol names. -template <> -inline DynamicStruct::Builder Orphan::getAs(StructSchema schema) { - return DynamicStruct::Builder(schema, builder); -} -template <> -inline DynamicStruct::Reader Orphan::getAsReader( - StructSchema schema) const { - return DynamicStruct::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(StructSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicList::Builder Orphan::getAs(ListSchema schema) { - return DynamicList::Builder(schema, builder); -} -template <> -inline DynamicList::Reader Orphan::getAsReader(ListSchema schema) const { - return DynamicList::Reader(schema, builder); -} -template <> -inline Orphan Orphan::releaseAs(ListSchema schema) { - return Orphan(schema, kj::mv(builder)); -} -template <> -inline DynamicCapability::Client Orphan::getAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline DynamicCapability::Client Orphan::getAsReader( - InterfaceSchema schema) const { - return DynamicCapability::Client(schema, builder.asCapability()); -} -template <> -inline Orphan Orphan::releaseAs( - InterfaceSchema schema) { - return Orphan(schema, kj::mv(builder)); -} - -// ======================================================================================= -// Inline implementation details. - -template -struct ToDynamic_ { - static inline DynamicStruct::Reader apply(const typename T::Reader& value) { - return DynamicStruct::Reader(Schema::from(), value._reader); - } - static inline DynamicStruct::Builder apply(typename T::Builder& value) { - return DynamicStruct::Builder(Schema::from(), value._builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicList::Reader apply(const typename T::Reader& value) { - return DynamicList::Reader(Schema::from(), value.reader); - } - static inline DynamicList::Builder apply(typename T::Builder& value) { - return DynamicList::Builder(Schema::from(), value.builder); - } -}; - -template -struct ToDynamic_ { - static inline DynamicCapability::Client apply(typename T::Client value) { - return DynamicCapability::Client(kj::mv(value)); - } - static inline DynamicCapability::Client apply(typename T::Client&& value) { - return DynamicCapability::Client(kj::mv(value)); - } -}; - -template -ReaderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -BuilderFor>> toDynamic(T&& value) { - return ToDynamic_>::apply(value); -} -template -DynamicTypeFor> toDynamic(T&& value) { - return DynamicEnum(Schema::from>(), static_cast(value)); -} -template -typename DynamicTypeFor>::Client toDynamic(kj::Own&& value) { - return typename FromServer::Client(kj::mv(value)); -} - -inline DynamicValue::Reader::Reader(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Builder::Builder(std::nullptr_t n): type(UNKNOWN) {} - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline Orphan::Orphan(cppType value) \ - : type(DynamicValue::typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Void, VOID, void); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(bool, BOOL, bool); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(signed char, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(short, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(int, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(long long, INT, int); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned char, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned short, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned int, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(unsigned long long, UINT, uint); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(float, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(double, FLOAT, float); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicEnum, ENUM, enum); -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -#define CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(cppType, typeTag, fieldName) \ -inline DynamicValue::Reader::Reader(const cppType::Reader& value) \ - : type(typeTag), fieldName##Value(value) {} \ -inline DynamicValue::Builder::Builder(cppType::Builder value) \ - : type(typeTag), fieldName##Value(value) {} - -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Text, TEXT, text); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(Data, DATA, data); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicList, LIST, list); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(DynamicStruct, STRUCT, struct); -CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR(AnyPointer, ANY_POINTER, anyPointer); - -#undef CAPNP_DECLARE_DYNAMIC_VALUE_CONSTRUCTOR - -inline DynamicValue::Reader::Reader(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Reader::Reader(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -template -inline DynamicValue::Reader::Reader(kj::Own&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client& value) - : type(CAPABILITY), capabilityValue(value) {} -inline DynamicValue::Builder::Builder(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -inline DynamicValue::Reader::Reader(const char* value): Reader(Text::Reader(value)) {} - -#define CAPNP_DECLARE_TYPE(discrim, typeName) \ -template <> \ -struct DynamicValue::Reader::AsImpl { \ - static ReaderFor apply(const Reader& reader); \ -}; \ -template <> \ -struct DynamicValue::Builder::AsImpl { \ - static BuilderFor apply(Builder& builder); \ -}; - -//CAPNP_DECLARE_TYPE(VOID, Void) -CAPNP_DECLARE_TYPE(BOOL, bool) -CAPNP_DECLARE_TYPE(INT8, int8_t) -CAPNP_DECLARE_TYPE(INT16, int16_t) -CAPNP_DECLARE_TYPE(INT32, int32_t) -CAPNP_DECLARE_TYPE(INT64, int64_t) -CAPNP_DECLARE_TYPE(UINT8, uint8_t) -CAPNP_DECLARE_TYPE(UINT16, uint16_t) -CAPNP_DECLARE_TYPE(UINT32, uint32_t) -CAPNP_DECLARE_TYPE(UINT64, uint64_t) -CAPNP_DECLARE_TYPE(FLOAT32, float) -CAPNP_DECLARE_TYPE(FLOAT64, double) - -CAPNP_DECLARE_TYPE(TEXT, Text) -CAPNP_DECLARE_TYPE(DATA, Data) -CAPNP_DECLARE_TYPE(LIST, DynamicList) -CAPNP_DECLARE_TYPE(STRUCT, DynamicStruct) -CAPNP_DECLARE_TYPE(INTERFACE, DynamicCapability) -CAPNP_DECLARE_TYPE(ENUM, DynamicEnum) -CAPNP_DECLARE_TYPE(ANY_POINTER, AnyPointer) -#undef CAPNP_DECLARE_TYPE - -// CAPNP_DECLARE_TYPE(Void) causes gcc 4.7 to segfault. If I do it manually and remove the -// ReaderFor<> and BuilderFor<> wrappers, it works. -template <> -struct DynamicValue::Reader::AsImpl { - static Void apply(const Reader& reader); -}; -template <> -struct DynamicValue::Builder::AsImpl { - static Void apply(Builder& builder); -}; - -template -struct DynamicValue::Reader::AsImpl { - static T apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static T apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Reader apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Builder apply(Builder& builder) { - return builder.as().as(); - } -}; - -template -struct DynamicValue::Reader::AsImpl { - static typename T::Client apply(const Reader& reader) { - return reader.as().as(); - } -}; -template -struct DynamicValue::Builder::AsImpl { - static typename T::Client apply(Builder& builder) { - return builder.as().as(); - } -}; - -template <> -struct DynamicValue::Reader::AsImpl { - static DynamicValue::Reader apply(const Reader& reader) { - return reader; - } -}; -template <> -struct DynamicValue::Builder::AsImpl { - static DynamicValue::Builder apply(Builder& builder) { - return builder; - } -}; - -inline DynamicValue::Pipeline::Pipeline(std::nullptr_t n): type(UNKNOWN) {} -inline DynamicValue::Pipeline::Pipeline(DynamicStruct::Pipeline&& value) - : type(STRUCT), structValue(kj::mv(value)) {} -inline DynamicValue::Pipeline::Pipeline(DynamicCapability::Client&& value) - : type(CAPABILITY), capabilityValue(kj::mv(value)) {} - -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Pipeline apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template -struct DynamicValue::Pipeline::AsImpl { - static typename T::Client apply(Pipeline& pipeline) { - return pipeline.releaseAs().releaseAs(); - } -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; -template <> -struct DynamicValue::Pipeline::AsImpl { - static PipelineFor apply(Pipeline& pipeline); -}; - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicStruct::Reader::as() const { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Reader::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} - -template -typename T::Builder DynamicStruct::Builder::as() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Builder::as() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicStruct::Reader DynamicStruct::Reader::as() const { - return *this; -} -template <> -inline DynamicStruct::Builder DynamicStruct::Builder::as() { - return *this; -} - -inline DynamicStruct::Reader DynamicStruct::Builder::asReader() const { - return DynamicStruct::Reader(schema, builder.asReader()); -} - -template <> -inline AnyStruct::Reader DynamicStruct::Reader::as() const { - return AnyStruct::Reader(reader); -} - -template <> -inline AnyStruct::Builder DynamicStruct::Builder::as() { - return AnyStruct::Builder(builder); -} - -template -typename T::Pipeline DynamicStruct::Pipeline::releaseAs() { - static_assert(kind() == Kind::STRUCT, - "DynamicStruct::Pipeline::releaseAs() can only convert to struct types."); - schema.requireUsableAs(); - return typename T::Pipeline(kj::mv(typeless)); -} - -// ------------------------------------------------------------------- - -template -typename T::Reader DynamicList::Reader::as() const { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Reader::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Reader(reader); -} -template -typename T::Builder DynamicList::Builder::as() { - static_assert(kind() == Kind::LIST, - "DynamicStruct::Builder::as() can only convert to list types."); - schema.requireUsableAs(); - return typename T::Builder(builder); -} - -template <> -inline DynamicList::Reader DynamicList::Reader::as() const { - return *this; -} -template <> -inline DynamicList::Builder DynamicList::Builder::as() { - return *this; -} - -template <> -inline AnyList::Reader DynamicList::Reader::as() const { - return AnyList::Reader(reader); -} - -template <> -inline AnyList::Builder DynamicList::Builder::as() { - return AnyList::Builder(builder); -} - -// ------------------------------------------------------------------- - -template -inline DynamicCapability::Client::Client(T&& client) - : Capability::Client(kj::mv(client)), schema(Schema::from>()) {} - -template -inline DynamicCapability::Client::Client(kj::Own&& server) - : Client(server->getSchema(), kj::mv(server)) {} -template -inline DynamicCapability::Client::Client(InterfaceSchema schema, kj::Own&& server) - : Capability::Client(kj::mv(server)), schema(schema) {} - -template -typename T::Client DynamicCapability::Client::as() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(hook->addRef()); -} - -template -typename T::Client DynamicCapability::Client::releaseAs() { - static_assert(kind() == Kind::INTERFACE, - "DynamicCapability::Client::as() can only convert to interface types."); - schema.requireUsableAs(); - return typename T::Client(kj::mv(hook)); -} - -inline CallContext::CallContext( - CallContextHook& hook, StructSchema paramType, StructSchema resultType) - : hook(&hook), paramType(paramType), resultType(resultType) {} -inline DynamicStruct::Reader CallContext::getParams() { - return hook->getParams().getAs(paramType); -} -inline void CallContext::releaseParams() { - hook->releaseParams(); -} -inline DynamicStruct::Builder CallContext::getResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).getAs(resultType); -} -inline DynamicStruct::Builder CallContext::initResults( - kj::Maybe sizeHint) { - return hook->getResults(sizeHint).initAs(resultType); -} -inline void CallContext::setResults(DynamicStruct::Reader value) { - hook->getResults(value.totalSize()).setAs(value); -} -inline void CallContext::adoptResults(Orphan&& value) { - hook->getResults(MessageSize { 0, 0 }).adopt(kj::mv(value)); -} -inline Orphanage CallContext::getResultsOrphanage( - kj::Maybe sizeHint) { - return Orphanage::getForMessageContaining(hook->getResults(sizeHint)); -} -template -inline kj::Promise CallContext::tailCall( - Request&& tailRequest) { - return hook->tailCall(kj::mv(tailRequest.hook)); -} -inline void CallContext::allowCancellation() { - hook->allowCancellation(); -} - -template <> -inline DynamicCapability::Client Capability::Client::castAs( - InterfaceSchema schema) { - return DynamicCapability::Client(schema, hook->addRef()); -} - -// ------------------------------------------------------------------- - -template -ReaderFor ConstSchema::as() const { - return DynamicValue::Reader(*this).as(); -} - -} // namespace capnp - -#endif // CAPNP_DYNAMIC_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/endian.h b/phonelibs/capnp-cpp/mac/include/capnp/endian.h deleted file mode 100644 index c5a6e63c5a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/endian.h +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ENDIAN_H_ -#define CAPNP_ENDIAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include // memcpy - -namespace capnp { -namespace _ { // private - -// WireValue -// -// Wraps a primitive value as it appears on the wire. Namely, values are little-endian on the -// wire, because little-endian is the most common endianness in modern CPUs. -// -// Note: In general, code that depends cares about byte ordering is bad. See: -// http://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html -// Cap'n Proto is special because it is essentially doing compiler-like things, fussing over -// allocation and layout of memory, in order to squeeze out every last drop of performance. - -#if _MSC_VER -// Assume Windows is little-endian. -// -// TODO(msvc): This is ugly. Maybe refactor later checks to be based on CAPNP_BYTE_ORDER or -// CAPNP_SWAP_BYTES or something, and define that in turn based on _MSC_VER or the GCC -// intrinsics. - -#ifndef __ORDER_BIG_ENDIAN__ -#define __ORDER_BIG_ENDIAN__ 4321 -#endif -#ifndef __ORDER_LITTLE_ENDIAN__ -#define __ORDER_LITTLE_ENDIAN__ 1234 -#endif -#ifndef __BYTE_ORDER__ -#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ -#endif -#endif - -#if CAPNP_REVERSE_ENDIAN -#define CAPNP_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#else -#define CAPNP_WIRE_BYTE_ORDER __ORDER_LITTLE_ENDIAN__ -#define CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER __ORDER_BIG_ENDIAN__ -#endif - -#if defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_WIRE_BYTE_ORDER && \ - !CAPNP_DISABLE_ENDIAN_DETECTION -// CPU is little-endian. We can just read/write the memory directly. - -template -class DirectWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -using WireValue = DirectWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#elif defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == CAPNP_OPPOSITE_OF_WIRE_BYTE_ORDER && \ - defined(__GNUC__) && !CAPNP_DISABLE_ENDIAN_DETECTION -// Big-endian, but GCC's __builtin_bswap() is available. - -// TODO(perf): Use dedicated instructions to read little-endian data on big-endian CPUs that have -// them. - -// TODO(perf): Verify that this code optimizes reasonably. In particular, ensure that the -// compiler optimizes away the memcpy()s and keeps everything in registers. - -template -class SwappingWireValue; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - uint16_t swapped = (value << 8) | (value >> 8); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - // Not all platforms have __builtin_bswap16() for some reason. In particular, it is missing - // on gcc-4.7.3-cygwin32 (but present on gcc-4.8.1-cygwin64). - value = (raw << 8) | (raw >> 8); - } - -private: - uint16_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t swapped = __builtin_bswap32(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap32(raw); - } - -private: - uint32_t value; -}; - -template -class SwappingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t swapped = __builtin_bswap64(value); - T result; - memcpy(&result, &swapped, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - value = __builtin_bswap64(raw); - } - -private: - uint64_t value; -}; - -template -using WireValue = SwappingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#else -// Unknown endianness. Fall back to bit shifts. - -#if !CAPNP_DISABLE_ENDIAN_DETECTION -#if _MSC_VER -#pragma message("Couldn't detect endianness of your platform. Using unoptimized fallback implementation.") -#pragma message("Consider changing this code to detect your platform and send us a patch!") -#else -#warning "Couldn't detect endianness of your platform. Using unoptimized fallback implementation." -#warning "Consider changing this code to detect your platform and send us a patch!" -#endif -#endif // !CAPNP_DISABLE_ENDIAN_DETECTION - -template -class ShiftingWireValue; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { return value; } - KJ_ALWAYS_INLINE(void set(T newValue)) { value = newValue; } - -private: - T value; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint16_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint16_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - } - -private: - union { - byte bytes[2]; - uint16_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint32_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint32_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - } - -private: - union { - byte bytes[4]; - uint32_t align; - }; -}; - -template -class ShiftingWireValue { -public: - KJ_ALWAYS_INLINE(T get() const) { - uint64_t raw = (static_cast(bytes[0]) ) | - (static_cast(bytes[1]) << 8) | - (static_cast(bytes[2]) << 16) | - (static_cast(bytes[3]) << 24) | - (static_cast(bytes[4]) << 32) | - (static_cast(bytes[5]) << 40) | - (static_cast(bytes[6]) << 48) | - (static_cast(bytes[7]) << 56); - T result; - memcpy(&result, &raw, sizeof(T)); - return result; - } - KJ_ALWAYS_INLINE(void set(T newValue)) { - uint64_t raw; - memcpy(&raw, &newValue, sizeof(T)); - bytes[0] = raw; - bytes[1] = raw >> 8; - bytes[2] = raw >> 16; - bytes[3] = raw >> 24; - bytes[4] = raw >> 32; - bytes[5] = raw >> 40; - bytes[6] = raw >> 48; - bytes[7] = raw >> 56; - } - -private: - union { - byte bytes[8]; - uint64_t align; - }; -}; - -template -using WireValue = ShiftingWireValue; -// To prevent ODR problems when endian-test, endian-reverse-test, and endian-fallback-test are -// linked together, we define each implementation with a different name and define an alias to the -// one we want to use. - -#endif - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_ENDIAN_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/ez-rpc.h b/phonelibs/capnp-cpp/mac/include/capnp/ez-rpc.h deleted file mode 100644 index fba5ace582..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/ez-rpc.h +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_EZ_RPC_H_ -#define CAPNP_EZ_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" - -struct sockaddr; - -namespace kj { class AsyncIoProvider; class LowLevelAsyncIoProvider; } - -namespace capnp { - -class EzRpcContext; - -class EzRpcClient { - // Super-simple interface for setting up a Cap'n Proto RPC client. Example: - // - // # Cap'n Proto schema - // interface Adder { - // add @0 (left :Int32, right :Int32) -> (value :Int32); - // } - // - // // C++ client - // int main() { - // capnp::EzRpcClient client("localhost:3456"); - // Adder::Client adder = client.getMain(); - // auto request = adder.addRequest(); - // request.setLeft(12); - // request.setRight(34); - // auto response = request.send().wait(client.getWaitScope()); - // assert(response.getValue() == 46); - // return 0; - // } - // - // // C++ server - // class AdderImpl final: public Adder::Server { - // public: - // kj::Promise add(AddContext context) override { - // auto params = context.getParams(); - // context.getResults().setValue(params.getLeft() + params.getRight()); - // return kj::READY_NOW; - // } - // }; - // - // int main() { - // capnp::EzRpcServer server(kj::heap(), "*:3456"); - // kj::NEVER_DONE.wait(server.getWaitScope()); - // } - // - // This interface is easy, but it hides a lot of useful features available from the lower-level - // classes: - // - The server can only export a small set of public, singleton capabilities under well-known - // string names. This is fine for transient services where no state needs to be kept between - // connections, but hides the power of Cap'n Proto when it comes to long-lived resources. - // - EzRpcClient/EzRpcServer automatically set up a `kj::EventLoop` and make it current for the - // thread. Only one `kj::EventLoop` can exist per thread, so you cannot use these interfaces - // if you wish to set up your own event loop. (However, you can safely create multiple - // EzRpcClient / EzRpcServer objects in a single thread; they will make sure to make no more - // than one EventLoop.) - // - These classes only support simple two-party connections, not multilateral VatNetworks. - // - These classes only support communication over a raw, unencrypted socket. If you want to - // build on an abstract stream (perhaps one which supports encryption), you must use the - // lower-level interfaces. - // - // Some of these restrictions will probably be lifted in future versions, but some things will - // always require using the low-level interfaces directly. If you are interested in working - // at a lower level, start by looking at these interfaces: - // - `kj::setupAsyncIo()` in `kj/async-io.h`. - // - `RpcSystem` in `capnp/rpc.h`. - // - `TwoPartyVatNetwork` in `capnp/rpc-twoparty.h`. - -public: - explicit EzRpcClient(kj::StringPtr serverAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()); - // Construct a new EzRpcClient and connect to the given address. The connection is formed in - // the background -- if it fails, calls to capabilities returned by importCap() will fail with an - // appropriate exception. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, the port is required in `serverAddress`. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcClient(const struct sockaddr* serverAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but connects to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - explicit EzRpcClient(int socketFd, ReaderOptions readerOpts = ReaderOptions()); - // Create a client on top of an already-connected socket. - // `readerOpts` acts as in the first constructor. - - ~EzRpcClient() noexcept(false); - - template - typename Type::Client getMain(); - Capability::Client getMain(); - // Get the server's main (aka "bootstrap") interface. - - template - typename Type::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - Capability::Client importCap(kj::StringPtr name) - KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); - // ** DEPRECATED ** - // - // Ask the sever for the capability with the given name. You may specify a type to automatically - // down-cast to that type. It is up to you to specify the correct expected type. - // - // Named interfaces are deprecated. The new preferred usage pattern is for the server to export - // a "main" interface which itself has methods for getting any other interfaces. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -class EzRpcServer { - // The server counterpart to `EzRpcClient`. See `EzRpcClient` for an example. - -public: - explicit EzRpcServer(Capability::Client mainInterface, kj::StringPtr bindAddress, - uint defaultPort = 0, ReaderOptions readerOpts = ReaderOptions()); - // Construct a new `EzRpcServer` that binds to the given address. An address of "*" means to - // bind to all local addresses. - // - // `defaultPort` is the IP port number to use if `serverAddress` does not include it explicitly. - // If unspecified, a port is chosen automatically, and you must call getPort() to find out what - // it is. - // - // The address is parsed by `kj::Network` in `kj/async-io.h`. See that interface for more info - // on the address format, but basically it's what you'd expect. - // - // The server might not begin listening immediately, especially if `bindAddress` needs to be - // resolved. If you need to wait until the server is definitely up, wait on the promise returned - // by `getPort()`. - // - // `readerOpts` is the ReaderOptions structure used to read each incoming message on the - // connection. Setting this may be necessary if you need to receive very large individual - // messages or messages. However, it is recommended that you instead think about how to change - // your protocol to send large data blobs in multiple small chunks -- this is much better for - // both security and performance. See `ReaderOptions` in `message.h` for more details. - - EzRpcServer(Capability::Client mainInterface, struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()); - // Like the above constructor, but binds to an already-resolved socket address. Any address - // format supported by `kj::Network` in `kj/async-io.h` is accepted. - - EzRpcServer(Capability::Client mainInterface, int socketFd, uint port, - ReaderOptions readerOpts = ReaderOptions()); - // Create a server on top of an already-listening socket (i.e. one on which accept() may be - // called). `port` is returned by `getPort()` -- it serves no other purpose. - // `readerOpts` acts as in the other two above constructors. - - explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(struct sockaddr* bindAddress, uint addrSize, - ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - EzRpcServer(int socketFd, uint port, ReaderOptions readerOpts = ReaderOptions()) - KJ_DEPRECATED("Please specify a main interface for your server."); - - ~EzRpcServer() noexcept(false); - - void exportCap(kj::StringPtr name, Capability::Client cap); - // Export a capability publicly under the given name, so that clients can import it. - // - // Keep in mind that you can implicitly convert `kj::Own&&` to - // `Capability::Client`, so it's typical to pass something like - // `kj::heap()` as the second parameter. - - kj::Promise getPort(); - // Get the IP port number on which this server is listening. This promise won't resolve until - // the server is actually listening. If the address was not an IP address (e.g. it was a Unix - // domain socket) then getPort() resolves to zero. - - kj::WaitScope& getWaitScope(); - // Get the `WaitScope` for the client's `EventLoop`, which allows you to synchronously wait on - // promises. - - kj::AsyncIoProvider& getIoProvider(); - // Get the underlying AsyncIoProvider set up by the RPC system. This is useful if you want - // to do some non-RPC I/O in asynchronous fashion. - - kj::LowLevelAsyncIoProvider& getLowLevelIoProvider(); - // Get the underlying LowLevelAsyncIoProvider set up by the RPC system. This is useful if you - // want to do some non-RPC I/O in asynchronous fashion. - -private: - struct Impl; - kj::Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -inline typename Type::Client EzRpcClient::getMain() { - return getMain().castAs(); -} - -template -inline typename Type::Client EzRpcClient::importCap(kj::StringPtr name) { - return importCap(name).castAs(); -} - -} // namespace capnp - -#endif // CAPNP_EZ_RPC_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/generated-header-support.h b/phonelibs/capnp-cpp/mac/include/capnp/generated-header-support.h deleted file mode 100644 index 51b6dd7c11..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/generated-header-support.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is included from all generated headers. - -#ifndef CAPNP_GENERATED_HEADER_SUPPORT_H_ -#define CAPNP_GENERATED_HEADER_SUPPORT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "raw-schema.h" -#include "layout.h" -#include "list.h" -#include "orphan.h" -#include "pointer-helpers.h" -#include "any.h" -#include -#include - -namespace capnp { - -class MessageBuilder; // So that it can be declared a friend. - -template -struct ToDynamic_; // Defined in dynamic.h, needs to be declared as everyone's friend. - -struct DynamicStruct; // So that it can be declared a friend. - -struct Capability; // To declare brandBindingFor() - -namespace _ { // private - -#if !CAPNP_LITE - -template -inline const RawSchema& rawSchema() { - return *CapnpPrivate::schema; -} -template ::typeId> -inline const RawSchema& rawSchema() { - return *schemas::EnumInfo::schema; -} - -template -inline const RawBrandedSchema& rawBrandedSchema() { - return *CapnpPrivate::brand(); -} -template ::typeId> -inline const RawBrandedSchema& rawBrandedSchema() { - return schemas::EnumInfo::schema->defaultBrand; -} - -template -struct ChooseBrand; -// If all of `Params` are `AnyPointer`, return the type's default brand. Otherwise, return a -// specific brand instance. TypeTag is the _capnpPrivate struct for the type in question. - -template -struct ChooseBrand { - // All params were AnyPointer. No specific brand needed. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::schema->defaultBrand; } -}; - -template -struct ChooseBrand: public ChooseBrand {}; -// The first parameter is AnyPointer, so recurse to check the rest. - -template -struct ChooseBrand { - // At least one parameter is not AnyPointer, so use the specificBrand constant. - static constexpr _::RawBrandedSchema const* brand() { return &TypeTag::specificBrand; } -}; - -template ()> -struct BrandBindingFor_; - -#define HANDLE_TYPE(Type, which) \ - template <> \ - struct BrandBindingFor_ { \ - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { \ - return { which, listDepth, nullptr }; \ - } \ - } -HANDLE_TYPE(Void, 0); -HANDLE_TYPE(bool, 1); -HANDLE_TYPE(int8_t, 2); -HANDLE_TYPE(int16_t, 3); -HANDLE_TYPE(int32_t, 4); -HANDLE_TYPE(int64_t, 5); -HANDLE_TYPE(uint8_t, 6); -HANDLE_TYPE(uint16_t, 7); -HANDLE_TYPE(uint32_t, 8); -HANDLE_TYPE(uint64_t, 9); -HANDLE_TYPE(float, 10); -HANDLE_TYPE(double, 11); -#undef HANDLE_TYPE - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 12, listDepth, nullptr }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 13, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_, Kind::LIST> { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return BrandBindingFor_::get(listDepth + 1); - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 15, listDepth, nullptr }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 16, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 17, listDepth, T::_capnpPrivate::brand() }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 0 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 1 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 2 }; - } -}; - -template <> -struct BrandBindingFor_ { - static constexpr RawBrandedSchema::Binding get(uint16_t listDepth) { - return { 18, listDepth, 0, 3 }; - } -}; - -template -constexpr RawBrandedSchema::Binding brandBindingFor() { - return BrandBindingFor_::get(0); -} - -kj::StringTree structString(StructReader reader, const RawBrandedSchema& schema); -kj::String enumString(uint16_t value, const RawBrandedSchema& schema); -// Declared here so that we can declare inline stringify methods on generated types. -// Defined in stringify.c++, which depends on dynamic.c++, which is allowed not to be linked in. - -template -inline kj::StringTree structString(StructReader reader) { - return structString(reader, rawBrandedSchema()); -} -template -inline kj::String enumString(T value) { - return enumString(static_cast(value), rawBrandedSchema()); -} - -#endif // !CAPNP_LITE - -// TODO(cleanup): Unify ConstStruct and ConstList. -template -class ConstStruct { -public: - ConstStruct() = delete; - KJ_DISALLOW_COPY(ConstStruct); - inline explicit constexpr ConstStruct(const word* ptr): ptr(ptr) {} - - inline typename T::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs(); - } - - inline operator typename T::Reader() const { return get(); } - inline typename T::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstList { -public: - ConstList() = delete; - KJ_DISALLOW_COPY(ConstList); - inline explicit constexpr ConstList(const word* ptr): ptr(ptr) {} - - inline typename List::Reader get() const { - return AnyPointer::Reader(PointerReader::getRootUnchecked(ptr)).getAs>(); - } - - inline operator typename List::Reader() const { return get(); } - inline typename List::Reader operator*() const { return get(); } - inline TemporaryPointer::Reader> operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -class ConstText { -public: - ConstText() = delete; - KJ_DISALLOW_COPY(ConstText); - inline explicit constexpr ConstText(const word* ptr): ptr(ptr) {} - - inline Text::Reader get() const { - return Text::Reader(reinterpret_cast(ptr), size); - } - - inline operator Text::Reader() const { return get(); } - inline Text::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - - inline kj::StringPtr toString() const { - return get(); - } - -private: - const word* ptr; -}; - -template -inline kj::StringPtr KJ_STRINGIFY(const ConstText& s) { - return s.get(); -} - -template -class ConstData { -public: - ConstData() = delete; - KJ_DISALLOW_COPY(ConstData); - inline explicit constexpr ConstData(const word* ptr): ptr(ptr) {} - - inline Data::Reader get() const { - return Data::Reader(reinterpret_cast(ptr), size); - } - - inline operator Data::Reader() const { return get(); } - inline Data::Reader operator*() const { return get(); } - inline TemporaryPointer operator->() const { return get(); } - -private: - const word* ptr; -}; - -template -inline auto KJ_STRINGIFY(const ConstData& s) -> decltype(kj::toCharSequence(s.get())) { - return kj::toCharSequence(s.get()); -} - -} // namespace _ (private) - -template -inline constexpr uint64_t typeId() { return CapnpPrivate::typeId; } -template ::typeId> -inline constexpr uint64_t typeId() { return id; } -// typeId() returns the type ID as defined in the schema. Works with structs, enums, and -// interfaces. - -template -inline constexpr uint sizeInWords() { - // Return the size, in words, of a Struct type, if allocated free-standing (not in a list). - // May be useful for pre-computing space needed in order to precisely allocate messages. - - return unbound((upgradeBound(_::structSize().data) + - _::structSize().pointers * WORDS_PER_POINTER) / WORDS); -} - -} // namespace capnp - -#if _MSC_VER -// MSVC doesn't understand floating-point constexpr yet. -// -// TODO(msvc): Remove this hack when MSVC is fixed. -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) = value -#else -#define CAPNP_NON_INT_CONSTEXPR_DECL_INIT(value) = value -#define CAPNP_NON_INT_CONSTEXPR_DEF_INIT(value) -#endif - -#if _MSC_VER -// TODO(msvc): A little hack to allow MSVC to use C++14 return type deduction in cases where the -// explicit type exposes bugs in the compiler. -#define CAPNP_AUTO_IF_MSVC(...) auto -#else -#define CAPNP_AUTO_IF_MSVC(...) __VA_ARGS__ -#endif - -#if CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::kj::str(static_cast(value)); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - } - -#if _MSC_VER -// TODO(msvc): MSVC dosen't expect constexprs to have definitions. -#define CAPNP_DEFINE_ENUM(type, id) -#else -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId -#endif - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } - -#else // CAPNP_LITE - -#define CAPNP_DECLARE_SCHEMA(id) \ - extern ::capnp::word const* const bp_##id; \ - extern const ::capnp::_::RawSchema s_##id - -#define CAPNP_DECLARE_ENUM(type, id) \ - inline ::kj::String KJ_STRINGIFY(type##_##id value) { \ - return ::capnp::_::enumString(value); \ - } \ - template <> struct EnumInfo { \ - struct IsEnum; \ - static constexpr uint64_t typeId = 0x##id; \ - static inline ::capnp::word const* encodedSchema() { return bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &s_##id; \ - } -#define CAPNP_DEFINE_ENUM(type, id) \ - constexpr uint64_t EnumInfo::typeId; \ - constexpr ::capnp::_::RawSchema const* EnumInfo::schema - -#define CAPNP_DECLARE_STRUCT_HEADER(id, dataWordSize_, pointerCount_) \ - struct IsStruct; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::STRUCT; \ - static constexpr uint16_t dataWordSize = dataWordSize_; \ - static constexpr uint16_t pointerCount = pointerCount_; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#define CAPNP_DECLARE_INTERFACE_HEADER(id) \ - struct IsInterface; \ - static constexpr uint64_t typeId = 0x##id; \ - static constexpr ::capnp::Kind kind = ::capnp::Kind::INTERFACE; \ - static inline ::capnp::word const* encodedSchema() { return ::capnp::schemas::bp_##id; } \ - static constexpr ::capnp::_::RawSchema const* schema = &::capnp::schemas::s_##id; - -#endif // CAPNP_LITE, else - -#endif // CAPNP_GENERATED_HEADER_SUPPORT_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/layout.h b/phonelibs/capnp-cpp/mac/include/capnp/layout.h deleted file mode 100644 index 99dc533b2b..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/layout.h +++ /dev/null @@ -1,1274 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file is NOT intended for use by clients, except in generated code. -// -// This file defines low-level, non-type-safe classes for traversing the Cap'n Proto memory layout -// (which is also its wire format). Code generated by the Cap'n Proto compiler uses these classes, -// as does other parts of the Cap'n proto library which provide a higher-level interface for -// dynamic introspection. - -#ifndef CAPNP_LAYOUT_H_ -#define CAPNP_LAYOUT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include -#include "common.h" -#include "blob.h" -#include "endian.h" - -#if (defined(__mips__) || defined(__hppa__)) && !defined(CAPNP_CANONICALIZE_NAN) -#define CAPNP_CANONICALIZE_NAN 1 -// Explicitly detect NaNs and canonicalize them to the quiet NaN value as would be returned by -// __builtin_nan("") on systems implementing the IEEE-754 recommended (but not required) NaN -// signalling/quiet differentiation (such as x86). Unfortunately, some architectures -- in -// particular, MIPS -- represent quiet vs. signalling nans differently than the rest of the world. -// Canonicalizing them makes output consistent (which is important!), but hurts performance -// slightly. -// -// Note that trying to convert MIPS NaNs to standard NaNs without losing data doesn't work. -// Signaling vs. quiet is indicated by a bit, with the meaning being the opposite on MIPS vs. -// everyone else. It would be great if we could just flip that bit, but we can't, because if the -// significand is all-zero, then the value is infinity rather than NaN. This means that on most -// machines, where the bit indicates quietness, there is one more quiet NaN value than signalling -// NaN value, whereas on MIPS there is one more sNaN than qNaN, and thus there is no isomorphic -// mapping that properly preserves quietness. Instead of doing something hacky, we just give up -// and blow away NaN payloads, because no one uses them anyway. -#endif - -namespace capnp { - -#if !CAPNP_LITE -class ClientHook; -#endif // !CAPNP_LITE - -namespace _ { // private - -class PointerBuilder; -class PointerReader; -class StructBuilder; -class StructReader; -class ListBuilder; -class ListReader; -class OrphanBuilder; -struct WirePointer; -struct WireHelpers; -class SegmentReader; -class SegmentBuilder; -class Arena; -class BuilderArena; - -// ============================================================================= - -#if CAPNP_DEBUG_TYPES -typedef kj::UnitRatio, BitLabel, ElementLabel> BitsPerElementTableType; -#else -typedef uint BitsPerElementTableType; -#endif - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType dataBitsPerElement(ElementSize size) { - return _::BITS_PER_ELEMENT_TABLE[static_cast(size)]; -} - -inline constexpr PointersPerElementN<1> pointersPerElement(ElementSize size) { - return size == ElementSize::POINTER - ? PointersPerElementN<1>(ONE * POINTERS / ELEMENTS) - : PointersPerElementN<1>(ZERO * POINTERS / ELEMENTS); -} - -static constexpr BitsPerElementTableType BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[8] = { - bounded< 0>() * BITS / ELEMENTS, - bounded< 1>() * BITS / ELEMENTS, - bounded< 8>() * BITS / ELEMENTS, - bounded<16>() * BITS / ELEMENTS, - bounded<32>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded<64>() * BITS / ELEMENTS, - bounded< 0>() * BITS / ELEMENTS -}; - -inline KJ_CONSTEXPR() BitsPerElementTableType bitsPerElementIncludingPointers(ElementSize size) { - return _::BITS_PER_ELEMENT_INCLUDING_PONITERS_TABLE[static_cast(size)]; -} - -template struct ElementSizeForByteSize; -template <> struct ElementSizeForByteSize<1> { static constexpr ElementSize value = ElementSize::BYTE; }; -template <> struct ElementSizeForByteSize<2> { static constexpr ElementSize value = ElementSize::TWO_BYTES; }; -template <> struct ElementSizeForByteSize<4> { static constexpr ElementSize value = ElementSize::FOUR_BYTES; }; -template <> struct ElementSizeForByteSize<8> { static constexpr ElementSize value = ElementSize::EIGHT_BYTES; }; - -template struct ElementSizeForType { - static constexpr ElementSize value = - // Primitive types that aren't special-cased below can be determined from sizeof(). - CAPNP_KIND(T) == Kind::PRIMITIVE ? ElementSizeForByteSize::value : - CAPNP_KIND(T) == Kind::ENUM ? ElementSize::TWO_BYTES : - CAPNP_KIND(T) == Kind::STRUCT ? ElementSize::INLINE_COMPOSITE : - - // Everything else is a pointer. - ElementSize::POINTER; -}; - -// Void and bool are special. -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::VOID; }; -template <> struct ElementSizeForType { static constexpr ElementSize value = ElementSize::BIT; }; - -// Lists and blobs are pointers, not structs. -template struct ElementSizeForType> { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; -template <> struct ElementSizeForType { - static constexpr ElementSize value = ElementSize::POINTER; -}; - -template -inline constexpr ElementSize elementSizeForType() { - return ElementSizeForType::value; -} - -struct MessageSizeCounts { - WordCountN<61, uint64_t> wordCount; // 2^64 bytes - uint capCount; - - MessageSizeCounts& operator+=(const MessageSizeCounts& other) { - // OK to truncate unchecked because this class is used to count actual stuff in memory, and - // we couldn't possibly have anywhere near 2^61 words. - wordCount = assumeBits<61>(wordCount + other.wordCount); - capCount += other.capCount; - return *this; - } - - void addWords(WordCountN<61, uint64_t> other) { - wordCount = assumeBits<61>(wordCount + other); - } - - MessageSize asPublic() { - return MessageSize { unbound(wordCount / WORDS), capCount }; - } -}; - -// ============================================================================= - -template -union AlignedData { - // Useful for declaring static constant data blobs as an array of bytes, but forcing those - // bytes to be word-aligned. - - uint8_t bytes[wordCount * sizeof(word)]; - word words[wordCount]; -}; - -struct StructSize { - StructDataWordCount data; - StructPointerCount pointers; - - inline constexpr WordCountN<17> total() const { return data + pointers * WORDS_PER_POINTER; } - - StructSize() = default; - inline constexpr StructSize(StructDataWordCount data, StructPointerCount pointers) - : data(data), pointers(pointers) {} -}; - -template -inline constexpr StructSize structSize() { - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize(bounded(CapnpPrivate::dataWordSize) * WORDS, - bounded(CapnpPrivate::pointerCount) * POINTERS); -} - -template > -inline constexpr StructSize minStructSizeForElement() { - // If T is a struct, return its struct size. Otherwise return the minimum struct size big enough - // to hold a T. - - return StructSize( - dataBitsPerElement(elementSizeForType()) * ELEMENTS > ZERO * BITS - ? StructDataWordCount(ONE * WORDS) : StructDataWordCount(ZERO * WORDS), - pointersPerElement(elementSizeForType()) * ELEMENTS); -} - -// ------------------------------------------------------------------- -// Masking of default values - -template struct Mask_; -template struct Mask_ { typedef T Type; }; -template struct Mask_ { typedef uint16_t Type; }; -template <> struct Mask_ { typedef uint32_t Type; }; -template <> struct Mask_ { typedef uint64_t Type; }; - -template struct Mask_ { - // Union discriminants end up here. - static_assert(sizeof(T) == 2, "Don't know how to mask this type."); - typedef uint16_t Type; -}; - -template -using Mask = typename Mask_::Type; - -template -KJ_ALWAYS_INLINE(Mask mask(T value, Mask mask)); -template -KJ_ALWAYS_INLINE(T unmask(Mask value, Mask mask)); - -template -inline Mask mask(T value, Mask mask) { - return static_cast >(value) ^ mask; -} - -template <> -inline uint32_t mask(float value, uint32_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7fc00000u ^ mask; - } -#endif - - uint32_t i; - static_assert(sizeof(i) == sizeof(value), "float is not 32 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template <> -inline uint64_t mask(double value, uint64_t mask) { -#if CAPNP_CANONICALIZE_NAN - if (value != value) { - return 0x7ff8000000000000ull ^ mask; - } -#endif - - uint64_t i; - static_assert(sizeof(i) == sizeof(value), "double is not 64 bits?"); - memcpy(&i, &value, sizeof(value)); - return i ^ mask; -} - -template -inline T unmask(Mask value, Mask mask) { - return static_cast(value ^ mask); -} - -template <> -inline float unmask(uint32_t value, uint32_t mask) { - value ^= mask; - float result; - static_assert(sizeof(result) == sizeof(value), "float is not 32 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -template <> -inline double unmask(uint64_t value, uint64_t mask) { - value ^= mask; - double result; - static_assert(sizeof(result) == sizeof(value), "double is not 64 bits?"); - memcpy(&result, &value, sizeof(value)); - return result; -} - -// ------------------------------------------------------------------- - -class CapTableReader { -public: -#if !CAPNP_LITE - virtual kj::Maybe> extractCap(uint index) = 0; - // Extract the capability at the given index. If the index is invalid, returns null. -#endif // !CAPNP_LITE -}; - -class CapTableBuilder: public CapTableReader { -public: -#if !CAPNP_LITE - virtual uint injectCap(kj::Own&& cap) = 0; - // Add the capability to the message and return its index. If the same ClientHook is injected - // twice, this may return the same index both times, but in this case dropCap() needs to be - // called an equal number of times to actually remove the cap. - - virtual void dropCap(uint index) = 0; - // Remove a capability injected earlier. Called when the pointer is overwritten or zero'd out. -#endif // !CAPNP_LITE -}; - -// ------------------------------------------------------------------- - -class PointerBuilder: public kj::DisallowConstCopy { - // Represents a single pointer, usually embedded in a struct or a list. - -public: - inline PointerBuilder(): segment(nullptr), capTable(nullptr), pointer(nullptr) {} - - static inline PointerBuilder getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location); - // Get a PointerBuilder representing a message root located in the given segment at the given - // location. - - inline bool isNull() { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructBuilder getStruct(StructSize size, const word* defaultValue); - ListBuilder getList(ElementSize elementSize, const word* defaultValue); - ListBuilder getStructList(StructSize elementSize, const word* defaultValue); - ListBuilder getListAnySize(const word* defaultValue); - template typename T::Builder getBlob( - const void* defaultValue, ByteCount defaultSize); -#if !CAPNP_LITE - kj::Own getCapability(); -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, initialize it to a copy of the default value. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - StructBuilder initStruct(StructSize size); - ListBuilder initList(ElementSize elementSize, ElementCount elementCount); - ListBuilder initStructList(ElementCount elementCount, StructSize size); - template typename T::Builder initBlob(ByteCount size); - // Init methods: Initialize the pointer to a newly-allocated object, discarding the existing - // object. - - void setStruct(const StructReader& value, bool canonical = false); - void setList(const ListReader& value, bool canonical = false); - template void setBlob(typename T::Reader value); -#if !CAPNP_LITE - void setCapability(kj::Own&& cap); -#endif // !CAPNP_LITE - // Set methods: Initialize the pointer to a newly-allocated copy of the given value, discarding - // the existing object. - - void adopt(OrphanBuilder&& orphan); - // Set the pointer to point at the given orphaned value. - - OrphanBuilder disown(); - // Set the pointer to null and return its previous value as an orphan. - - void clear(); - // Clear the pointer to null, discarding its previous value. - - void transferFrom(PointerBuilder other); - // Equivalent to `adopt(other.disown())`. - - void copyFrom(PointerReader other, bool canonical = false); - // Equivalent to `set(other.get())`. - // If you set the canonical flag, it will attempt to lay the target out - // canonically, provided enough space is available. - - PointerReader asReader() const; - - BuilderArena* getArena() const; - // Get the arena containing this pointer. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the pointer resides. - CapTableBuilder* capTable; // Table of capability indexes. - WirePointer* pointer; // Pointer to the pointer. - - inline PointerBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, WirePointer* pointer) - : segment(segment), capTable(capTable), pointer(pointer) {} - - friend class StructBuilder; - friend class ListBuilder; - friend class OrphanBuilder; -}; - -class PointerReader { -public: - inline PointerReader() - : segment(nullptr), capTable(nullptr), pointer(nullptr), nestingLimit(0x7fffffff) {} - - static PointerReader getRoot(SegmentReader* segment, CapTableReader* capTable, - const word* location, int nestingLimit); - // Get a PointerReader representing a message root located in the given segment at the given - // location. - - static inline PointerReader getRootUnchecked(const word* location); - // Get a PointerReader for an unchecked message. - - MessageSizeCounts targetSize() const; - // Return the total size of the target object and everything to which it points. Does not count - // far pointer overhead. This is useful for deciding how much space is needed to copy the object - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - inline bool isNull() const { return getPointerType() == PointerType::NULL_; } - PointerType getPointerType() const; - - StructReader getStruct(const word* defaultValue) const; - ListReader getList(ElementSize expectedElementSize, const word* defaultValue) const; - ListReader getListAnySize(const word* defaultValue) const; - template - typename T::Reader getBlob(const void* defaultValue, ByteCount defaultSize) const; -#if !CAPNP_LITE - kj::Own getCapability() const; -#endif // !CAPNP_LITE - // Get methods: Get the value. If it is null, return the default value instead. - // The default value is encoded as an "unchecked message" for structs, lists, and objects, or a - // simple byte array for blobs. - - const word* getUnchecked() const; - // If this is an unchecked message, get a word* pointing at the location of the pointer. This - // word* can actually be passed to readUnchecked() to read the designated sub-object later. If - // this isn't an unchecked message, throws an exception. - - kj::Maybe getArena() const; - // Get the arena containing this pointer. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - PointerReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the pointer resides. - CapTableReader* capTable; // Table of capability indexes. - const WirePointer* pointer; // Pointer to the pointer. null = treat as null pointer. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline PointerReader(SegmentReader* segment, CapTableReader* capTable, - const WirePointer* pointer, int nestingLimit) - : segment(segment), capTable(capTable), pointer(pointer), nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListReader; - friend class PointerBuilder; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class StructBuilder: public kj::DisallowConstCopy { -public: - inline StructBuilder(): segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr) {} - - inline word* getLocation() { return reinterpret_cast(data); } - // Get the object's location. Only valid for independently-allocated objects (i.e. not list - // elements). - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListBuilder getPointerSectionAsList(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset)); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset)); - // Gets the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask)); - // Like getDataField() but applies the given XOR mask to the data on load. Used for reading - // fields with non-zero default values. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, kj::NoInfer value)); - // Sets the data field value at the given offset. - - template - KJ_ALWAYS_INLINE(void setDataField(StructDataOffset offset, - kj::NoInfer value, Mask mask)); - // Like setDataField() but applies the given XOR mask before storing. Used for writing fields - // with non-zero default values. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerField(StructPointerOffset ptrIndex)); - // Get a builder for a pointer field given the index within the pointer section. - - void clearAll(); - // Clear all pointers and data. - - void transferContentFrom(StructBuilder other); - // Adopt all pointers from `other`, and also copy all data. If `other`'s sections are larger - // than this, the extra data is not transferred, meaning there is a risk of data loss when - // transferring from messages built with future versions of the protocol. - - void copyContentFrom(StructReader other); - // Copy content from `other`. If `other`'s sections are larger than this, the extra data is not - // copied, meaning there is a risk of data loss when copying from messages built with future - // versions of the protocol. - - StructReader asReader() const; - // Gets a StructReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - StructBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the struct resides. - CapTableBuilder* capTable; // Table of capability indexes. - void* data; // Pointer to the encoded data. - WirePointer* pointers; // Pointer to the encoded pointers. - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - inline StructBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, - void* data, WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount) {} - - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class StructReader { -public: - inline StructReader() - : segment(nullptr), capTable(nullptr), data(nullptr), pointers(nullptr), - dataSize(ZERO * BITS), pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - inline StructReader(kj::ArrayPtr data) - : segment(nullptr), capTable(nullptr), data(data.begin()), pointers(nullptr), - dataSize(assumeBits(data.size()) * WORDS * BITS_PER_WORD), - pointerCount(ZERO * POINTERS), nestingLimit(0x7fffffff) {} - - const void* getLocation() const { return data; } - - inline StructDataBitCount getDataSectionSize() const { return dataSize; } - inline StructPointerCount getPointerSectionSize() const { return pointerCount; } - inline kj::ArrayPtr getDataSectionAsBlob(); - inline _::ListReader getPointerSectionAsList(); - - kj::Array canonicalize(); - - template - KJ_ALWAYS_INLINE(bool hasDataField(StructDataOffset offset) const); - // Return true if the field is set to something other than its default value. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset) const); - // Get the data field value of the given type at the given offset. The offset is measured in - // multiples of the field size, determined by the type. Returns zero if the offset is past the - // end of the struct's data section. - - template - KJ_ALWAYS_INLINE(T getDataField(StructDataOffset offset, Mask mask) const); - // Like getDataField(offset), but applies the given XOR mask to the result. Used for reading - // fields with non-zero default values. - - KJ_ALWAYS_INLINE(PointerReader getPointerField(StructPointerOffset ptrIndex) const); - // Get a reader for a pointer field given the index within the pointer section. If the index - // is out-of-bounds, returns a null pointer. - - MessageSizeCounts totalSize() const; - // Return the total size of the struct and everything to which it points. Does not count far - // pointer overhead. This is useful for deciding how much space is needed to copy the struct - // into a flat array. However, the caller is advised NOT to treat this value as secure. Instead, - // use the result as a hint for allocating the first segment, do the copy, and then throw an - // exception if it overruns. - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - StructReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const word **ptrHead, - bool *dataTrunc, bool *ptrTrunc); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - // - // If this function returns false, the struct is non-canonical. If it - // returns true, then: - // * If it is a composite in a list, it is canonical if at least one struct - // in the list outputs dataTrunc = 1, and at least one outputs ptrTrunc = 1 - // * If it is derived from a struct pointer, it is canonical if - // dataTrunc = 1 AND ptrTrunc = 1 - -private: - SegmentReader* segment; // Memory segment in which the struct resides. - CapTableReader* capTable; // Table of capability indexes. - - const void* data; - const WirePointer* pointers; - - StructDataBitCount dataSize; - // Size of data section. We use a bit count rather than a word count to more easily handle the - // case of struct lists encoded with less than a word per element. - - StructPointerCount pointerCount; // Size of the pointer section. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - // TODO(perf): Limit to 16 bits for better packing? - - inline StructReader(SegmentReader* segment, CapTableReader* capTable, - const void* data, const WirePointer* pointers, - StructDataBitCount dataSize, StructPointerCount pointerCount, - int nestingLimit) - : segment(segment), capTable(capTable), data(data), pointers(pointers), - dataSize(dataSize), pointerCount(pointerCount), - nestingLimit(nestingLimit) {} - - friend class ListReader; - friend class StructBuilder; - friend struct WireHelpers; -}; - -// ------------------------------------------------------------------- - -class ListBuilder: public kj::DisallowConstCopy { -public: - inline explicit ListBuilder(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize) {} - - inline word* getLocation() { - // Get the object's location. - - if (elementSize == ElementSize::INLINE_COMPOSITE && ptr != nullptr) { - return reinterpret_cast(ptr) - POINTER_SIZE_IN_WORDS; - } else { - return reinterpret_cast(ptr); - } - } - - inline ElementSize getElementSize() const { return elementSize; } - - inline ListElementCount size() const; - // The number of elements in the list. - - Text::Builder asText(); - Data::Builder asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index)); - // Get the element of the given type at the given index. - - template - KJ_ALWAYS_INLINE(void setDataElement(ElementCount index, kj::NoInfer value)); - // Set the element at the given index. - - KJ_ALWAYS_INLINE(PointerBuilder getPointerElement(ElementCount index)); - - StructBuilder getStructElement(ElementCount index); - - ListReader asReader() const; - // Get a ListReader pointing at the same memory. - - BuilderArena* getArena(); - // Gets the arena in which this object is allocated. - - CapTableBuilder* getCapTable(); - // Gets the capability context in which this object is operating. - - ListBuilder imbue(CapTableBuilder* capTable); - // Return a copy of this builder except using the given capability context. - -private: - SegmentBuilder* segment; // Memory segment in which the list resides. - CapTableBuilder* capTable; // Table of capability indexes. - - byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 128 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - inline ListBuilder(SegmentBuilder* segment, CapTableBuilder* capTable, void* ptr, - BitsPerElementN<23> step, ListElementCount size, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(size), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize) {} - - friend class StructBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -class ListReader { -public: - inline explicit ListReader(ElementSize elementSize) - : segment(nullptr), capTable(nullptr), ptr(nullptr), elementCount(ZERO * ELEMENTS), - step(ZERO * BITS / ELEMENTS), structDataSize(ZERO * BITS), - structPointerCount(ZERO * POINTERS), elementSize(elementSize), nestingLimit(0x7fffffff) {} - - inline ListElementCount size() const; - // The number of elements in the list. - - inline ElementSize getElementSize() const { return elementSize; } - - Text::Reader asText(); - Data::Reader asData(); - // Reinterpret the list as a blob. Throws an exception if the elements are not byte-sized. - - kj::ArrayPtr asRawBytes(); - - template - KJ_ALWAYS_INLINE(T getDataElement(ElementCount index) const); - // Get the element of the given type at the given index. - - KJ_ALWAYS_INLINE(PointerReader getPointerElement(ElementCount index) const); - - StructReader getStructElement(ElementCount index) const; - - CapTableReader* getCapTable(); - // Gets the capability context in which this object is operating. - - ListReader imbue(CapTableReader* capTable) const; - // Return a copy of this reader except using the given capability context. - - bool isCanonical(const word **readHead, const WirePointer* ref); - // Validate this pointer's canonicity, subject to the conditions: - // * All data to the left of readHead has been read thus far (for pointer - // ordering) - // * All pointers in preorder have already been checked - // * This pointer is in the first and only segment of the message - -private: - SegmentReader* segment; // Memory segment in which the list resides. - CapTableReader* capTable; // Table of capability indexes. - - const byte* ptr; // Pointer to list content. - - ListElementCount elementCount; // Number of elements in the list. - - BitsPerElementN<23> step; - // The distance between elements. The maximum value occurs when a struct contains 2^16-1 data - // words and 2^16-1 pointers, i.e. 2^17 - 2 words, or 2^23 - 2 bits. - - StructDataBitCount structDataSize; - StructPointerCount structPointerCount; - // The struct properties to use when interpreting the elements as structs. All lists can be - // interpreted as struct lists, so these are always filled in. - - ElementSize elementSize; - // The element size as a ElementSize. This is only really needed to disambiguate INLINE_COMPOSITE - // from other types when the overall size is exactly zero or one words. - - int nestingLimit; - // Limits the depth of message structures to guard against stack-overflow-based DoS attacks. - // Once this reaches zero, further pointers will be pruned. - - inline ListReader(SegmentReader* segment, CapTableReader* capTable, const void* ptr, - ListElementCount elementCount, BitsPerElementN<23> step, - StructDataBitCount structDataSize, StructPointerCount structPointerCount, - ElementSize elementSize, int nestingLimit) - : segment(segment), capTable(capTable), ptr(reinterpret_cast(ptr)), - elementCount(elementCount), step(step), structDataSize(structDataSize), - structPointerCount(structPointerCount), elementSize(elementSize), - nestingLimit(nestingLimit) {} - - friend class StructReader; - friend class ListBuilder; - friend struct WireHelpers; - friend class OrphanBuilder; -}; - -// ------------------------------------------------------------------- - -class OrphanBuilder { -public: - inline OrphanBuilder(): segment(nullptr), capTable(nullptr), location(nullptr) { - memset(&tag, 0, sizeof(tag)); - } - OrphanBuilder(const OrphanBuilder& other) = delete; - inline OrphanBuilder(OrphanBuilder&& other) noexcept; - inline ~OrphanBuilder() noexcept(false); - - static OrphanBuilder initStruct(BuilderArena* arena, CapTableBuilder* capTable, StructSize size); - static OrphanBuilder initList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, ElementSize elementSize); - static OrphanBuilder initStructList(BuilderArena* arena, CapTableBuilder* capTable, - ElementCount elementCount, StructSize elementSize); - static OrphanBuilder initText(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - static OrphanBuilder initData(BuilderArena* arena, CapTableBuilder* capTable, ByteCount size); - - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, StructReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, ListReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, PointerReader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Text::Reader copyFrom); - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, Data::Reader copyFrom); -#if !CAPNP_LITE - static OrphanBuilder copy(BuilderArena* arena, CapTableBuilder* capTable, - kj::Own copyFrom); -#endif // !CAPNP_LITE - - static OrphanBuilder concat(BuilderArena* arena, CapTableBuilder* capTable, - ElementSize expectedElementSize, StructSize expectedStructSize, - kj::ArrayPtr lists); - - static OrphanBuilder referenceExternalData(BuilderArena* arena, Data::Reader data); - - OrphanBuilder& operator=(const OrphanBuilder& other) = delete; - inline OrphanBuilder& operator=(OrphanBuilder&& other); - - inline bool operator==(decltype(nullptr)) const { return location == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return location != nullptr; } - - StructBuilder asStruct(StructSize size); - // Interpret as a struct, or throw an exception if not a struct. - - ListBuilder asList(ElementSize elementSize); - // Interpret as a list, or throw an exception if not a list. elementSize cannot be - // INLINE_COMPOSITE -- use asStructList() instead. - - ListBuilder asStructList(StructSize elementSize); - // Interpret as a struct list, or throw an exception if not a list. - - ListBuilder asListAnySize(); - // For AnyList. - - Text::Builder asText(); - Data::Builder asData(); - // Interpret as a blob, or throw an exception if not a blob. - - StructReader asStructReader(StructSize size) const; - ListReader asListReader(ElementSize elementSize) const; - ListReader asListReaderAnySize() const; -#if !CAPNP_LITE - kj::Own asCapability() const; -#endif // !CAPNP_LITE - Text::Reader asTextReader() const; - Data::Reader asDataReader() const; - - bool truncate(ElementCount size, bool isText) KJ_WARN_UNUSED_RESULT; - // Resize the orphan list to the given size. Returns false if the list is currently empty but - // the requested size is non-zero, in which case the caller will need to allocate a new list. - - void truncate(ElementCount size, ElementSize elementSize); - void truncate(ElementCount size, StructSize elementSize); - void truncateText(ElementCount size); - // Versions of truncate() that know how to allocate a new list if needed. - -private: - static_assert(ONE * POINTERS * WORDS_PER_POINTER == ONE * WORDS, - "This struct assumes a pointer is one word."); - word tag; - // Contains an encoded WirePointer representing this object. WirePointer is defined in - // layout.c++, but fits in a word. - // - // This may be a FAR pointer. Even in that case, `location` points to the eventual destination - // of that far pointer. The reason we keep the far pointer around rather than just making `tag` - // represent the final destination is because if the eventual adopter of the pointer is not in - // the target's segment then it may be useful to reuse the far pointer landing pad. - // - // If `tag` is not a far pointer, its offset is garbage; only `location` points to the actual - // target. - - SegmentBuilder* segment; - // Segment in which the object resides. - - CapTableBuilder* capTable; - // Table of capability indexes. - - word* location; - // Pointer to the object, or nullptr if the pointer is null. For capabilities, we make this - // 0x1 just so that it is non-null for operator==, but it is never used. - - inline OrphanBuilder(const void* tagPtr, SegmentBuilder* segment, - CapTableBuilder* capTable, word* location) - : segment(segment), capTable(capTable), location(location) { - memcpy(&tag, tagPtr, sizeof(tag)); - } - - inline WirePointer* tagAsPtr() { return reinterpret_cast(&tag); } - inline const WirePointer* tagAsPtr() const { return reinterpret_cast(&tag); } - - void euthanize(); - // Erase the target object, zeroing it out and possibly reclaiming the memory. Called when - // the OrphanBuilder is being destroyed or overwritten and it is non-null. - - friend struct WireHelpers; -}; - -// ======================================================================================= -// Internal implementation details... - -// These are defined in the source file. -template <> typename Text::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Text::Reader value); -template <> typename Text::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Text::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -template <> typename Data::Builder PointerBuilder::initBlob(ByteCount size); -template <> void PointerBuilder::setBlob(typename Data::Reader value); -template <> typename Data::Builder PointerBuilder::getBlob( - const void* defaultValue, ByteCount defaultSize); -template <> typename Data::Reader PointerReader::getBlob( - const void* defaultValue, ByteCount defaultSize) const; - -inline PointerBuilder PointerBuilder::getRoot( - SegmentBuilder* segment, CapTableBuilder* capTable, word* location) { - return PointerBuilder(segment, capTable, reinterpret_cast(location)); -} - -inline PointerReader PointerReader::getRootUnchecked(const word* location) { - return PointerReader(nullptr, nullptr, - reinterpret_cast(location), 0x7fffffff); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructBuilder::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListBuilder StructBuilder::getPointerSectionAsList() { - return _::ListBuilder(segment, capTable, pointers, ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, - pointerCount * (ONE * ELEMENTS / POINTERS), - ZERO * BITS, ONE * POINTERS, ElementSize::POINTER); -} - -template -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructBuilder::hasDataField(StructDataOffset offset) { - return false; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); -} - -template <> -inline bool StructBuilder::getDataField(StructDataOffset offset) { - BitCount32 boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void StructBuilder::getDataField(StructDataOffset offset) { - return VOID; -} - -template -inline T StructBuilder::getDataField(StructDataOffset offset, Mask mask) { - return unmask(getDataField >(offset), mask); -} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, kj::NoInfer value) { - reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, float value) { - setDataField(offset, mask(value, 0)); -} -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, double value) { - setDataField(offset, mask(value, 0)); -} -#endif - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, bool value) { - auto boffset = offset * (ONE * BITS / ELEMENTS); - byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - uint bitnum = unboundMaxBits<3>(boffset % BITS_PER_BYTE / BITS); - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << bitnum)) - | (static_cast(value) << bitnum); -} - -template <> -inline void StructBuilder::setDataField(StructDataOffset offset, Void value) {} - -template -inline void StructBuilder::setDataField(StructDataOffset offset, - kj::NoInfer value, Mask m) { - setDataField >(offset, mask(value, m)); -} - -inline PointerBuilder StructBuilder::getPointerField(StructPointerOffset ptrIndex) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerBuilder(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER)); -} - -// ------------------------------------------------------------------- - -inline kj::ArrayPtr StructReader::getDataSectionAsBlob() { - return kj::ArrayPtr(reinterpret_cast(data), - unbound(dataSize / BITS_PER_BYTE / BYTES)); -} - -inline _::ListReader StructReader::getPointerSectionAsList() { - return _::ListReader(segment, capTable, pointers, pointerCount * (ONE * ELEMENTS / POINTERS), - ONE * POINTERS * BITS_PER_POINTER / ELEMENTS, ZERO * BITS, ONE * POINTERS, - ElementSize::POINTER, nestingLimit); -} - -template -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return getDataField>(offset) != 0; -} - -template <> -inline bool StructReader::hasDataField(StructDataOffset offset) const { - return false; -} - -template -inline T StructReader::getDataField(StructDataOffset offset) const { - if ((offset + ONE * ELEMENTS) * capnp::bitsPerElement() <= dataSize) { - return reinterpret_cast*>(data)[unbound(offset / ELEMENTS)].get(); - } else { - return static_cast(0); - } -} - -template <> -inline bool StructReader::getDataField(StructDataOffset offset) const { - auto boffset = offset * (ONE * BITS / ELEMENTS); - if (boffset < dataSize) { - const byte* b = reinterpret_cast(data) + boffset / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (boffset % BITS_PER_BYTE / BITS))) != 0; - } else { - return false; - } -} - -template <> -inline Void StructReader::getDataField(StructDataOffset offset) const { - return VOID; -} - -template -T StructReader::getDataField(StructDataOffset offset, Mask mask) const { - return unmask(getDataField >(offset), mask); -} - -inline PointerReader StructReader::getPointerField(StructPointerOffset ptrIndex) const { - if (ptrIndex < pointerCount) { - // Hacky because WirePointer is defined in the .c++ file (so is incomplete here). - return PointerReader(segment, capTable, reinterpret_cast( - reinterpret_cast(pointers) + ptrIndex * WORDS_PER_POINTER), nestingLimit); - } else{ - return PointerReader(); - } -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListBuilder::size() const { return elementCount; } - -template -inline T ListBuilder::getDataElement(ElementCount index) { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); - - // TODO(perf): Benchmark this alternate implementation, which I suspect may make better use of - // the x86 SIB byte. Also use it for all the other getData/setData implementations below, and - // the various non-inline methods that look up pointers. - // Also if using this, consider changing ptr back to void* instead of byte*. -// return reinterpret_cast*>(ptr)[ -// index / ELEMENTS * (step / capnp::bitsPerElement())].get(); -} - -template <> -inline bool ListBuilder::getDataElement(ElementCount index) { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListBuilder::getDataElement(ElementCount index) { - return VOID; -} - -template -inline void ListBuilder::setDataElement(ElementCount index, kj::NoInfer value) { - reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->set(value); -} - -#if CAPNP_CANONICALIZE_NAN -// Use mask() on floats and doubles to make sure we canonicalize NaNs. -template <> -inline void ListBuilder::setDataElement(ElementCount index, float value) { - setDataElement(index, mask(value, 0)); -} -template <> -inline void ListBuilder::setDataElement(ElementCount index, double value) { - setDataElement(index, mask(value, 0)); -} -#endif - -template <> -inline void ListBuilder::setDataElement(ElementCount index, bool value) { - // Ignore stepBytes for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - byte* b = ptr + bindex / BITS_PER_BYTE; - auto bitnum = bindex % BITS_PER_BYTE / BITS; - *reinterpret_cast(b) = (*reinterpret_cast(b) & ~(1 << unbound(bitnum))) - | (static_cast(value) << unbound(bitnum)); -} - -template <> -inline void ListBuilder::setDataElement(ElementCount index, Void value) {} - -inline PointerBuilder ListBuilder::getPointerElement(ElementCount index) { - return PointerBuilder(segment, capTable, reinterpret_cast(ptr + - upgradeBound(index) * step / BITS_PER_BYTE)); -} - -// ------------------------------------------------------------------- - -inline ListElementCount ListReader::size() const { return elementCount; } - -template -inline T ListReader::getDataElement(ElementCount index) const { - return reinterpret_cast*>( - ptr + upgradeBound(index) * step / BITS_PER_BYTE)->get(); -} - -template <> -inline bool ListReader::getDataElement(ElementCount index) const { - // Ignore step for bit lists because bit lists cannot be upgraded to struct lists. - auto bindex = index * (ONE * BITS / ELEMENTS); - const byte* b = ptr + bindex / BITS_PER_BYTE; - return (*reinterpret_cast(b) & - unbound(ONE << (bindex % BITS_PER_BYTE / BITS))) != 0; -} - -template <> -inline Void ListReader::getDataElement(ElementCount index) const { - return VOID; -} - -inline PointerReader ListReader::getPointerElement(ElementCount index) const { - return PointerReader(segment, capTable, reinterpret_cast( - ptr + upgradeBound(index) * step / BITS_PER_BYTE), nestingLimit); -} - -// ------------------------------------------------------------------- - -inline OrphanBuilder::OrphanBuilder(OrphanBuilder&& other) noexcept - : segment(other.segment), capTable(other.capTable), location(other.location) { - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; -} - -inline OrphanBuilder::~OrphanBuilder() noexcept(false) { - if (segment != nullptr) euthanize(); -} - -inline OrphanBuilder& OrphanBuilder::operator=(OrphanBuilder&& other) { - // With normal smart pointers, it's important to handle the case where the incoming pointer - // is actually transitively owned by this one. In this case, euthanize() would destroy `other` - // before we copied it. This isn't possible in the case of `OrphanBuilder` because it only - // owns message objects, and `other` is not itself a message object, therefore cannot possibly - // be transitively owned by `this`. - - if (segment != nullptr) euthanize(); - segment = other.segment; - capTable = other.capTable; - location = other.location; - memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. - other.segment = nullptr; - other.location = nullptr; - return *this; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_LAYOUT_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/list.h b/phonelibs/capnp-cpp/mac/include/capnp/list.h deleted file mode 100644 index 23e5e6c10e..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/list.h +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_LIST_H_ -#define CAPNP_LIST_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "orphan.h" -#include -#ifdef KJ_STD_COMPAT -#include -#endif // KJ_STD_COMPAT - -namespace capnp { -namespace _ { // private - -template -class TemporaryPointer { - // This class is a little hack which lets us define operator->() in cases where it needs to - // return a pointer to a temporary value. We instead construct a TemporaryPointer and return that - // (by value). The compiler then invokes operator->() on the TemporaryPointer, which itself is - // able to return a real pointer to its member. - -public: - TemporaryPointer(T&& value): value(kj::mv(value)) {} - TemporaryPointer(const T& value): value(value) {} - - inline T* operator->() { return &value; } -private: - T value; -}; - -template -class IndexingIterator { -public: - IndexingIterator() = default; - - inline Element operator*() const { return (*container)[index]; } - inline TemporaryPointer operator->() const { - return TemporaryPointer((*container)[index]); - } - inline Element operator[]( int off) const { return (*container)[index]; } - inline Element operator[](uint off) const { return (*container)[index]; } - - inline IndexingIterator& operator++() { ++index; return *this; } - inline IndexingIterator operator++(int) { IndexingIterator other = *this; ++index; return other; } - inline IndexingIterator& operator--() { --index; return *this; } - inline IndexingIterator operator--(int) { IndexingIterator other = *this; --index; return other; } - - inline IndexingIterator operator+(uint amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-(uint amount) const { return IndexingIterator(container, index - amount); } - inline IndexingIterator operator+( int amount) const { return IndexingIterator(container, index + amount); } - inline IndexingIterator operator-( int amount) const { return IndexingIterator(container, index - amount); } - - inline int operator-(const IndexingIterator& other) const { return index - other.index; } - - inline IndexingIterator& operator+=(uint amount) { index += amount; return *this; } - inline IndexingIterator& operator-=(uint amount) { index -= amount; return *this; } - inline IndexingIterator& operator+=( int amount) { index += amount; return *this; } - inline IndexingIterator& operator-=( int amount) { index -= amount; return *this; } - - // STL says comparing iterators of different containers is not allowed, so we only compare - // indices here. - inline bool operator==(const IndexingIterator& other) const { return index == other.index; } - inline bool operator!=(const IndexingIterator& other) const { return index != other.index; } - inline bool operator<=(const IndexingIterator& other) const { return index <= other.index; } - inline bool operator>=(const IndexingIterator& other) const { return index >= other.index; } - inline bool operator< (const IndexingIterator& other) const { return index < other.index; } - inline bool operator> (const IndexingIterator& other) const { return index > other.index; } - -private: - Container* container; - uint index; - - friend Container; - inline IndexingIterator(Container* container, uint index) - : container(container), index(index) {} -}; - -} // namespace _ (private) - -template -struct List { - // List of primitives. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(_::elementSizeForType()) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline T operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.template getDataElement(bounded(index) * ELEMENTS); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(_::elementSizeForType()) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline T operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.template getDataElement(bounded(index) * ELEMENTS); - } - inline void set(uint index, T value) { - // Alas, it is not possible to make operator[] return a reference to which you can assign, - // since the encoded representation does not necessarily match the compiler's representation - // of the type. We can't even return a clever class that implements operator T() and - // operator=() because it will lead to surprising behavior when using type inference (e.g. - // calling a template function with inferred argument types, or using "auto" or "decltype"). - - builder.template setDataElement(bounded(index) * ELEMENTS, value); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(_::elementSizeForType(), bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(_::elementSizeForType(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(_::elementSizeForType(), defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List: public List {}; - -template -struct List { - // List of structs. - - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename T::Reader(reader.getStructElement(bounded(index) * ELEMENTS)); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::INLINE_COMPOSITE) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename T::Builder(builder.getStructElement(bounded(index) * ELEMENTS)); - } - - inline void adoptWithCaveats(uint index, Orphan&& orphan) { - // Mostly behaves like you'd expect `adopt` to behave, but with two caveats originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // * This actually performs a shallow copy, effectively adopting each of the orphan's - // children rather than adopting the orphan itself. The orphan ends up being discarded, - // possibly wasting space in the message object. - // * If the orphan is larger than the target struct -- say, because the orphan was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - - KJ_IREQUIRE(index < size()); - - // We pass a zero-valued StructSize to asStruct() because we do not want the struct to be - // expanded under any circumstances. We're just going to throw it away anyway, and - // transferContentFrom() already carefully compares the struct sizes before transferring. - builder.getStructElement(bounded(index) * ELEMENTS).transferContentFrom( - orphan.builder.asStruct(_::StructSize(ZERO * WORDS, ZERO * POINTERS))); - } - inline void setWithCaveats(uint index, const typename T::Reader& reader) { - // Mostly behaves like you'd expect `set` to behave, but with a caveat originating from - // the fact that structs in a struct list are allocated inline rather than by pointer: - // If the source struct is larger than the target struct -- say, because the source was built - // using a newer version of the schema that has additional fields -- it will be truncated, - // losing data. - // - // Note: If you are trying to concatenate some lists, use Orphanage::newOrphanConcat() to - // do it without losing any data in case the source lists come from a newer version of the - // protocol. (Plus, it's easier to use anyhow.) - - KJ_IREQUIRE(index < size()); - builder.getStructElement(bounded(index) * ELEMENTS).copyContentFrom(reader._reader); - } - - // There are no init(), set(), adopt(), or disown() methods for lists of structs because the - // elements of the list are inlined and are initialized when the list is initialized. This - // means that init() would be redundant, and set() would risk data loss if the input struct - // were from a newer version of the protocol. - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initStructList(bounded(size) * ELEMENTS, _::structSize()); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getStructList(_::structSize(), defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::INLINE_COMPOSITE, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List, Kind::LIST> { - // List of lists. - - List() = delete; - - class Reader { - public: - typedef List> Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename List::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return typename List::Reader(_::PointerHelpers>::get( - reader.getPointerElement(bounded(index) * ELEMENTS))); - } - - typedef _::IndexingIterator::Reader> Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List> Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename List::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return typename List::Builder(_::PointerHelpers>::get( - builder.getPointerElement(bounded(index) * ELEMENTS))); - } - inline typename List::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return typename List::Builder(_::PointerHelpers>::init( - builder.getPointerElement(bounded(index) * ELEMENTS), size)); - } - inline void set(uint index, typename List::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).setList(value.reader); - } - void set(uint index, std::initializer_list> value) { - KJ_IREQUIRE(index < size()); - auto l = init(index, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator::Builder> Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -template -struct List { - List() = delete; - - class Reader { - public: - typedef List Reads; - - inline Reader(): reader(ElementSize::POINTER) {} - inline explicit Reader(_::ListReader reader): reader(reader) {} - - inline uint size() const { return unbound(reader.size() / ELEMENTS); } - inline typename T::Reader operator[](uint index) const { - KJ_IREQUIRE(index < size()); - return reader.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - - private: - _::ListReader reader; - template - friend struct _::PointerHelpers; - template - friend struct List; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Builder { - public: - typedef List Builds; - - inline Builder(): builder(ElementSize::POINTER) {} - inline Builder(decltype(nullptr)): Builder() {} - inline explicit Builder(_::ListBuilder builder): builder(builder) {} - - inline operator Reader() const { return Reader(builder.asReader()); } - inline Reader asReader() const { return Reader(builder.asReader()); } - - inline uint size() const { return unbound(builder.size() / ELEMENTS); } - inline typename T::Builder operator[](uint index) { - KJ_IREQUIRE(index < size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template getBlob(nullptr, ZERO * BYTES); - } - inline void set(uint index, typename T::Reader value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).template setBlob(value); - } - inline typename T::Builder init(uint index, uint size) { - KJ_IREQUIRE(index < this->size()); - return builder.getPointerElement(bounded(index) * ELEMENTS) - .template initBlob(bounded(size) * BYTES); - } - inline void adopt(uint index, Orphan&& value) { - KJ_IREQUIRE(index < size()); - builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value.builder)); - } - inline Orphan disown(uint index) { - KJ_IREQUIRE(index < size()); - return Orphan(builder.getPointerElement(bounded(index) * ELEMENTS).disown()); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() { return Iterator(this, 0); } - inline Iterator end() { return Iterator(this, size()); } - - private: - _::ListBuilder builder; - template - friend struct _::PointerHelpers; - friend class Orphanage; - template - friend struct ToDynamic_; - }; - - class Pipeline {}; - -private: - inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) { - return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS); - } - inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) { - return builder.getList(ElementSize::POINTER, defaultValue); - } - inline static _::ListReader getFromPointer( - const _::PointerReader& reader, const word* defaultValue) { - return reader.getList(ElementSize::POINTER, defaultValue); - } - - template - friend struct List; - template - friend struct _::PointerHelpers; -}; - -} // namespace capnp - -#ifdef KJ_STD_COMPAT -namespace std { - -template -struct iterator_traits> - : public std::iterator {}; - -} // namespace std -#endif // KJ_STD_COMPAT - -#endif // CAPNP_LIST_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/membrane.h b/phonelibs/capnp-cpp/mac/include/capnp/membrane.h deleted file mode 100644 index 6fa8a1335d..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/membrane.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_MEMBRANE_H_ -#define CAPNP_MEMBRANE_H_ -// In capability theory, a "membrane" is a wrapper around a capability which (usually) forwards -// calls but recursively wraps capabilities in those calls in the same membrane. The purpose of a -// membrane is to enforce a barrier between two capabilities that cannot be bypassed by merely -// introducing new objects. -// -// The most common use case for a membrane is revocation: Say Alice wants to give Bob a capability -// to access Carol, but wants to be able to revoke this capability later. Alice can accomplish this -// by wrapping Carol in a revokable wrapper which passes through calls until such a time as Alice -// indicates it should be revoked, after which all calls through the wrapper will throw exceptions. -// However, a naive wrapper approach has a problem: if Bob makes a call to Carol and sends a new -// capability in that call, or if Carol returns a capability to Bob in the response to a call, then -// the two are now able to communicate using this new capability, which Alice cannot revoke. In -// order to avoid this problem, Alice must use not just a wrapper but a "membrane", which -// recursively wraps all objects that pass through it in either direction. Thus, all connections -// formed between Bob and Carol (originating from Alice's original introduction) can be revoked -// together by revoking the membrane. -// -// Note that when a capability is passed into a membrane and then passed back out, the result is -// the original capability, not a double-membraned capability. This means that in our revocation -// example, if Bob uses his capability to Carol to obtain another capability from her, then send -// it back to her, the capability Carol receives back will NOT be revoked when Bob's access to -// Carol is revoked. Thus Bob can create long-term irrevocable connections. In most practical use -// cases, this is what you want. APIs commonly rely on the fact that a capability obtained and then -// passed back can be recognized as the original capability. -// -// Mark Miller on membranes: http://www.eros-os.org/pipermail/e-lang/2003-January/008434.html - -#include "capability.h" - -namespace capnp { - -class MembranePolicy { - // Applications may implement this interface to define a membrane policy, which allows some - // calls crossing the membrane to be blocked or redirected. - -public: - virtual kj::Maybe inboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Given an inbound call (a call originating "outside" the membrane destined for an object - // "inside" the membrane), decides what to do with it. The policy may: - // - // - Return null to indicate that the call should proceed to the destination. All capabilities - // in the parameters or result will be properly wrapped in the same membrane. - // - Return a capability to have the call redirected to that capability. Note that the redirect - // capability will be treated as outside the membrane, so the params and results will not be - // auto-wrapped; however, the callee can easily wrap the returned capability in the membrane - // itself before returning to achieve this effect. - // - Throw an exception to cause the call to fail with that exception. - // - // `target` is the underlying capability (*inside* the membrane) for which the call is destined. - // Generally, the only way you should use `target` is to wrap it in some capability which you - // return as a redirect. The redirect capability may modify the call in some way and send it to - // `target`. Be careful to use `copyIntoMembrane()` and `copyOutOfMembrane()` as appropriate when - // copying parameters or results across the membrane. - // - // Note that since `target` is inside the capability, if you were to directly return it (rather - // than return null), the effect would be that the membrane would be broken: the call would - // proceed directly and any new capabilities introduced through it would not be membraned. You - // generally should not do that. - - virtual kj::Maybe outboundCall( - uint64_t interfaceId, uint16_t methodId, Capability::Client target) = 0; - // Like `inboundCall()`, but applies to calls originating *inside* the membrane and terminating - // outside. - // - // Note: It is strongly recommended that `outboundCall()` returns null in exactly the same cases - // that `inboundCall()` return null. Conversely, for any case where `inboundCall()` would - // redirect or throw, `outboundCall()` should also redirect or throw. Otherwise, you can run - // into inconsistent behavion when a promise is returned across a membrane, and that promise - // later resolves to a capability on the other side of the membrane: calls on the promise - // will enter and then exit the membrane, but calls on the eventual resolution will not cross - // the membrane at all, so it is important that these two cases behave the same. - - virtual kj::Own addRef() = 0; - // Return a new owned pointer to the same policy. - // - // Typically an implementation of MembranePolicy should also inherit kj::Refcounted and implement - // `addRef()` as `return kj::addRef(*this);`. - // - // Note that the membraning system considers two membranes created with the same MembranePolicy - // object actually to be the *same* membrane. This is relevant when an object passes into the - // membrane and then back out (or out and then back in): instead of double-wrapping the object, - // the wrapping will be removed. -}; - -Capability::Client membrane(Capability::Client inner, kj::Own policy); -// Wrap `inner` in a membrane specified by `policy`. `inner` is considered "inside" the membrane, -// while the returned capability should only be called from outside the membrane. - -Capability::Client reverseMembrane(Capability::Client outer, kj::Own policy); -// Like `membrane` but treat the input capability as "outside" the membrane, and return a -// capability appropriate for use inside. -// -// Applications typically won't use this directly; the membraning code automatically sets up -// reverse membranes where needed. - -template -ClientType membrane(ClientType inner, kj::Own policy); -template -ClientType reverseMembrane(ClientType inner, kj::Own policy); -// Convenience templates which return the same interface type as the input. - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy); -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy); -// Convenience templates which input a capability server type and return the appropriate client -// type. - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Copy a Cap'n Proto object (e.g. struct or list), adding the given membrane to any capabilities -// found within it. `from` is interpreted as "outside" the membrane while `to` is "inside". - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy); -// Like copyIntoMembrane() except that `from` is "inside" the membrane and `to` is "outside". - -// ======================================================================================= -// inline implementation details - -template -ClientType membrane(ClientType inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -ClientType reverseMembrane(ClientType inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -template -typename ServerType::Serves::Client membrane( - kj::Own inner, kj::Own policy) { - return membrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} -template -typename ServerType::Serves::Client reverseMembrane( - kj::Own inner, kj::Own policy) { - return reverseMembrane(Capability::Client(kj::mv(inner)), kj::mv(policy)) - .castAs(); -} - -namespace _ { // private - -OrphanBuilder copyOutOfMembrane(PointerReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(StructReader from, Orphanage to, - kj::Own policy, bool reverse); -OrphanBuilder copyOutOfMembrane(ListReader from, Orphanage to, - kj::Own policy, bool reverse); - -} // namespace _ (private) - -template -Orphan::Reads> copyIntoMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), true); -} - -template -Orphan::Reads> copyOutOfMembrane( - Reader&& from, Orphanage to, kj::Own policy) { - return _::copyOutOfMembrane( - _::PointerHelpers::Reads>::getInternalReader(from), - to, kj::mv(policy), false); -} - -} // namespace capnp - -#endif // CAPNP_MEMBRANE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/message.h b/phonelibs/capnp-cpp/mac/include/capnp/message.h deleted file mode 100644 index b4d5e9fc82..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/message.h +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include -#include -#include -#include -#include "common.h" -#include "layout.h" -#include "any.h" - -#ifndef CAPNP_MESSAGE_H_ -#define CAPNP_MESSAGE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -namespace capnp { - -namespace _ { // private - class ReaderArena; - class BuilderArena; -} - -class StructSchema; -class Orphanage; -template -class Orphan; - -// ======================================================================================= - -struct ReaderOptions { - // Options controlling how data is read. - - uint64_t traversalLimitInWords = 8 * 1024 * 1024; - // Limits how many total words of data are allowed to be traversed. Traversal is counted when - // a new struct or list builder is obtained, e.g. from a get() accessor. This means that calling - // the getter for the same sub-struct multiple times will cause it to be double-counted. Once - // the traversal limit is reached, an error will be reported. - // - // This limit exists for security reasons. It is possible for an attacker to construct a message - // in which multiple pointers point at the same location. This is technically invalid, but hard - // to detect. Using such a message, an attacker could cause a message which is small on the wire - // to appear much larger when actually traversed, possibly exhausting server resources leading to - // denial-of-service. - // - // It makes sense to set a traversal limit that is much larger than the underlying message. - // Together with sensible coding practices (e.g. trying to avoid calling sub-object getters - // multiple times, which is expensive anyway), this should provide adequate protection without - // inconvenience. - // - // The default limit is 64 MiB. This may or may not be a sensible number for any given use case, - // but probably at least prevents easy exploitation while also avoiding causing problems in most - // typical cases. - - int nestingLimit = 64; - // Limits how deeply-nested a message structure can be, e.g. structs containing other structs or - // lists of structs. - // - // Like the traversal limit, this limit exists for security reasons. Since it is common to use - // recursive code to traverse recursive data structures, an attacker could easily cause a stack - // overflow by sending a very-deeply-nested (or even cyclic) message, without the message even - // being very large. The default limit of 64 is probably low enough to prevent any chance of - // stack overflow, yet high enough that it is never a problem in practice. -}; - -class MessageReader { - // Abstract interface for an object used to read a Cap'n Proto message. Subclasses of - // MessageReader are responsible for reading the raw, flat message content. Callers should - // usually call `messageReader.getRoot()` to get a `MyStructType::Reader` - // representing the root of the message, then use that to traverse the message content. - // - // Some common subclasses of `MessageReader` include `SegmentArrayMessageReader`, whose - // constructor accepts pointers to the raw data, and `StreamFdMessageReader` (from - // `serialize.h`), which reads the message from a file descriptor. One might implement other - // subclasses to handle things like reading from shared memory segments, mmap()ed files, etc. - -public: - MessageReader(ReaderOptions options); - // It is suggested that subclasses take ReaderOptions as a constructor parameter, but give it a - // default value of "ReaderOptions()". The base class constructor doesn't have a default value - // in order to remind subclasses that they really need to give the user a way to provide this. - - virtual ~MessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) = 0; - // Gets the segment with the given ID, or returns null if no such segment exists. This method - // will be called at most once for each segment ID. - - inline const ReaderOptions& getOptions(); - // Get the options passed to the constructor. - - template - typename RootType::Reader getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Reader getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - bool isCanonical(); - // Returns whether the message encoded in the reader is in canonical form. - -private: - ReaderOptions options; - - // Space in which we can construct a ReaderArena. We don't use ReaderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a ReaderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - void* arenaSpace[15 + sizeof(kj::MutexGuarded) / sizeof(void*)]; - bool allocatedArena; - - _::ReaderArena* arena() { return reinterpret_cast<_::ReaderArena*>(arenaSpace); } - AnyPointer::Reader getRootInternal(); -}; - -class MessageBuilder { - // Abstract interface for an object used to allocate and build a message. Subclasses of - // MessageBuilder are responsible for allocating the space in which the message will be written. - // The most common subclass is `MallocMessageBuilder`, but other subclasses may be used to do - // tricky things like allocate messages in shared memory or mmap()ed files. - // - // Creating a new message ususually means allocating a new MessageBuilder (ideally on the stack) - // and then calling `messageBuilder.initRoot()` to get a `MyStructType::Builder`. - // That, in turn, can be used to fill in the message content. When done, you can call - // `messageBuilder.getSegmentsForOutput()` to get a list of flat data arrays containing the - // message. - -public: - MessageBuilder(); - virtual ~MessageBuilder() noexcept(false); - KJ_DISALLOW_COPY(MessageBuilder); - - struct SegmentInit { - kj::ArrayPtr space; - - size_t wordsUsed; - // Number of words in `space` which are used; the rest are free space in which additional - // objects may be allocated. - }; - - explicit MessageBuilder(kj::ArrayPtr segments); - // Create a MessageBuilder backed by existing memory. This is an advanced interface that most - // people should not use. THIS METHOD IS INSECURE; see below. - // - // This allows a MessageBuilder to be constructed to modify an in-memory message without first - // making a copy of the content. This is especially useful in conjunction with mmap(). - // - // The contents of each segment must outlive the MessageBuilder, but the SegmentInit array itself - // only need outlive the constructor. - // - // SECURITY: Do not use this in conjunction with untrusted data. This constructor assumes that - // the input message is valid. This constructor is designed to be used with data you control, - // e.g. an mmap'd file which is owned and accessed by only one program. When reading data you - // do not trust, you *must* load it into a Reader and then copy into a Builder as a means of - // validating the content. - // - // WARNING: It is NOT safe to initialize a MessageBuilder in this way from memory that is - // currently in use by another MessageBuilder or MessageReader. Other readers/builders will - // not observe changes to the segment sizes nor newly-allocated segments caused by allocating - // new objects in this message. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) = 0; - // Allocates an array of at least the given number of words, throwing an exception or crashing if - // this is not possible. It is expected that this method will usually return more space than - // requested, and the caller should use that extra space as much as possible before allocating - // more. The returned space remains valid at least until the MessageBuilder is destroyed. - // - // Cap'n Proto will only call this once at a time, so the subclass need not worry about - // thread-safety. - - template - typename RootType::Builder initRoot(); - // Initialize the root struct of the message as the given struct type. - - template - void setRoot(Reader&& value); - // Set the root struct to a deep copy of the given struct. - - template - typename RootType::Builder getRoot(); - // Get the root struct of the message, interpreting it as the given struct type. - - template - typename RootType::Builder getRoot(SchemaType schema); - // Dynamically interpret the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - typename RootType::Builder initRoot(SchemaType schema); - // Dynamically init the root struct of the message using the given schema (a StructSchema). - // RootType in this case must be DynamicStruct, and you must #include to - // use this. - - template - void adoptRoot(Orphan&& orphan); - // Like setRoot() but adopts the orphan without copying. - - kj::ArrayPtr> getSegmentsForOutput(); - // Get the raw data that makes up the message. - - Orphanage getOrphanage(); - - bool isCanonical(); - // Check whether the message builder is in canonical form - -private: - void* arenaSpace[22]; - // Space in which we can construct a BuilderArena. We don't use BuilderArena directly here - // because we don't want clients to have to #include arena.h, which itself includes a bunch of - // big STL headers. We don't use a pointer to a BuilderArena because that would require an - // extra malloc on every message which could be expensive when processing small messages. - - bool allocatedArena = false; - // We have to initialize the arena lazily because when we do so we want to allocate the root - // pointer immediately, and this will allocate a segment, which requires a virtual function - // call on the MessageBuilder. We can't do such a call in the constructor since the subclass - // isn't constructed yet. This is kind of annoying because it means that getOrphanage() is - // not thread-safe, but that shouldn't be a huge deal... - - _::BuilderArena* arena() { return reinterpret_cast<_::BuilderArena*>(arenaSpace); } - _::SegmentBuilder* getRootSegment(); - AnyPointer::Builder getRootInternal(); -}; - -template -typename RootType::Reader readMessageUnchecked(const word* data); -// IF THE INPUT IS INVALID, THIS MAY CRASH, CORRUPT MEMORY, CREATE A SECURITY HOLE IN YOUR APP, -// MURDER YOUR FIRST-BORN CHILD, AND/OR BRING ABOUT ETERNAL DAMNATION ON ALL OF HUMANITY. DO NOT -// USE UNLESS YOU UNDERSTAND THE CONSEQUENCES. -// -// Given a pointer to a known-valid message located in a single contiguous memory segment, -// returns a reader for that message. No bounds-checking will be done while traversing this -// message. Use this only if you have already verified that all pointers are valid and in-bounds, -// and there are no far pointers in the message. -// -// To create a message that can be passed to this function, build a message using a MallocAllocator -// whose preferred segment size is larger than the message size. This guarantees that the message -// will be allocated as a single segment, meaning getSegmentsForOutput() returns a single word -// array. That word array is your message; you may pass a pointer to its first word into -// readMessageUnchecked() to read the message. -// -// This can be particularly handy for embedding messages in generated code: you can -// embed the raw bytes (using AlignedData) then make a Reader for it using this. This is the way -// default values are embedded in code generated by the Cap'n Proto compiler. E.g., if you have -// a message MyMessage, you can read its default value like so: -// MyMessage::Reader reader = Message::readMessageUnchecked(MyMessage::DEFAULT.words); -// -// To sanitize a message from an untrusted source such that it can be safely passed to -// readMessageUnchecked(), use copyToUnchecked(). - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer); -// Copy the content of the given reader into the given buffer, such that it can safely be passed to -// readMessageUnchecked(). The buffer's size must be exactly reader.totalSizeInWords() + 1, -// otherwise an exception will be thrown. The buffer must be zero'd before calling. - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data); -// Interprets the given data as a single, data-only struct. Only primitive fields (booleans, -// numbers, and enums) will be readable; all pointers will be null. This is useful if you want -// to use Cap'n Proto as a language/platform-neutral way to pack some bits. -// -// The input is a word array rather than a byte array to enforce alignment. If you have a byte -// array which you know is word-aligned (or if your platform supports unaligned reads and you don't -// mind the performance penalty), then you can use `reinterpret_cast` to convert a byte array into -// a word array: -// -// kj::arrayPtr(reinterpret_cast(bytes.begin()), -// reinterpret_cast(bytes.end())) - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder); -// Given a struct builder, get the underlying data section as a word array, suitable for passing -// to `readDataStruct()`. -// -// Note that you may call `.toBytes()` on the returned value to convert to `ArrayPtr`. - -template -static typename Type::Reader defaultValue(); -// Get a default instance of the given struct or list type. -// -// TODO(cleanup): Find a better home for this function? - -// ======================================================================================= - -class SegmentArrayMessageReader: public MessageReader { - // A simple MessageReader that reads from an array of word arrays representing all segments. - // In particular you can read directly from the output of MessageBuilder::getSegmentsForOutput() - // (although it would probably make more sense to call builder.getRoot().asReader() in that case). - -public: - SegmentArrayMessageReader(kj::ArrayPtr> segments, - ReaderOptions options = ReaderOptions()); - // Creates a message pointing at the given segment array, without taking ownership of the - // segments. All arrays passed in must remain valid until the MessageReader is destroyed. - - KJ_DISALLOW_COPY(SegmentArrayMessageReader); - ~SegmentArrayMessageReader() noexcept(false); - - virtual kj::ArrayPtr getSegment(uint id) override; - -private: - kj::ArrayPtr> segments; -}; - -enum class AllocationStrategy: uint8_t { - FIXED_SIZE, - // The builder will prefer to allocate the same amount of space for each segment with no - // heuristic growth. It will still allocate larger segments when the preferred size is too small - // for some single object. This mode is generally not recommended, but can be particularly useful - // for testing in order to force a message to allocate a predictable number of segments. Note - // that you can force every single object in the message to be located in a separate segment by - // using this mode with firstSegmentWords = 0. - - GROW_HEURISTICALLY - // The builder will heuristically decide how much space to allocate for each segment. Each - // allocated segment will be progressively larger than the previous segments on the assumption - // that message sizes are exponentially distributed. The total number of segments that will be - // allocated for a message of size n is O(log n). -}; - -constexpr uint SUGGESTED_FIRST_SEGMENT_WORDS = 1024; -constexpr AllocationStrategy SUGGESTED_ALLOCATION_STRATEGY = AllocationStrategy::GROW_HEURISTICALLY; - -class MallocMessageBuilder: public MessageBuilder { - // A simple MessageBuilder that uses malloc() (actually, calloc()) to allocate segments. This - // implementation should be reasonable for any case that doesn't require writing the message to - // a specific location in memory. - -public: - explicit MallocMessageBuilder(uint firstSegmentWords = SUGGESTED_FIRST_SEGMENT_WORDS, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // Creates a BuilderContext which allocates at least the given number of words for the first - // segment, and then uses the given strategy to decide how much to allocate for subsequent - // segments. When choosing a value for firstSegmentWords, consider that: - // 1) Reading and writing messages gets slower when multiple segments are involved, so it's good - // if most messages fit in a single segment. - // 2) Unused bytes will not be written to the wire, so generally it is not a big deal to allocate - // more space than you need. It only becomes problematic if you are allocating many messages - // in parallel and thus use lots of memory, or if you allocate so much extra space that just - // zeroing it out becomes a bottleneck. - // The defaults have been chosen to be reasonable for most people, so don't change them unless you - // have reason to believe you need to. - - explicit MallocMessageBuilder(kj::ArrayPtr firstSegment, - AllocationStrategy allocationStrategy = SUGGESTED_ALLOCATION_STRATEGY); - // This version always returns the given array for the first segment, and then proceeds with the - // allocation strategy. This is useful for optimization when building lots of small messages in - // a tight loop: you can reuse the space for the first segment. - // - // firstSegment MUST be zero-initialized. MallocMessageBuilder's destructor will write new zeros - // over any space that was used so that it can be reused. - - KJ_DISALLOW_COPY(MallocMessageBuilder); - virtual ~MallocMessageBuilder() noexcept(false); - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - uint nextSize; - AllocationStrategy allocationStrategy; - - bool ownFirstSegment; - bool returnedFirstSegment; - - void* firstSegment; - - struct MoreSegments; - kj::Maybe> moreSegments; -}; - -class FlatMessageBuilder: public MessageBuilder { - // THIS IS NOT THE CLASS YOU'RE LOOKING FOR. - // - // If you want to write a message into already-existing scratch space, use `MallocMessageBuilder` - // and pass the scratch space to its constructor. It will then only fall back to malloc() if - // the scratch space is not large enough. - // - // Do NOT use this class unless you really know what you're doing. This class is problematic - // because it requires advance knowledge of the size of your message, which is usually impossible - // to determine without actually building the message. The class was created primarily to - // implement `copyToUnchecked()`, which itself exists only to support other internal parts of - // the Cap'n Proto implementation. - -public: - explicit FlatMessageBuilder(kj::ArrayPtr array); - KJ_DISALLOW_COPY(FlatMessageBuilder); - virtual ~FlatMessageBuilder() noexcept(false); - - void requireFilled(); - // Throws an exception if the flat array is not exactly full. - - virtual kj::ArrayPtr allocateSegment(uint minimumSize) override; - -private: - kj::ArrayPtr array; - bool allocated; -}; - -// ======================================================================================= -// implementation details - -inline const ReaderOptions& MessageReader::getOptions() { - return options; -} - -template -inline typename RootType::Reader MessageReader::getRoot() { - return getRootInternal().getAs(); -} - -template -inline typename RootType::Builder MessageBuilder::initRoot() { - return getRootInternal().initAs(); -} - -template -inline void MessageBuilder::setRoot(Reader&& value) { - getRootInternal().setAs>(value); -} - -template -inline typename RootType::Builder MessageBuilder::getRoot() { - return getRootInternal().getAs(); -} - -template -void MessageBuilder::adoptRoot(Orphan&& orphan) { - return getRootInternal().adopt(kj::mv(orphan)); -} - -template -typename RootType::Reader MessageReader::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::getRoot(SchemaType schema) { - return getRootInternal().getAs(schema); -} - -template -typename RootType::Builder MessageBuilder::initRoot(SchemaType schema) { - return getRootInternal().initAs(schema); -} - -template -typename RootType::Reader readMessageUnchecked(const word* data) { - return AnyPointer::Reader(_::PointerReader::getRootUnchecked(data)).getAs(); -} - -template -void copyToUnchecked(Reader&& reader, kj::ArrayPtr uncheckedBuffer) { - FlatMessageBuilder builder(uncheckedBuffer); - builder.setRoot(kj::fwd(reader)); - builder.requireFilled(); -} - -template -typename RootType::Reader readDataStruct(kj::ArrayPtr data) { - return typename RootType::Reader(_::StructReader(data)); -} - -template -typename kj::ArrayPtr writeDataStruct(BuilderType builder) { - auto bytes = _::PointerHelpers>::getInternalBuilder(kj::mv(builder)) - .getDataSectionAsBlob(); - return kj::arrayPtr(reinterpret_cast(bytes.begin()), - reinterpret_cast(bytes.end())); -} - -template -static typename Type::Reader defaultValue() { - return typename Type::Reader(_::StructReader()); -} - -template -kj::Array canonicalize(T&& reader) { - return _::PointerHelpers>::getInternalReader(reader).canonicalize(); -} - -} // namespace capnp - -#endif // CAPNP_MESSAGE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/orphan.h b/phonelibs/capnp-cpp/mac/include/capnp/orphan.h deleted file mode 100644 index 8c8b9a6054..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/orphan.h +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_ORPHAN_H_ -#define CAPNP_ORPHAN_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" - -namespace capnp { - -class StructSchema; -class ListSchema; -struct DynamicStruct; -struct DynamicList; -namespace _ { struct OrphanageInternal; } - -template -class Orphan { - // Represents an object which is allocated within some message builder but has no pointers - // pointing at it. An Orphan can later be "adopted" by some other object as one of that object's - // fields, without having to copy the orphan. For a field `foo` of pointer type, the generated - // code will define builder methods `void adoptFoo(Orphan)` and `Orphan disownFoo()`. - // Orphans can also be created independently of any parent using an Orphanage. - // - // `Orphan` can be moved but not copied, like `Own`, so that it is impossible for one - // orphan to be adopted multiple times. If an orphan is destroyed without being adopted, its - // contents are zero'd out (and possibly reused, if we ever implement the ability to reuse space - // in a message arena). - -public: - Orphan() = default; - KJ_DISALLOW_COPY(Orphan); - Orphan(Orphan&&) = default; - Orphan& operator=(Orphan&&) = default; - inline Orphan(_::OrphanBuilder&& builder): builder(kj::mv(builder)) {} - - inline BuilderFor get(); - // Get the underlying builder. If the orphan is null, this will allocate and return a default - // object rather than crash. This is done for security -- otherwise, you might enable a DoS - // attack any time you disown a field and fail to check if it is null. In the case of structs, - // this means that the orphan is no longer null after get() returns. In the case of lists, - // no actual object is allocated since a simple empty ListBuilder can be returned. - - inline ReaderFor getReader() const; - - inline bool operator==(decltype(nullptr)) const { return builder == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return builder != nullptr; } - - inline void truncate(uint size); - // Resize an object (which must be a list or a blob) to the given size. - // - // If the new size is less than the original, the remaining elements will be discarded. The - // list is never moved in this case. If the list happens to be located at the end of its segment - // (which is always true if the list was the last thing allocated), the removed memory will be - // reclaimed (reducing the messag size), otherwise it is simply zeroed. The reclaiming behavior - // is particularly useful for allocating buffer space when you aren't sure how much space you - // actually need: you can pre-allocate, say, a 4k byte array, read() from a file into it, and - // then truncate it back to the amount of space actually used. - // - // If the new size is greater than the original, the list is extended with default values. If - // the list is the last object in its segment *and* there is enough space left in the segment to - // extend it to cover the new values, then the list is extended in-place. Otherwise, it must be - // moved to a new location, leaving a zero'd hole in the previous space that won't be filled. - // This copy is shallow; sub-objects will simply be reparented, not copied. - // - // Any existing readers or builders pointing at the object are invalidated by this call (even if - // it doesn't move). You must call `get()` or `getReader()` again to get the new, valid pointer. - -private: - _::OrphanBuilder builder; - - template - friend struct _::PointerHelpers; - template - friend struct List; - template - friend class Orphan; - friend class Orphanage; - friend class MessageBuilder; -}; - -class Orphanage: private kj::DisallowConstCopy { - // Use to directly allocate Orphan objects, without having a parent object allocate and then - // disown the object. - -public: - inline Orphanage(): arena(nullptr) {} - - template - static Orphanage getForMessageContaining(BuilderType builder); - // Construct an Orphanage that allocates within the message containing the given Builder. This - // allows the constructed Orphans to be adopted by objects within said message. - // - // This constructor takes the builder rather than having the builder have a getOrphanage() method - // because this is an advanced feature and we don't want to pollute the builder APIs with it. - // - // Note that if you have a direct pointer to the `MessageBuilder`, you can simply call its - // `getOrphanage()` method. - - template - Orphan newOrphan() const; - // Allocate a new orphaned struct. - - template - Orphan newOrphan(uint size) const; - // Allocate a new orphaned list or blob. - - Orphan newOrphan(StructSchema schema) const; - // Dynamically create an orphan struct with the given schema. You must - // #include to use this. - - Orphan newOrphan(ListSchema schema, uint size) const; - // Dynamically create an orphan list with the given schema. You must #include - // to use this. - - template - Orphan> newOrphanCopy(Reader copyFrom) const; - // Allocate a new orphaned object (struct, list, or blob) and initialize it as a copy of the - // given object. - - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - template - Orphan>>> newOrphanConcat(kj::ArrayPtr lists) const; - // Given an array of List readers, copy and concatenate the lists, creating a new Orphan. - // - // Note that compared to allocating the list yourself and using `setWithCaveats()` to set each - // item, this method avoids the "caveats": the new list will be allocated with the element size - // being the maximum of that from all the input lists. This is particularly important when - // concatenating struct lists: if the lists were created using a newer version of the protocol - // in which some new fields had been added to the struct, using `setWithCaveats()` would - // truncate off those new fields. - - Orphan referenceExternalData(Data::Reader data) const; - // Creates an Orphan that points at an existing region of memory (e.g. from another message) - // without copying it. There are some SEVERE restrictions on how this can be used: - // - The memory must remain valid until the `MessageBuilder` is destroyed (even if the orphan is - // abandoned). - // - Because the data is const, you will not be allowed to obtain a `Data::Builder` - // for this blob. Any call which would return such a builder will throw an exception. You - // can, however, obtain a Reader, e.g. via orphan.getReader() or from a parent Reader (once - // the orphan is adopted). It is your responsibility to make sure your code can deal with - // these problems when using this optimization; if you can't, allocate a copy instead. - // - `data.begin()` must be aligned to a machine word boundary (32-bit or 64-bit depending on - // the CPU). Any pointer returned by malloc() as well as any data blob obtained from another - // Cap'n Proto message satisfies this. - // - If `data.size()` is not a multiple of 8, extra bytes past data.end() up until the next 8-byte - // boundary will be visible in the raw message when it is written out. Thus, there must be no - // secrets in these bytes. Data blobs obtained from other Cap'n Proto messages should be safe - // as these bytes should be zero (unless the sender had the same problem). - // - // The array will actually become one of the message's segments. The data can thus be adopted - // into the message tree without copying it. This is particularly useful when referencing very - // large blobs, such as whole mmap'd files. - -private: - _::BuilderArena* arena; - _::CapTableBuilder* capTable; - - inline explicit Orphanage(_::BuilderArena* arena, _::CapTableBuilder* capTable) - : arena(arena), capTable(capTable) {} - - template - struct GetInnerBuilder; - template - struct GetInnerReader; - template - struct NewOrphanListImpl; - - friend class MessageBuilder; - friend struct _::OrphanageInternal; -}; - -// ======================================================================================= -// Inline implementation details. - -namespace _ { // private - -template -struct OrphanGetImpl; - -template -struct OrphanGetImpl { - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::elementSizeForType()); - } -}; - -template -struct OrphanGetImpl { - static inline typename T::Builder apply(_::OrphanBuilder& builder) { - return typename T::Builder(builder.asStruct(_::structSize())); - } - static inline typename T::Reader applyReader(const _::OrphanBuilder& builder) { - return typename T::Reader(builder.asStructReader(_::structSize())); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, _::structSize()); - } -}; - -#if !CAPNP_LITE -template -struct OrphanGetImpl { - static inline typename T::Client apply(_::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline typename T::Client applyReader(const _::OrphanBuilder& builder) { - return typename T::Client(builder.asCapability()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; -#endif // !CAPNP_LITE - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asList(_::ElementSizeForType::value)); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template -struct OrphanGetImpl, Kind::LIST> { - static inline typename List::Builder apply(_::OrphanBuilder& builder) { - return typename List::Builder(builder.asStructList(_::structSize())); - } - static inline typename List::Reader applyReader(const _::OrphanBuilder& builder) { - return typename List::Reader(builder.asListReader(_::ElementSizeForType::value)); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Text::Builder apply(_::OrphanBuilder& builder) { - return Text::Builder(builder.asText()); - } - static inline Text::Reader applyReader(const _::OrphanBuilder& builder) { - return Text::Reader(builder.asTextReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -template <> -struct OrphanGetImpl { - static inline Data::Builder apply(_::OrphanBuilder& builder) { - return Data::Builder(builder.asData()); - } - static inline Data::Reader applyReader(const _::OrphanBuilder& builder) { - return Data::Reader(builder.asDataReader()); - } - static inline void truncateListOf(_::OrphanBuilder& builder, ElementCount size) { - builder.truncate(size, ElementSize::POINTER); - } -}; - -struct OrphanageInternal { - static inline _::BuilderArena* getArena(Orphanage orphanage) { return orphanage.arena; } - static inline _::CapTableBuilder* getCapTable(Orphanage orphanage) { return orphanage.capTable; } -}; - -} // namespace _ (private) - -template -inline BuilderFor Orphan::get() { - return _::OrphanGetImpl::apply(builder); -} - -template -inline ReaderFor Orphan::getReader() const { - return _::OrphanGetImpl::applyReader(builder); -} - -template -inline void Orphan::truncate(uint size) { - _::OrphanGetImpl>::truncateListOf(builder, bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncateText(bounded(size) * ELEMENTS); -} - -template <> -inline void Orphan::truncate(uint size) { - builder.truncate(bounded(size) * ELEMENTS, ElementSize::BYTE); -} - -template -struct Orphanage::GetInnerBuilder { - static inline _::StructBuilder apply(typename T::Builder& t) { - return t._builder; - } -}; - -template -struct Orphanage::GetInnerBuilder { - static inline _::ListBuilder apply(typename T::Builder& t) { - return t.builder; - } -}; - -template -Orphanage Orphanage::getForMessageContaining(BuilderType builder) { - auto inner = GetInnerBuilder>::apply(builder); - return Orphanage(inner.getArena(), inner.getCapTable()); -} - -template -Orphan Orphanage::newOrphan() const { - return Orphan(_::OrphanBuilder::initStruct(arena, capTable, _::structSize())); -} - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initList( - arena, capTable, bounded(size) * ELEMENTS, _::ElementSizeForType::value); - } -}; - -template -struct Orphanage::NewOrphanListImpl> { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initStructList( - arena, capTable, bounded(size) * ELEMENTS, _::structSize()); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initText(arena, capTable, bounded(size) * BYTES); - } -}; - -template <> -struct Orphanage::NewOrphanListImpl { - static inline _::OrphanBuilder apply( - _::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) { - return _::OrphanBuilder::initData(arena, capTable, bounded(size) * BYTES); - } -}; - -template -Orphan Orphanage::newOrphan(uint size) const { - return Orphan(NewOrphanListImpl::apply(arena, capTable, size)); -} - -template -struct Orphanage::GetInnerReader { - static inline _::StructReader apply(const typename T::Reader& t) { - return t._reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline _::ListReader apply(const typename T::Reader& t) { - return t.reader; - } -}; - -template -struct Orphanage::GetInnerReader { - static inline const typename T::Reader& apply(const typename T::Reader& t) { - return t; - } -}; - -template -inline Orphan> Orphanage::newOrphanCopy(Reader copyFrom) const { - return Orphan>(_::OrphanBuilder::copy( - arena, capTable, GetInnerReader>::apply(copyFrom))); -} - -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - return newOrphanConcat(kj::implicitCast>(lists)); -} -template -inline Orphan>>> -Orphanage::newOrphanConcat(kj::ArrayPtr lists) const { - // Optimization / simplification: Rely on List::Reader containing nothing except a - // _::ListReader. - static_assert(sizeof(T) == sizeof(_::ListReader), "lists are not bare readers?"); - kj::ArrayPtr raw( - reinterpret_cast(lists.begin()), lists.size()); - typedef ListElementType> Element; - return Orphan>( - _::OrphanBuilder::concat(arena, capTable, - _::elementSizeForType(), - _::minStructSizeForElement(), raw)); -} - -inline Orphan Orphanage::referenceExternalData(Data::Reader data) const { - return Orphan(_::OrphanBuilder::referenceExternalData(arena, data)); -} - -} // namespace capnp - -#endif // CAPNP_ORPHAN_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp b/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp deleted file mode 100644 index a13b47168a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb8630836983feed7; - -$import "/capnp/c++.capnp".namespace("capnp"); - -interface Persistent@0xc8cb212fcd9f5691(SturdyRef, Owner) { - # Interface implemented by capabilities that outlive a single connection. A client may save() - # the capability, producing a SturdyRef. The SturdyRef can be stored to disk, then later used to - # obtain a new reference to the capability on a future connection. - # - # The exact format of SturdyRef depends on the "realm" in which the SturdyRef appears. A "realm" - # is an abstract space in which all SturdyRefs have the same format and refer to the same set of - # resources. Every vat is in exactly one realm. All capability clients within that vat must - # produce SturdyRefs of the format appropriate for the realm. - # - # Similarly, every VatNetwork also resides in a particular realm. Usually, a vat's "realm" - # corresponds to the realm of its main VatNetwork. However, a Vat can in fact communicate over - # a VatNetwork in a different realm -- in this case, all SturdyRefs need to be transformed when - # coming or going through said VatNetwork. The RPC system has hooks for registering - # transformation callbacks for this purpose. - # - # Since the format of SturdyRef is realm-dependent, it is not defined here. An application should - # choose an appropriate realm for itself as part of its design. Note that under Sandstorm, every - # application exists in its own realm and is therefore free to define its own SturdyRef format; - # the Sandstorm platform handles translating between realms. - # - # Note that whether a capability is persistent is often orthogonal to its type. In these cases, - # the capability's interface should NOT inherit `Persistent`; instead, just perform a cast at - # runtime. It's not type-safe, but trying to be type-safe in these cases will likely lead to - # tears. In cases where a particular interface only makes sense on persistent capabilities, it - # still should not explicitly inherit Persistent because the `SturdyRef` and `Owner` types will - # vary between realms (they may even be different at the call site than they are on the - # implementation). Instead, mark persistent interfaces with the $persistent annotation (defined - # below). - # - # Sealing - # ------- - # - # As an added security measure, SturdyRefs may be "sealed" to a particular owner, such that - # if the SturdyRef itself leaks to a third party, that party cannot actually restore it because - # they are not the owner. To restore a sealed capability, you must first prove to its host that - # you are the rightful owner. The precise mechanism for this authentication is defined by the - # realm. - # - # Sealing is a defense-in-depth mechanism meant to mitigate damage in the case of catastrophic - # attacks. For example, say an attacker temporarily gains read access to a database full of - # SturdyRefs: it would be unfortunate if it were then necessary to revoke every single reference - # in the database to prevent the attacker from using them. - # - # In general, an "owner" is a course-grained identity. Because capability-based security is still - # the primary mechanism of security, it is not necessary nor desirable to have a separate "owner" - # identity for every single process or object; that is exactly what capabilities are supposed to - # avoid! Instead, it makes sense for an "owner" to literally identify the owner of the machines - # where the capability is stored. If untrusted third parties are able to run arbitrary code on - # said machines, then the sandbox for that code should be designed using Distributed Confinement - # such that the third-party code never sees the bits of the SturdyRefs and cannot directly - # exercise the owner's power to restore refs. See: - # - # http://www.erights.org/elib/capability/dist-confine.html - # - # Resist the urge to represent an Owner as a simple public key. The whole point of sealing is to - # defend against leaked-storage attacks. Such attacks can easily result in the owner's private - # key being stolen as well. A better solution is for `Owner` to contain a simple globally unique - # identifier for the owner, and for everyone to separately maintain a mapping of owner IDs to - # public keys. If an owner's private key is compromised, then humans will need to communicate - # and agree on a replacement public key, then update the mapping. - # - # As a concrete example, an `Owner` could simply contain a domain name, and restoring a SturdyRef - # would require signing a request using the domain's private key. Authenticating this key could - # be accomplished through certificate authorities or web-of-trust techniques. - - save @0 SaveParams -> SaveResults; - # Save a capability persistently so that it can be restored by a future connection. Not all - # capabilities can be saved -- application interfaces should define which capabilities support - # this and which do not. - - struct SaveParams { - sealFor @0 :Owner; - # Seal the SturdyRef so that it can only be restored by the specified Owner. This is meant - # to mitigate damage when a SturdyRef is leaked. See comments above. - # - # Leaving this value null may or may not be allowed; it is up to the realm to decide. If a - # realm does allow a null owner, this should indicate that anyone is allowed to restore the - # ref. - } - struct SaveResults { - sturdyRef @0 :SturdyRef; - } -} - -interface RealmGateway(InternalRef, ExternalRef, InternalOwner, ExternalOwner) { - # Interface invoked when a SturdyRef is about to cross realms. The RPC system supports providing - # a RealmGateway as a callback hook when setting up RPC over some VatNetwork. - - import @0 (cap :Persistent(ExternalRef, ExternalOwner), - params :Persistent(InternalRef, InternalOwner).SaveParams) - -> Persistent(InternalRef, InternalOwner).SaveResults; - # Given an external capability, save it and return an internal reference. Used when someone - # inside the realm tries to save a capability from outside the realm. - - export @1 (cap :Persistent(InternalRef, InternalOwner), - params :Persistent(ExternalRef, ExternalOwner).SaveParams) - -> Persistent(ExternalRef, ExternalOwner).SaveResults; - # Given an internal capability, save it and return an external reference. Used when someone - # outside the realm tries to save a capability from inside the realm. -} - -annotation persistent(interface, field) :Void; -# Apply this annotation to interfaces for objects that will always be persistent, instead of -# extending the Persistent capability, since the correct type parameters to Persistent depend on -# the realm, which is orthogonal to the interface type and therefore should not be defined -# along-side it. -# -# You may also apply this annotation to a capability-typed field which will always contain a -# persistent capability, but where the capability's interface itself is not already marked -# persistent. -# -# Note that absence of the $persistent annotation doesn't mean a capability of that type isn't -# persistent; it just means not *all* such capabilities are persistent. diff --git a/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp.h deleted file mode 100644 index f9b443220a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/persistent.capnp.h +++ /dev/null @@ -1,1328 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: persistent.capnp - -#ifndef CAPNP_INCLUDED_b8630836983feed7_ -#define CAPNP_INCLUDED_b8630836983feed7_ - -#include -#if !CAPNP_LITE -#include -#endif // !CAPNP_LITE - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(c8cb212fcd9f5691); -CAPNP_DECLARE_SCHEMA(f76fba59183073a5); -CAPNP_DECLARE_SCHEMA(b76848c18c40efbf); -CAPNP_DECLARE_SCHEMA(84ff286cd00a3ed4); -CAPNP_DECLARE_SCHEMA(f0c2cc1d3909574d); -CAPNP_DECLARE_SCHEMA(ecafa18b482da3aa); -CAPNP_DECLARE_SCHEMA(f622595091cafb67); - -} // namespace schemas -} // namespace capnp - -namespace capnp { - -template -struct Persistent { - Persistent() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct SaveParams; - struct SaveResults; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(c8cb212fcd9f5691) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct Persistent::SaveParams { - SaveParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f76fba59183073a5, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct Persistent::SaveResults { - SaveResults() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b76848c18c40efbf, 0, 1) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, SturdyRef, Owner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway { - RealmGateway() = delete; - -#if !CAPNP_LITE - class Client; - class Server; -#endif // !CAPNP_LITE - - struct ImportParams; - struct ExportParams; - - #if !CAPNP_LITE - struct _capnpPrivate { - CAPNP_DECLARE_INTERFACE_HEADER(84ff286cd00a3ed4) - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - }; - #endif // !CAPNP_LITE -}; - -template -struct RealmGateway::ImportParams { - ImportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f0c2cc1d3909574d, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -template -struct RealmGateway::ExportParams { - ExportParams() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ecafa18b482da3aa, 0, 2) - #if !CAPNP_LITE - static const ::capnp::_::RawBrandedSchema::Scope brandScopes[]; - static const ::capnp::_::RawBrandedSchema::Binding brandBindings[]; - static const ::capnp::_::RawBrandedSchema::Dependency brandDependencies[]; - static const ::capnp::_::RawBrandedSchema specificBrand; - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return ::capnp::_::ChooseBrand<_capnpPrivate, InternalRef, ExternalRef, InternalOwner, ExternalOwner>::brand(); } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -#if !CAPNP_LITE -template -class Persistent::Client - : public virtual ::capnp::Capability::Client { -public: - typedef Persistent Calls; - typedef Persistent Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename Persistent::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) saveRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class Persistent::Server - : public virtual ::capnp::Capability::Server { -public: - typedef Persistent Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef ::capnp::CallContext::SaveParams, typename ::capnp::Persistent::SaveResults> SaveContext; - virtual ::kj::Promise save(SaveContext context); - - inline typename ::capnp::Persistent::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::Persistent>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveParams::Reader { -public: - typedef SaveParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Reader asPersistentGeneric() { - return typename Persistent::SaveParams::Reader(_reader); - } - - inline bool hasSealFor() const; - inline ::capnp::ReaderFor getSealFor() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveParams::Builder { -public: - typedef SaveParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveParams::Builder asPersistentGeneric() { - return typename Persistent::SaveParams::Builder(_builder); - } - - inline bool hasSealFor(); - inline ::capnp::BuilderFor getSealFor(); - inline void setSealFor( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSealFor(); - inline ::capnp::BuilderFor initSealFor(unsigned int size); - inline void adoptSealFor(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSealFor(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveParams::Pipeline { -public: - typedef SaveParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSealFor(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class Persistent::SaveResults::Reader { -public: - typedef SaveResults Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Reader asPersistentGeneric() { - return typename Persistent::SaveResults::Reader(_reader); - } - - inline bool hasSturdyRef() const; - inline ::capnp::ReaderFor getSturdyRef() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class Persistent::SaveResults::Builder { -public: - typedef SaveResults Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename Persistent::SaveResults::Builder asPersistentGeneric() { - return typename Persistent::SaveResults::Builder(_builder); - } - - inline bool hasSturdyRef(); - inline ::capnp::BuilderFor getSturdyRef(); - inline void setSturdyRef( ::capnp::ReaderFor value); - inline ::capnp::BuilderFor initSturdyRef(); - inline ::capnp::BuilderFor initSturdyRef(unsigned int size); - inline void adoptSturdyRef(::capnp::Orphan&& value); - inline ::capnp::Orphan disownSturdyRef(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class Persistent::SaveResults::Pipeline { -public: - typedef SaveResults Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::PipelineFor getSturdyRef(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -class RealmGateway::Client - : public virtual ::capnp::Capability::Client { -public: - typedef RealmGateway Calls; - typedef RealmGateway Reads; - - Client(decltype(nullptr)); - explicit Client(::kj::Own< ::capnp::ClientHook>&& hook); - template ()>> - Client(::kj::Own<_t>&& server); - template ()>> - Client(::kj::Promise<_t>&& promise); - Client(::kj::Exception&& exception); - Client(Client&) = default; - Client(Client&&) = default; - Client& operator=(Client& other); - Client& operator=(Client&& other); - - template - typename RealmGateway::Client asGeneric() { - return castAs>(); - } - - CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) importRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) exportRequest( - ::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr); - -protected: - Client() = default; -}; - -template -class RealmGateway::Server - : public virtual ::capnp::Capability::Server { -public: - typedef RealmGateway Serves; - - ::kj::Promise dispatchCall(uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) - override; - -protected: - typedef typename ::capnp::RealmGateway::ImportParams ImportParams; - typedef ::capnp::CallContext::SaveResults> ImportContext; - virtual ::kj::Promise import(ImportContext context); - typedef typename ::capnp::RealmGateway::ExportParams ExportParams; - typedef ::capnp::CallContext::SaveResults> ExportContext; - virtual ::kj::Promise export_(ExportContext context); - - inline typename ::capnp::RealmGateway::Client thisCap() { - return ::capnp::Capability::Server::thisCap() - .template castAs< ::capnp::RealmGateway>(); - } - - ::kj::Promise dispatchCallInternal(uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context); -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ImportParams::Reader { -public: - typedef ImportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ImportParams::Builder { -public: - typedef ImportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ImportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ImportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ImportParams::Pipeline { -public: - typedef ImportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -template -class RealmGateway::ExportParams::Reader { -public: - typedef ExportParams Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Reader asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Reader(_reader); - } - - inline bool hasCap() const; -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap() const; -#endif // !CAPNP_LITE - - inline bool hasParams() const; - inline typename ::capnp::Persistent::SaveParams::Reader getParams() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -template -class RealmGateway::ExportParams::Builder { -public: - typedef ExportParams Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - template - typename RealmGateway::ExportParams::Builder asRealmGatewayGeneric() { - return typename RealmGateway::ExportParams::Builder(_builder); - } - - inline bool hasCap(); -#if !CAPNP_LITE - inline typename ::capnp::Persistent::Client getCap(); - inline void setCap(typename ::capnp::Persistent::Client&& value); - inline void setCap(typename ::capnp::Persistent::Client& value); - inline void adoptCap(::capnp::Orphan< ::capnp::Persistent>&& value); - inline ::capnp::Orphan< ::capnp::Persistent> disownCap(); -#endif // !CAPNP_LITE - - inline bool hasParams(); - inline typename ::capnp::Persistent::SaveParams::Builder getParams(); - inline void setParams(typename ::capnp::Persistent::SaveParams::Reader value); - inline typename ::capnp::Persistent::SaveParams::Builder initParams(); - inline void adoptParams(::capnp::Orphan::SaveParams>&& value); - inline ::capnp::Orphan::SaveParams> disownParams(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -template -class RealmGateway::ExportParams::Pipeline { -public: - typedef ExportParams Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename ::capnp::Persistent::Client getCap(); - inline typename ::capnp::Persistent::SaveParams::Pipeline getParams(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -#if !CAPNP_LITE -template -inline Persistent::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline Persistent::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline Persistent::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline Persistent::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline Persistent::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::Persistent::Client& Persistent::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool Persistent::SaveParams::Reader::hasSealFor() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveParams::Builder::hasSealFor() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveParams::Reader::getSealFor() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::getSealFor() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveParams::Pipeline::getSealFor() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveParams::Builder::setSealFor( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveParams::Builder::initSealFor(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveParams::Builder::adoptSealFor( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveParams::Builder::disownSealFor() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveParams -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveParams::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f76fba59183073a5, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool Persistent::SaveResults::Reader::hasSturdyRef() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool Persistent::SaveResults::Builder::hasSturdyRef() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline ::capnp::ReaderFor Persistent::SaveResults::Reader::getSturdyRef() const { - return ::capnp::_::PointerHelpers::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::getSturdyRef() { - return ::capnp::_::PointerHelpers::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline ::capnp::PipelineFor Persistent::SaveResults::Pipeline::getSturdyRef() { - return ::capnp::PipelineFor(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -template -inline void Persistent::SaveResults::Builder::setSturdyRef( ::capnp::ReaderFor value) { - ::capnp::_::PointerHelpers::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef() { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline ::capnp::BuilderFor Persistent::SaveResults::Builder::initSturdyRef(unsigned int size) { - return ::capnp::_::PointerHelpers::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -template -inline void Persistent::SaveResults::Builder::adoptSturdyRef( - ::capnp::Orphan&& value) { - ::capnp::_::PointerHelpers::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan Persistent::SaveResults::Builder::disownSturdyRef() { - return ::capnp::_::PointerHelpers::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -// Persistent::SaveResults -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::dataWordSize; -template -constexpr uint16_t Persistent::SaveResults::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::SaveResults::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::SaveResults::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::SaveResults::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::SaveResults::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema Persistent::SaveResults::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_b76848c18c40efbf, brandScopes, nullptr, - 1, 0, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::SaveParams, typename ::capnp::Persistent::SaveResults>) -Persistent::Client::saveRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::SaveParams, typename ::capnp::Persistent::SaveResults>( - 0xc8cb212fcd9f5691ull, 0, sizeHint); -} -template -::kj::Promise Persistent::Server::save(SaveContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", "save", - 0xc8cb212fcd9f5691ull, 0); -} -template -::kj::Promise Persistent::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0xc8cb212fcd9f5691ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:Persistent", interfaceId); - } -} -template -::kj::Promise Persistent::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return save(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::Persistent::SaveParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:Persistent", - 0xc8cb212fcd9f5691ull, methodId); - } -} -#endif // !CAPNP_LITE - -// Persistent -#if !CAPNP_LITE -template -constexpr ::capnp::Kind Persistent::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* Persistent::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope Persistent::_capnpPrivate::brandScopes[] = { - { 0xc8cb212fcd9f5691, brandBindings + 0, 2, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding Persistent::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency Persistent::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema Persistent::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_c8cb212fcd9f5691, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -inline RealmGateway::Client::Client(decltype(nullptr)) - : ::capnp::Capability::Client(nullptr) {} -template -inline RealmGateway::Client::Client( - ::kj::Own< ::capnp::ClientHook>&& hook) - : ::capnp::Capability::Client(::kj::mv(hook)) {} -template -template -inline RealmGateway::Client::Client(::kj::Own<_t>&& server) - : ::capnp::Capability::Client(::kj::mv(server)) {} -template -template -inline RealmGateway::Client::Client(::kj::Promise<_t>&& promise) - : ::capnp::Capability::Client(::kj::mv(promise)) {} -template -inline RealmGateway::Client::Client(::kj::Exception&& exception) - : ::capnp::Capability::Client(::kj::mv(exception)) {} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client& other) { - ::capnp::Capability::Client::operator=(other); - return *this; -} -template -inline typename ::capnp::RealmGateway::Client& RealmGateway::Client::operator=(Client&& other) { - ::capnp::Capability::Client::operator=(kj::mv(other)); - return *this; -} - -#endif // !CAPNP_LITE -template -inline bool RealmGateway::ImportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ImportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ImportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ImportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ImportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ImportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ImportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ImportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ImportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ImportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ImportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ImportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ImportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ImportParams -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ImportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ImportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ImportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ImportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ImportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ImportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ImportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_f0c2cc1d3909574d, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Reader::getCap() const { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Builder::getCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::Client RealmGateway::ExportParams::Pipeline::getCap() { - return typename ::capnp::Persistent::Client(_typeless.getPointerField(0).asCap()); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client&& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(cap)); -} -template -inline void RealmGateway::ExportParams::Builder::setCap(typename ::capnp::Persistent::Client& cap) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), cap); -} -template -inline void RealmGateway::ExportParams::Builder::adoptCap( - ::capnp::Orphan< ::capnp::Persistent>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Persistent>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan< ::capnp::Persistent> RealmGateway::ExportParams::Builder::disownCap() { - return ::capnp::_::PointerHelpers< ::capnp::Persistent>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#endif // !CAPNP_LITE - -template -inline bool RealmGateway::ExportParams::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline bool RealmGateway::ExportParams::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -template -inline typename ::capnp::Persistent::SaveParams::Reader RealmGateway::ExportParams::Reader::getParams() const { - return ::capnp::_::PointerHelpers::SaveParams>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::getParams() { - return ::capnp::_::PointerHelpers::SaveParams>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -template -inline typename ::capnp::Persistent::SaveParams::Pipeline RealmGateway::ExportParams::Pipeline::getParams() { - return typename ::capnp::Persistent::SaveParams::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -template -inline void RealmGateway::ExportParams::Builder::setParams(typename ::capnp::Persistent::SaveParams::Reader value) { - ::capnp::_::PointerHelpers::SaveParams>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -template -inline typename ::capnp::Persistent::SaveParams::Builder RealmGateway::ExportParams::Builder::initParams() { - return ::capnp::_::PointerHelpers::SaveParams>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -template -inline void RealmGateway::ExportParams::Builder::adoptParams( - ::capnp::Orphan::SaveParams>&& value) { - ::capnp::_::PointerHelpers::SaveParams>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -template -inline ::capnp::Orphan::SaveParams> RealmGateway::ExportParams::Builder::disownParams() { - return ::capnp::_::PointerHelpers::SaveParams>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -// RealmGateway::ExportParams -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::dataWordSize; -template -constexpr uint16_t RealmGateway::ExportParams::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::ExportParams::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::ExportParams::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::ExportParams::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::ExportParams::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::ExportParams::_capnpPrivate::brandDependencies[] = { - { 16777216, ::capnp::Persistent::_capnpPrivate::brand() }, - { 16777217, ::capnp::Persistent::SaveParams::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::ExportParams::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_ecafa18b482da3aa, brandScopes, brandDependencies, - 1, 2, nullptr -}; -#endif // !CAPNP_LITE - -#if !CAPNP_LITE -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ImportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::importRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ImportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 0, sizeHint); -} -template -::kj::Promise RealmGateway::Server::import(ImportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "import", - 0x84ff286cd00a3ed4ull, 0); -} -template -CAPNP_AUTO_IF_MSVC(::capnp::Request::ExportParams, typename ::capnp::Persistent::SaveResults>) -RealmGateway::Client::exportRequest(::kj::Maybe< ::capnp::MessageSize> sizeHint) { - return newCall::ExportParams, typename ::capnp::Persistent::SaveResults>( - 0x84ff286cd00a3ed4ull, 1, sizeHint); -} -template -::kj::Promise RealmGateway::Server::export_(ExportContext) { - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", "export", - 0x84ff286cd00a3ed4ull, 1); -} -template -::kj::Promise RealmGateway::Server::dispatchCall( - uint64_t interfaceId, uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (interfaceId) { - case 0x84ff286cd00a3ed4ull: - return dispatchCallInternal(methodId, context); - default: - return internalUnimplemented("capnp/persistent.capnp:RealmGateway", interfaceId); - } -} -template -::kj::Promise RealmGateway::Server::dispatchCallInternal( - uint16_t methodId, - ::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) { - switch (methodId) { - case 0: - return import(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ImportParams, typename ::capnp::Persistent::SaveResults>(context)); - case 1: - return export_(::capnp::Capability::Server::internalGetTypedContext< - typename ::capnp::RealmGateway::ExportParams, typename ::capnp::Persistent::SaveResults>(context)); - default: - (void)context; - return ::capnp::Capability::Server::internalUnimplemented( - "capnp/persistent.capnp:RealmGateway", - 0x84ff286cd00a3ed4ull, methodId); - } -} -#endif // !CAPNP_LITE - -// RealmGateway -#if !CAPNP_LITE -template -constexpr ::capnp::Kind RealmGateway::_capnpPrivate::kind; -template -constexpr ::capnp::_::RawSchema const* RealmGateway::_capnpPrivate::schema; -template -const ::capnp::_::RawBrandedSchema::Scope RealmGateway::_capnpPrivate::brandScopes[] = { - { 0x84ff286cd00a3ed4, brandBindings + 0, 4, false}, -}; -template -const ::capnp::_::RawBrandedSchema::Binding RealmGateway::_capnpPrivate::brandBindings[] = { - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), - ::capnp::_::brandBindingFor(), -}; -template -const ::capnp::_::RawBrandedSchema::Dependency RealmGateway::_capnpPrivate::brandDependencies[] = { - { 33554432, ::capnp::RealmGateway::ImportParams::_capnpPrivate::brand() }, - { 33554433, ::capnp::RealmGateway::ExportParams::_capnpPrivate::brand() }, - { 50331648, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, - { 50331649, ::capnp::Persistent::SaveResults::_capnpPrivate::brand() }, -}; -template -const ::capnp::_::RawBrandedSchema RealmGateway::_capnpPrivate::specificBrand = { - &::capnp::schemas::s_84ff286cd00a3ed4, brandScopes, brandDependencies, - 1, 4, nullptr -}; -#endif // !CAPNP_LITE - -} // namespace - -#endif // CAPNP_INCLUDED_b8630836983feed7_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/pointer-helpers.h b/phonelibs/capnp-cpp/mac/include/capnp/pointer-helpers.h deleted file mode 100644 index fe70e5036f..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/pointer-helpers.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_POINTER_HELPERS_H_ -#define CAPNP_POINTER_HELPERS_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "layout.h" -#include "list.h" - -namespace capnp { -namespace _ { // private - -// PointerHelpers is a template class that assists in wrapping/unwrapping the low-level types in -// layout.h with the high-level public API and generated types. This way, the code generator -// and other templates do not have to specialize on each kind of pointer. - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, const word* defaultValue = nullptr) { - return typename T::Reader(reader.getStruct(defaultValue)); - } - static inline typename T::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename T::Builder(builder.getStruct(structSize(), defaultValue)); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setStruct(value._reader, true); - } - static inline typename T::Builder init(PointerBuilder builder) { - return typename T::Builder(builder.initStruct(structSize())); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } - static inline _::StructReader getInternalReader(const typename T::Reader& reader) { - return reader._reader; - } - static inline _::StructBuilder getInternalBuilder(typename T::Builder&& builder) { - return builder._builder; - } -}; - -template -struct PointerHelpers, Kind::LIST> { - static inline typename List::Reader get(PointerReader reader, - const word* defaultValue = nullptr) { - return typename List::Reader(List::getFromPointer(reader, defaultValue)); - } - static inline typename List::Builder get(PointerBuilder builder, - const word* defaultValue = nullptr) { - return typename List::Builder(List::getFromPointer(builder, defaultValue)); - } - static inline void set(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader); - } - static inline void setCanonical(PointerBuilder builder, typename List::Reader value) { - builder.setList(value.reader, true); - } - static void set(PointerBuilder builder, kj::ArrayPtr> value) { - auto l = init(builder, value.size()); - uint i = 0; - for (auto& element: value) { - l.set(i++, element); - } - } - static inline typename List::Builder init(PointerBuilder builder, uint size) { - return typename List::Builder(List::initPointer(builder, size)); - } - static inline void adopt(PointerBuilder builder, Orphan>&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan> disown(PointerBuilder builder) { - return Orphan>(builder.disown()); - } - static inline _::ListReader getInternalReader(const typename List::Reader& reader) { - return reader.reader; - } - static inline _::ListBuilder getInternalBuilder(typename List::Builder&& builder) { - return builder.builder; - } -}; - -template -struct PointerHelpers { - static inline typename T::Reader get(PointerReader reader, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return reader.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline typename T::Builder get(PointerBuilder builder, - const void* defaultValue = nullptr, - uint defaultBytes = 0) { - return builder.getBlob(defaultValue, bounded(defaultBytes) * BYTES); - } - static inline void set(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline void setCanonical(PointerBuilder builder, typename T::Reader value) { - builder.setBlob(value); - } - static inline typename T::Builder init(PointerBuilder builder, uint size) { - return builder.initBlob(bounded(size) * BYTES); - } - static inline void adopt(PointerBuilder builder, Orphan&& value) { - builder.adopt(kj::mv(value.builder)); - } - static inline Orphan disown(PointerBuilder builder) { - return Orphan(builder.disown()); - } -}; - -struct UncheckedMessage { - typedef const word* Reader; -}; - -template <> struct Kind_ { static constexpr Kind kind = Kind::OTHER; }; - -template <> -struct PointerHelpers { - // Reads an AnyPointer field as an unchecked message pointer. Requires that the containing - // message is itself unchecked. This hack is currently private. It is used to locate default - // values within encoded schemas. - - static inline const word* get(PointerReader reader) { - return reader.getUnchecked(); - } -}; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_POINTER_HELPERS_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/pretty-print.h b/phonelibs/capnp-cpp/mac/include/capnp/pretty-print.h deleted file mode 100644 index e6458bca49..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/pretty-print.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_PRETTY_PRINT_H_ -#define CAPNP_PRETTY_PRINT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "dynamic.h" -#include - -namespace capnp { - -kj::StringTree prettyPrint(DynamicStruct::Reader value); -kj::StringTree prettyPrint(DynamicStruct::Builder value); -kj::StringTree prettyPrint(DynamicList::Reader value); -kj::StringTree prettyPrint(DynamicList::Builder value); -// Print the given Cap'n Proto struct or list with nice indentation. Note that you can pass any -// struct or list reader or builder type to this method, since they can be implicitly converted -// to one of the dynamic types. -// -// If you don't want indentation, just use the value's KJ stringifier (e.g. pass it to kj::str(), -// any of the KJ debug macros, etc.). - -} // namespace capnp - -#endif // PRETTY_PRINT_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/raw-schema.h b/phonelibs/capnp-cpp/mac/include/capnp/raw-schema.h deleted file mode 100644 index ed9425a624..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/raw-schema.h +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RAW_SCHEMA_H_ -#define CAPNP_RAW_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "common.h" // for uint and friends - -#if _MSC_VER -#include -#endif - -namespace capnp { -namespace _ { // private - -struct RawSchema; - -struct RawBrandedSchema { - // Represents a combination of a schema and bindings for its generic parameters. - // - // Note that while we generate one `RawSchema` per type, we generate a `RawBrandedSchema` for - // every _instance_ of a generic type -- or, at least, every instance that is actually used. For - // generated-code types, we use template magic to initialize these. - - const RawSchema* generic; - // Generic type which we're branding. - - struct Binding { - uint8_t which; // Numeric value of one of schema::Type::Which. - - bool isImplicitParameter; - // For AnyPointer, true if it's an implicit method parameter. - - uint16_t listDepth; // Number of times to wrap the base type in List(). - - uint16_t paramIndex; - // For AnyPointer. If it's a type parameter (scopeId is non-zero) or it's an implicit parameter - // (isImplicitParameter is true), then this is the parameter index. Otherwise this is a numeric - // value of one of schema::Type::AnyPointer::Unconstrained::Which. - - union { - const RawBrandedSchema* schema; // for struct, enum, interface - uint64_t scopeId; // for AnyPointer, if it's a type parameter - }; - - Binding() = default; - inline constexpr Binding(uint8_t which, uint16_t listDepth, const RawBrandedSchema* schema) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(0), - schema(schema) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, - uint64_t scopeId, uint16_t paramIndex) - : which(which), isImplicitParameter(false), listDepth(listDepth), paramIndex(paramIndex), - scopeId(scopeId) {} - inline constexpr Binding(uint8_t which, uint16_t listDepth, uint16_t implicitParamIndex) - : which(which), isImplicitParameter(true), listDepth(listDepth), - paramIndex(implicitParamIndex), scopeId(0) {} - }; - - struct Scope { - uint64_t typeId; - // Type ID whose parameters are being bound. - - const Binding* bindings; - uint bindingCount; - // Bindings for those parameters. - - bool isUnbound; - // This scope is unbound, in the sense of SchemaLoader::getUnbound(). - }; - - const Scope* scopes; - // Array of enclosing scopes for which generic variables have been bound, sorted by type ID. - - struct Dependency { - uint location; - const RawBrandedSchema* schema; - }; - - const Dependency* dependencies; - // Map of branded schemas for dependencies of this type, given our brand. Only dependencies that - // are branded are included in this map; if a dependency is missing, use its `defaultBrand`. - - uint32_t scopeCount; - uint32_t dependencyCount; - - enum class DepKind { - // Component of a Dependency::location. Specifies what sort of dependency this is. - - INVALID, - // Mostly defined to ensure that zero is not a valid location. - - FIELD, - // Binding needed for a field's type. The index is the field index (NOT ordinal!). - - METHOD_PARAMS, - // Bindings needed for a method's params type. The index is the method number. - - METHOD_RESULTS, - // Bindings needed for a method's results type. The index is the method ordinal. - - SUPERCLASS, - // Bindings needed for a superclass type. The index is the superclass's index in the - // "extends" list. - - CONST_TYPE - // Bindings needed for the type of a constant. The index is zero. - }; - - static inline uint makeDepLocation(DepKind kind, uint index) { - // Make a number representing the location of a particular dependency within its parent - // schema. - - return (static_cast(kind) << 24) | index; - } - - class Initializer { - public: - virtual void init(const RawBrandedSchema* generic) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - inline bool isUnbound() const; - // Checks if this schema is the result of calling SchemaLoader::getUnbound(), in which case - // binding lookups need to be handled specially. -}; - -struct RawSchema { - // The generated code defines a constant RawSchema for every compiled declaration. - // - // This is an internal structure which could change in the future. - - uint64_t id; - - const word* encodedNode; - // Encoded SchemaNode, readable via readMessageUnchecked(encodedNode). - - uint32_t encodedSize; - // Size of encodedNode, in words. - - const RawSchema* const* dependencies; - // Pointers to other types on which this one depends, sorted by ID. The schemas in this table - // may be uninitialized -- you must call ensureInitialized() on the one you wish to use before - // using it. - // - // TODO(someday): Make this a hashtable. - - const uint16_t* membersByName; - // Indexes of members sorted by name. Used to implement name lookup. - // TODO(someday): Make this a hashtable. - - uint32_t dependencyCount; - uint32_t memberCount; - // Sizes of above tables. - - const uint16_t* membersByDiscriminant; - // List of all member indexes ordered by discriminant value. Those which don't have a - // discriminant value are listed at the end, in order by ordinal. - - const RawSchema* canCastTo; - // Points to the RawSchema of a compiled-in type to which it is safe to cast any DynamicValue - // with this schema. This is null for all compiled-in types; it is only set by SchemaLoader on - // dynamically-loaded types. - - class Initializer { - public: - virtual void init(const RawSchema* schema) const = 0; - }; - - const Initializer* lazyInitializer; - // Lazy initializer, invoked by ensureInitialized(). - - inline void ensureInitialized() const { - // Lazy initialization support. Invoke to ensure that initialization has taken place. This - // is required in particular when traversing the dependency list. RawSchemas for compiled-in - // types are always initialized; only dynamically-loaded schemas may be lazy. - -#if __GNUC__ - const Initializer* i = __atomic_load_n(&lazyInitializer, __ATOMIC_ACQUIRE); -#elif _MSC_VER - const Initializer* i = *static_cast(&lazyInitializer); - std::atomic_thread_fence(std::memory_order_acquire); -#else -#error "Platform not supported" -#endif - if (i != nullptr) i->init(this); - } - - RawBrandedSchema defaultBrand; - // Specifies the brand to use for this schema if no generic parameters have been bound to - // anything. Generally, in the default brand, all generic parameters are treated as if they were - // bound to `AnyPointer`. -}; - -inline bool RawBrandedSchema::isUnbound() const { - // The unbound schema is the only one that has no scopes but is not the default schema. - return scopeCount == 0 && this != &generic->defaultBrand; -} - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RAW_SCHEMA_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc-prelude.h b/phonelibs/capnp-cpp/mac/include/capnp/rpc-prelude.h deleted file mode 100644 index 7d26e39de8..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc-prelude.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before rpc.h can start. -// We don't define these directly in rpc.h because it makes the file hard to read. - -#ifndef CAPNP_RPC_PRELUDE_H_ -#define CAPNP_RPC_PRELUDE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "persistent.capnp.h" - -namespace capnp { - -class OutgoingRpcMessage; -class IncomingRpcMessage; - -template -class RpcSystem; - -namespace _ { // private - -class VatNetworkBase { - // Non-template version of VatNetwork. Ignore this class; see VatNetwork in rpc.h. - -public: - class Connection; - - struct ConnectionAndProvisionId { - kj::Own connection; - kj::Own firstMessage; - Orphan provisionId; - }; - - class Connection { - public: - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) = 0; - virtual kj::Promise>> receiveIncomingMessage() = 0; - virtual kj::Promise shutdown() = 0; - virtual AnyStruct::Reader baseGetPeerVatId() = 0; - }; - virtual kj::Maybe> baseConnect(AnyStruct::Reader vatId) = 0; - virtual kj::Promise> baseAccept() = 0; -}; - -class SturdyRefRestorerBase { -public: - virtual Capability::Client baseRestore(AnyPointer::Reader ref) = 0; -}; - -class BootstrapFactoryBase { - // Non-template version of BootstrapFactory. Ignore this class; see BootstrapFactory in rpc.h. -public: - virtual Capability::Client baseCreateFor(AnyStruct::Reader clientId) = 0; -}; - -class RpcSystemBase { - // Non-template version of RpcSystem. Ignore this class; see RpcSystem in rpc.h. - -public: - RpcSystemBase(VatNetworkBase& network, kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, BootstrapFactoryBase& bootstrapFactory, - kj::Maybe::Client> gateway); - RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& restorer); - RpcSystemBase(RpcSystemBase&& other) noexcept; - ~RpcSystemBase() noexcept(false); - -private: - class Impl; - kj::Own impl; - - Capability::Client baseBootstrap(AnyStruct::Reader vatId); - Capability::Client baseRestore(AnyStruct::Reader vatId, AnyPointer::Reader objectId); - void baseSetFlowLimit(size_t words); - - template - friend class capnp::RpcSystem; -}; - -template struct InternalRefFromRealmGateway_; -template -struct InternalRefFromRealmGateway_> { - typedef InternalRef Type; -}; -template -using InternalRefFromRealmGateway = typename InternalRefFromRealmGateway_::Type; -template -using InternalRefFromRealmGatewayClient = InternalRefFromRealmGateway; - -template struct ExternalRefFromRealmGateway_; -template -struct ExternalRefFromRealmGateway_> { - typedef ExternalRef Type; -}; -template -using ExternalRefFromRealmGateway = typename ExternalRefFromRealmGateway_::Type; -template -using ExternalRefFromRealmGatewayClient = ExternalRefFromRealmGateway; - -} // namespace _ (private) -} // namespace capnp - -#endif // CAPNP_RPC_PRELUDE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp b/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp deleted file mode 100644 index 0b670e8ac3..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xa184c7885cdaf2a1; -# This file defines the "network-specific parameters" in rpc.capnp to support a network consisting -# of two vats. Each of these vats may in fact be in communication with other vats, but any -# capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities -# received from the other end appear to live in a single vat. -# -# Two notable use cases for this model include: -# - Regular client-server communications, where a remote client machine (perhaps living on an end -# user's personal device) connects to a server. The server may be part of a cluster, and may -# call on other servers in the cluster to help service the user's request. It may even obtain -# capabilities from these other servers which it passes on to the user. To simplify network -# common traversal problems (e.g. if the user is behind a firewall), it is probably desirable to -# multiplex all communications between the server cluster and the client over the original -# connection rather than form new ones. This connection should use the two-party protocol, as -# the client has no interest in knowing about additional servers. -# - Applications running in a sandbox. A supervisor process may execute a confined application -# such that all of the confined app's communications with the outside world must pass through -# the supervisor. In this case, the connection between the confined app and the supervisor might -# as well use the two-party protocol, because the confined app is intentionally prevented from -# talking to any other vat anyway. Any external resources will be proxied through the supervisor, -# and so to the contained app will appear as if they were hosted by the supervisor itself. -# -# Since there are only two vats in this network, there is never a need for three-way introductions, -# so level 3 is free. Moreover, because it is never necessary to form new connections, the -# two-party protocol can be used easily anywhere where a two-way byte stream exists, without regard -# to where that byte stream goes or how it was initiated. This makes the two-party runtime library -# highly reusable. -# -# Joins (level 4) _could_ be needed in cases where one or both vats are participating in other -# networks that use joins. For instance, if Alice and Bob are speaking through the two-party -# protocol, and Bob is also participating on another network, Bob may send Alice two or more -# proxied capabilities which, unbeknownst to Bob at the time, are in fact pointing at the same -# remote object. Alice may then request to join these capabilities, at which point Bob will have -# to forward the join to the other network. Note, however, that if Alice is _not_ participating on -# any other network, then Alice will never need to _receive_ a Join, because Alice would always -# know when two locally-hosted capabilities are the same and would never export a redundant alias -# to Bob. So, Alice can respond to all incoming joins with an error, and only needs to implement -# outgoing joins if she herself desires to use this feature. Also, outgoing joins are relatively -# easy to implement in this scenario. -# -# What all this means is that a level 4 implementation of the confined network is barely more -# complicated than a level 2 implementation. However, such an implementation allows the "client" -# or "confined" app to access the server's/supervisor's network with equal functionality to any -# native participant. In other words, an application which implements only the two-party protocol -# can be paired with a proxy app in order to participate in any network. -# -# So, when implementing Cap'n Proto in a new language, it makes sense to implement only the -# two-party protocol initially, and then pair applications with an appropriate proxy written in -# C++, rather than implement other parameterizations of the RPC protocol directly. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc::twoparty"); - -# Note: SturdyRef is not specified here. It is up to the application to define semantics of -# SturdyRefs if desired. - -enum Side { - server @0; - # The object lives on the "server" or "supervisor" end of the connection. Only the - # server/supervisor knows how to interpret the ref; to the client, it is opaque. - # - # Note that containers intending to implement strong confinement should rewrite SturdyRefs - # received from the external network before passing them on to the confined app. The confined - # app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps - # maliciously leak), but instead receives only a thing that it can pass back to the container - # later to restore the ref. See: - # http://www.erights.org/elib/capability/dist-confine.html - - client @1; - # The object lives on the "client" or "confined app" end of the connection. Only the client - # knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not - # actually know how to persist capabilities at all, so use of this is unusual. -} - -struct VatId { - side @0 :Side; -} - -struct ProvisionId { - # Only used for joins, since three-way introductions never happen on a two-party network. - - joinId @0 :UInt32; - # The ID from `JoinKeyPart`. -} - -struct RecipientId {} -# Never used, because there are only two parties. - -struct ThirdPartyCapId {} -# Never used, because there is no third party. - -struct JoinKeyPart { - # Joins in the two-party case are simplified by a few observations. - # - # First, on a two-party network, a Join only ever makes sense if the receiving end is also - # connected to other networks. A vat which is not connected to any other network can safely - # reject all joins. - # - # Second, since a two-party connection bisects the network -- there can be no other connections - # between the networks at either end of the connection -- if one part of a join crosses the - # connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request - # off some other network which needs to be forwarded across the two-party connection can - # collect all the parts on its end and only forward them across the two-party connection when all - # have been received. - # - # For example, imagine that Alice and Bob are vats connected over a two-party connection, and - # each is also connected to other networks. At some point, Alice receives one part of a Join - # request off her network. The request is addressed to a capability that Alice received from - # Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as - # if she hosted the capability locally (this is important so that if not all the Join parts end - # up at Alice, the original sender can detect the failed Join without hanging). As other parts - # trickle in, Alice verifies that each part is addressed to a capability from Bob and continues - # to respond to each one. Once the complete set of join parts is received, Alice checks if they - # were all for the exact same capability. If so, she doesn't need to send anything to Bob at - # all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were - # addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice - # does not forward the Join parts she received herself, but essentially forwards the Join as a - # whole. - # - # On Bob's end, since he knows that Alice will always send all parts of a Join together, he - # simply waits until he's received them all, then performs a join on the respective capabilities - # as if it had been requested locally. - - joinId @0 :UInt32; - # A number identifying this join, chosen by the sender. May be reused once `Finish` messages are - # sent corresponding to all of the `Join` messages. - - partCount @1 :UInt16; - # The number of capabilities to be joined. - - partNum @2 :UInt16; - # Which part this request targets -- a number in the range [0, partCount). -} - -struct JoinResult { - joinId @0 :UInt32; - # Matches `JoinKeyPart`. - - succeeded @1 :Bool; - # All JoinResults in the set will have the same value for `succeeded`. The receiver actually - # implements the join by waiting for all the `JoinKeyParts` and then performing its own join on - # them, then going back and answering all the join requests afterwards. - - cap @2 :AnyPointer; - # One of the JoinResults will have a non-null `cap` which is the joined capability. - # - # TODO(cleanup): Change `AnyPointer` to `Capability` when that is supported. -} diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp.h deleted file mode 100644 index 9d7820646a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.capnp.h +++ /dev/null @@ -1,726 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc-twoparty.capnp - -#ifndef CAPNP_INCLUDED_a184c7885cdaf2a1_ -#define CAPNP_INCLUDED_a184c7885cdaf2a1_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(9fd69ebc87b9719c); -enum class Side_9fd69ebc87b9719c: uint16_t { - SERVER, - CLIENT, -}; -CAPNP_DECLARE_ENUM(Side, 9fd69ebc87b9719c); -CAPNP_DECLARE_SCHEMA(d20b909fee733a8e); -CAPNP_DECLARE_SCHEMA(b88d09a9c5f39817); -CAPNP_DECLARE_SCHEMA(89f389b6fd4082c1); -CAPNP_DECLARE_SCHEMA(b47f4979672cb59d); -CAPNP_DECLARE_SCHEMA(95b29059097fca83); -CAPNP_DECLARE_SCHEMA(9d263a3630b7ebee); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { -namespace twoparty { - -typedef ::capnp::schemas::Side_9fd69ebc87b9719c Side; - -struct VatId { - VatId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d20b909fee733a8e, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ProvisionId { - ProvisionId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b88d09a9c5f39817, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct RecipientId { - RecipientId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(89f389b6fd4082c1, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapId { - ThirdPartyCapId() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b47f4979672cb59d, 0, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinKeyPart { - JoinKeyPart() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95b29059097fca83, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct JoinResult { - JoinResult() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9d263a3630b7ebee, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class VatId::Reader { -public: - typedef VatId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class VatId::Builder { -public: - typedef VatId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::capnp::rpc::twoparty::Side getSide(); - inline void setSide( ::capnp::rpc::twoparty::Side value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class VatId::Pipeline { -public: - typedef VatId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ProvisionId::Reader { -public: - typedef ProvisionId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ProvisionId::Builder { -public: - typedef ProvisionId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ProvisionId::Pipeline { -public: - typedef ProvisionId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class RecipientId::Reader { -public: - typedef RecipientId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class RecipientId::Builder { -public: - typedef RecipientId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class RecipientId::Pipeline { -public: - typedef RecipientId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapId::Reader { -public: - typedef ThirdPartyCapId Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapId::Builder { -public: - typedef ThirdPartyCapId Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapId::Pipeline { -public: - typedef ThirdPartyCapId Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinKeyPart::Reader { -public: - typedef JoinKeyPart Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline ::uint16_t getPartCount() const; - - inline ::uint16_t getPartNum() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinKeyPart::Builder { -public: - typedef JoinKeyPart Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline ::uint16_t getPartCount(); - inline void setPartCount( ::uint16_t value); - - inline ::uint16_t getPartNum(); - inline void setPartNum( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinKeyPart::Pipeline { -public: - typedef JoinKeyPart Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class JoinResult::Reader { -public: - typedef JoinResult Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId() const; - - inline bool getSucceeded() const; - - inline bool hasCap() const; - inline ::capnp::AnyPointer::Reader getCap() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class JoinResult::Builder { -public: - typedef JoinResult Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getJoinId(); - inline void setJoinId( ::uint32_t value); - - inline bool getSucceeded(); - inline void setSucceeded(bool value); - - inline bool hasCap(); - inline ::capnp::AnyPointer::Builder getCap(); - inline ::capnp::AnyPointer::Builder initCap(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class JoinResult::Pipeline { -public: - typedef JoinResult Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::twoparty::Side VatId::Reader::getSide() const { - return _reader.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::twoparty::Side VatId::Builder::getSide() { - return _builder.getDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void VatId::Builder::setSide( ::capnp::rpc::twoparty::Side value) { - _builder.setDataField< ::capnp::rpc::twoparty::Side>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t ProvisionId::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ProvisionId::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ProvisionId::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinKeyPart::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinKeyPart::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t JoinKeyPart::Reader::getPartNum() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t JoinKeyPart::Builder::getPartNum() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t JoinResult::Reader::getJoinId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t JoinResult::Builder::getJoinId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setJoinId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::getSucceeded() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool JoinResult::Builder::getSucceeded() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void JoinResult::Builder::setSucceeded(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline bool JoinResult::Reader::hasCap() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool JoinResult::Builder::hasCap() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader JoinResult::Reader::getCap() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::getCap() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder JoinResult::Builder::initCap() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -} // namespace -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a184c7885cdaf2a1_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.h b/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.h deleted file mode 100644 index 093c1fecdf..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc-twoparty.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_TWOPARTY_H_ -#define CAPNP_RPC_TWOPARTY_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "rpc.h" -#include "message.h" -#include -#include - -namespace capnp { - -namespace rpc { - namespace twoparty { - typedef VatId SturdyRefHostId; // For backwards-compatibility with version 0.4. - } -} - -typedef VatNetwork - TwoPartyVatNetworkBase; - -class TwoPartyVatNetwork: public TwoPartyVatNetworkBase, - private TwoPartyVatNetworkBase::Connection { - // A `VatNetwork` that consists of exactly two parties communicating over an arbitrary byte - // stream. This is used to implement the common case of a client/server network. - // - // See `ez-rpc.h` for a simple interface for setting up two-party clients and servers. - // Use `TwoPartyVatNetwork` only if you need the advanced features. - -public: - TwoPartyVatNetwork(kj::AsyncIoStream& stream, rpc::twoparty::Side side, - ReaderOptions receiveOptions = ReaderOptions()); - KJ_DISALLOW_COPY(TwoPartyVatNetwork); - - kj::Promise onDisconnect() { return disconnectPromise.addBranch(); } - // Returns a promise that resolves when the peer disconnects. - - rpc::twoparty::Side getSide() { return side; } - - // implements VatNetwork ----------------------------------------------------- - - kj::Maybe> connect( - rpc::twoparty::VatId::Reader ref) override; - kj::Promise> accept() override; - -private: - class OutgoingMessageImpl; - class IncomingMessageImpl; - - kj::AsyncIoStream& stream; - rpc::twoparty::Side side; - MallocMessageBuilder peerVatId; - ReaderOptions receiveOptions; - bool accepted = false; - - kj::Maybe> previousWrite; - // Resolves when the previous write completes. This effectively serves as the write queue. - // Becomes null when shutdown() is called. - - kj::Own>> acceptFulfiller; - // Fulfiller for the promise returned by acceptConnectionAsRefHost() on the client side, or the - // second call on the server side. Never fulfilled, because there is only one connection. - - kj::ForkedPromise disconnectPromise = nullptr; - - class FulfillerDisposer: public kj::Disposer { - // Hack: TwoPartyVatNetwork is both a VatNetwork and a VatNetwork::Connection. When the RPC - // system detects (or initiates) a disconnection, it drops its reference to the Connection. - // When all references have been dropped, then we want disconnectPromise to be fulfilled. - // So we hand out Owns with this disposer attached, so that we can detect when - // they are dropped. - - public: - mutable kj::Own> fulfiller; - mutable uint refcount = 0; - - void disposeImpl(void* pointer) const override; - }; - FulfillerDisposer disconnectFulfiller; - - kj::Own asConnection(); - // Returns a pointer to this with the disposer set to disconnectFulfiller. - - // implements Connection ----------------------------------------------------- - - rpc::twoparty::VatId::Reader getPeerVatId() override; - kj::Own newOutgoingMessage(uint firstSegmentWordSize) override; - kj::Promise>> receiveIncomingMessage() override; - kj::Promise shutdown() override; -}; - -class TwoPartyServer: private kj::TaskSet::ErrorHandler { - // Convenience class which implements a simple server which accepts connections on a listener - // socket and serices them as two-party connections. - -public: - explicit TwoPartyServer(Capability::Client bootstrapInterface); - - void accept(kj::Own&& connection); - // Accepts the connection for servicing. - - kj::Promise listen(kj::ConnectionReceiver& listener); - // Listens for connections on the given listener. The returned promise never resolves unless an - // exception is thrown while trying to accept. You may discard the returned promise to cancel - // listening. - -private: - Capability::Client bootstrapInterface; - kj::TaskSet tasks; - - struct AcceptedConnection; - - void taskFailed(kj::Exception&& exception) override; -}; - -class TwoPartyClient { - // Convenience class which implements a simple client. - -public: - explicit TwoPartyClient(kj::AsyncIoStream& connection); - TwoPartyClient(kj::AsyncIoStream& connection, Capability::Client bootstrapInterface, - rpc::twoparty::Side side = rpc::twoparty::Side::CLIENT); - - Capability::Client bootstrap(); - // Get the server's bootstrap interface. - - inline kj::Promise onDisconnect() { return network.onDisconnect(); } - -private: - TwoPartyVatNetwork network; - RpcSystem rpcSystem; -}; - -} // namespace capnp - -#endif // CAPNP_RPC_TWOPARTY_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp b/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp deleted file mode 100644 index cd808b39f7..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp +++ /dev/null @@ -1,1399 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xb312981b2552a250; -# Recall that Cap'n Proto RPC allows messages to contain references to remote objects that -# implement interfaces. These references are called "capabilities", because they both designate -# the remote object to use and confer permission to use it. -# -# Recall also that Cap'n Proto RPC has the feature that when a method call itself returns a -# capability, the caller can begin calling methods on that capability _before the first call has -# returned_. The caller essentially sends a message saying "Hey server, as soon as you finish -# that previous call, do this with the result!". Cap'n Proto's RPC protocol makes this possible. -# -# The protocol is significantly more complicated than most RPC protocols. However, this is -# implementation complexity that underlies an easy-to-grasp higher-level model of object oriented -# programming. That is, just like TCP is a surprisingly complicated protocol that implements a -# conceptually-simple byte stream abstraction, Cap'n Proto is a surprisingly complicated protocol -# that implements a conceptually-simple object abstraction. -# -# Cap'n Proto RPC is based heavily on CapTP, the object-capability protocol used by the E -# programming language: -# http://www.erights.org/elib/distrib/captp/index.html -# -# Cap'n Proto RPC takes place between "vats". A vat hosts some set of objects and talks to other -# vats through direct bilateral connections. Typically, there is a 1:1 correspondence between vats -# and processes (in the unix sense of the word), although this is not strictly always true (one -# process could run multiple vats, or a distributed virtual vat might live across many processes). -# -# Cap'n Proto does not distinguish between "clients" and "servers" -- this is up to the application. -# Either end of any connection can potentially hold capabilities pointing to the other end, and -# can call methods on those capabilities. In the doc comments below, we use the words "sender" -# and "receiver". These refer to the sender and receiver of an instance of the struct or field -# being documented. Sometimes we refer to a "third-party" that is neither the sender nor the -# receiver. Documentation is generally written from the point of view of the sender. -# -# It is generally up to the vat network implementation to securely verify that connections are made -# to the intended vat as well as to encrypt transmitted data for privacy and integrity. See the -# `VatNetwork` example interface near the end of this file. -# -# When a new connection is formed, the only interesting things that can be done are to send a -# `Bootstrap` (level 0) or `Accept` (level 3) message. -# -# Unless otherwise specified, messages must be delivered to the receiving application in the same -# order in which they were initiated by the sending application. The goal is to support "E-Order", -# which states that two calls made on the same reference must be delivered in the order which they -# were made: -# http://erights.org/elib/concurrency/partial-order.html -# -# Since the full protocol is complicated, we define multiple levels of support that an -# implementation may target. For many applications, level 1 support will be sufficient. -# Comments in this file indicate which level requires the corresponding feature to be -# implemented. -# -# * **Level 0:** The implementation does not support object references. Only the bootstrap interface -# can be called. At this level, the implementation does not support object-oriented protocols and -# is similar in complexity to JSON-RPC or Protobuf services. This level should be considered only -# a temporary stepping-stone toward level 1 as the lack of object references drastically changes -# how protocols are designed. Applications _should not_ attempt to design their protocols around -# the limitations of level 0 implementations. -# -# * **Level 1:** The implementation supports simple bilateral interaction with object references -# and promise pipelining, but interactions between three or more parties are supported only via -# proxying of objects. E.g. if Alice (in Vat A) wants to send Bob (in Vat B) a capability -# pointing to Carol (in Vat C), Alice must create a proxy of Carol within Vat A and send Bob a -# reference to that; Bob cannot form a direct connection to Carol. Level 1 implementations do -# not support checking if two capabilities received from different vats actually point to the -# same object ("join"), although they should be able to do this check on capabilities received -# from the same vat. -# -# * **Level 2:** The implementation supports saving persistent capabilities -- i.e. capabilities -# that remain valid even after disconnect, and can be restored on a future connection. When a -# capability is saved, the requester receives a `SturdyRef`, which is a token that can be used -# to restore the capability later. -# -# * **Level 3:** The implementation supports three-way interactions. That is, if Alice (in Vat A) -# sends Bob (in Vat B) a capability pointing to Carol (in Vat C), then Vat B will automatically -# form a direct connection to Vat C rather than have requests be proxied through Vat A. -# -# * **Level 4:** The entire protocol is implemented, including joins (checking if two capabilities -# are equivalent). -# -# Note that an implementation must also support specific networks (transports), as described in -# the "Network-specific Parameters" section below. An implementation might have different levels -# depending on the network used. -# -# New implementations of Cap'n Proto should start out targeting the simplistic two-party network -# type as defined in `rpc-twoparty.capnp`. With this network type, level 3 is irrelevant and -# levels 2 and 4 are much easier than usual to implement. When such an implementation is paired -# with a container proxy, the contained app effectively gets to make full use of the proxy's -# network at level 4. And since Cap'n Proto IPC is extremely fast, it may never make sense to -# bother implementing any other vat network protocol -- just use the correct container type and get -# it for free. - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("capnp::rpc"); - -# ======================================================================================== -# The Four Tables -# -# Cap'n Proto RPC connections are stateful (although an application built on Cap'n Proto could -# export a stateless interface). As in CapTP, for each open connection, a vat maintains four state -# tables: questions, answers, imports, and exports. See the diagram at: -# http://www.erights.org/elib/distrib/captp/4tables.html -# -# The question table corresponds to the other end's answer table, and the imports table corresponds -# to the other end's exports table. -# -# The entries in each table are identified by ID numbers (defined below as 32-bit integers). These -# numbers are always specific to the connection; a newly-established connection starts with no -# valid IDs. Since low-numbered IDs will pack better, it is suggested that IDs be assigned like -# Unix file descriptors -- prefer the lowest-number ID that is currently available. -# -# IDs in the questions/answers tables are chosen by the questioner and generally represent method -# calls that are in progress. -# -# IDs in the imports/exports tables are chosen by the exporter and generally represent objects on -# which methods may be called. Exports may be "settled", meaning the exported object is an actual -# object living in the exporter's vat, or they may be "promises", meaning the exported object is -# the as-yet-unknown result of an ongoing operation and will eventually be resolved to some other -# object once that operation completes. Calls made to a promise will be forwarded to the eventual -# target once it is known. The eventual replacement object does *not* get the same ID as the -# promise, as it may turn out to be an object that is already exported (so already has an ID) or -# may even live in a completely different vat (and so won't get an ID on the same export table -# at all). -# -# IDs can be reused over time. To make this safe, we carefully define the lifetime of IDs. Since -# messages using the ID could be traveling in both directions simultaneously, we must define the -# end of life of each ID _in each direction_. The ID is only safe to reuse once it has been -# released by both sides. -# -# When a Cap'n Proto connection is lost, everything on the four tables is lost. All questions are -# canceled and throw exceptions. All imports become broken (all future calls to them throw -# exceptions). All exports and answers are implicitly released. The only things not lost are -# persistent capabilities (`SturdyRef`s). The application must plan for this and should respond by -# establishing a new connection and restoring from these persistent capabilities. - -using QuestionId = UInt32; -# **(level 0)** -# -# Identifies a question in the sender's question table (which corresponds to the receiver's answer -# table). The questioner (caller) chooses an ID when making a call. The ID remains valid in -# caller -> callee messages until a Finish message is sent, and remains valid in callee -> caller -# messages until a Return message is sent. - -using AnswerId = QuestionId; -# **(level 0)** -# -# Identifies an answer in the sender's answer table (which corresponds to the receiver's question -# table). -# -# AnswerId is physically equivalent to QuestionId, since the question and answer tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. - -using ExportId = UInt32; -# **(level 1)** -# -# Identifies an exported capability or promise in the sender's export table (which corresponds -# to the receiver's import table). The exporter chooses an ID before sending a capability over the -# wire. If the capability is already in the table, the exporter should reuse the same ID. If the -# ID is a promise (as opposed to a settled capability), this must be indicated at the time the ID -# is introduced (e.g. by using `senderPromise` instead of `senderHosted` in `CapDescriptor`); in -# this case, the importer shall expect a later `Resolve` message that replaces the promise. -# -# ExportId/ImportIds are subject to reference counting. Whenever an `ExportId` is sent over the -# wire (from the exporter to the importer), the export's reference count is incremented (unless -# otherwise specified). The reference count is later decremented by a `Release` message. Since -# the `Release` message can specify an arbitrary number by which to reduce the reference count, the -# importer should usually batch reference decrements and only send a `Release` when it believes the -# reference count has hit zero. Of course, it is possible that a new reference to the export is -# in-flight at the time that the `Release` message is sent, so it is necessary for the exporter to -# keep track of the reference count on its end as well to avoid race conditions. -# -# When a connection is lost, all exports are implicitly released. It is not possible to restore -# a connection state after disconnect (although a transport layer could implement a concept of -# persistent connections if it is transparent to the RPC layer). - -using ImportId = ExportId; -# **(level 1)** -# -# Identifies an imported capability or promise in the sender's import table (which corresponds to -# the receiver's export table). -# -# ImportId is physically equivalent to ExportId, since the export and import tables correspond, -# but we define a separate type for documentation purposes: we always use the type representing -# the sender's point of view. -# -# An `ImportId` remains valid in importer -> exporter messages until the importer has sent -# `Release` messages that (it believes) have reduced the reference count to zero. - -# ======================================================================================== -# Messages - -struct Message { - # An RPC connection is a bi-directional stream of Messages. - - union { - unimplemented @0 :Message; - # The sender previously received this message from the peer but didn't understand it or doesn't - # yet implement the functionality that was requested. So, the sender is echoing the message - # back. In some cases, the receiver may be able to recover from this by pretending the sender - # had taken some appropriate "null" action. - # - # For example, say `resolve` is received by a level 0 implementation (because a previous call - # or return happened to contain a promise). The level 0 implementation will echo it back as - # `unimplemented`. The original sender can then simply release the cap to which the promise - # had resolved, thus avoiding a leak. - # - # For any message type that introduces a question, if the message comes back unimplemented, - # the original sender may simply treat it as if the question failed with an exception. - # - # In cases where there is no sensible way to react to an `unimplemented` message (without - # resource leaks or other serious problems), the connection may need to be aborted. This is - # a gray area; different implementations may take different approaches. - - abort @1 :Exception; - # Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. - # because the sender received an invalid or nonsensical message (`isCallersFault` is true) or - # because the sender had an internal error (`isCallersFault` is false). The sender will shut - # down the outgoing half of the connection after `abort` and will completely close the - # connection shortly thereafter (it's up to the sender how much of a time buffer they want to - # offer for the client to receive the `abort` before the connection is reset). - - # Level 0 features ----------------------------------------------- - - bootstrap @8 :Bootstrap; # Request the peer's bootstrap interface. - call @2 :Call; # Begin a method call. - return @3 :Return; # Complete a method call. - finish @4 :Finish; # Release a returned answer / cancel a call. - - # Level 1 features ----------------------------------------------- - - resolve @5 :Resolve; # Resolve a previously-sent promise. - release @6 :Release; # Release a capability so that the remote object can be deallocated. - disembargo @13 :Disembargo; # Lift an embargo used to enforce E-order over promise resolution. - - # Level 2 features ----------------------------------------------- - - obsoleteSave @7 :AnyPointer; - # Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced - # by the `Persistent` interface defined in `persistent.capnp`. This operation was never - # implemented. - - obsoleteDelete @9 :AnyPointer; - # Obsolete way to delete a SturdyRef. This operation was never implemented. - - # Level 3 features ----------------------------------------------- - - provide @10 :Provide; # Provide a capability to a third party. - accept @11 :Accept; # Accept a capability provided by a third party. - - # Level 4 features ----------------------------------------------- - - join @12 :Join; # Directly connect to the common root of two or more proxied caps. - } -} - -# Level 0 message types ---------------------------------------------- - -struct Bootstrap { - # **(level 0)** - # - # Get the "bootstrap" interface exported by the remote vat. - # - # For level 0, 1, and 2 implementations, the "bootstrap" interface is simply the main interface - # exported by a vat. If the vat acts as a server fielding connections from clients, then the - # bootstrap interface defines the basic functionality available to a client when it connects. - # The exact interface definition obviously depends on the application. - # - # We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would - # never be used. In such a world, any time you connect to a new vat, you do so because you - # received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message - # you send is `Accept`, and further communications derive from there. `Bootstrap` is not used. - # - # In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would - # actually return a new Cap'n Proto capability, thus introducing you to the target system via - # level 3 RPC. Applications would receive the capability to talk to DNS in the first place as - # an initial endowment or part of a Powerbox interaction. Therefore, an app can form arbitrary - # connections without ever using `Bootstrap`. - # - # Of course, in the real world, DNS is not Cap'n-Proto-based, and we don't want Cap'n Proto to - # require a whole new internet infrastructure to be useful. Therefore, we offer bootstrap - # interfaces as a way to get up and running without a level 3 introduction. Thus, bootstrap - # interfaces are used to "bootstrap" from other, non-Cap'n-Proto-based means of service discovery, - # such as legacy DNS. - # - # Note that a vat need not provide a bootstrap interface, and in fact many vats (especially those - # acting as clients) do not. In this case, the vat should either reply to `Bootstrap` with a - # `Return` indicating an exception, or should return a dummy capability with no methods. - - questionId @0 :QuestionId; - # A new question ID identifying this request, which will eventually receive a Return message - # containing the restored capability. - - deprecatedObjectId @1 :AnyPointer; - # ** DEPRECATED ** - # - # A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies - # which one to return. If this pointer is null, then the default bootstrap interface is returned. - # - # As of verison 0.5, use of this field is deprecated. If a service wants to export multiple - # bootstrap interfaces, it should instead define a single bootstarp interface that has methods - # that return each of the other interfaces. - # - # **History** - # - # In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. - # At the time, it was thought that this would eventually serve as the way to restore SturdyRefs - # (level 2). Meanwhile, an application could offer its "main" interface on a well-known - # (non-secret) SturdyRef. - # - # Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only - # used to obtain the main interface. Since most applications had only one main interface that - # they wanted to restore, they tended to designate this with a null `objectId`. - # - # Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting - # multiple main interfaces by allowing them to be exported under string names. In this case, - # `objectId` was a Text value specifying the name. - # - # All of this proved problematic for several reasons: - # - # - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what - # machine to connect to and would be able to immediately restore a SturdyRef on connection. - # However, in practice, the ability to restore SturdyRefs is itself a capability that may - # require going through an authentication process to obtain. Thus, it makes more sense to - # define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is - # offered as the vat's bootstrap interface, then this is equivalent to the old arrangement. - # - # - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the - # practice of exporting singleton services with string names. If singleton services are desired, - # it is better to have one main interface that has methods that can be used to obtain each - # service, in order to get all the usual benefits of schemas and type checking. - # - # - Overloading "Restore" also had a security problem: Often, "main" or "well-known" - # capabilities exported by a vat are in fact not public: they are intended to be accessed only - # by clients who are capable of forming a connection to the vat. This can lead to trouble if - # the client itself has other clients and wishes to foward some `Restore` requests from those - # external clients -- it has to be very careful not to allow through `Restore` requests - # addressing the default capability. - # - # For example, consider the case of a sandboxed Sandstorm application and its supervisor. The - # application exports a default capability to its supervisor that provides access to - # functionality that only the supervisor is supposed to access. Meanwhile, though, applications - # may publish other capabilities that may be persistent, in which case the application needs - # to field `Restore` requests that could come from anywhere. These requests of course have to - # pass through the supervisor, as all communications with the outside world must. But, the - # supervisor has to be careful not to honor an external request addressing the application's - # default capability, since this capability is privileged. Unfortunately, the default - # capability cannot be given an unguessable name, because then the supervisor itself would not - # be able to address it! - # - # As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for - # use in restoring SturdyRefs. - # - # Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a - # SturdyRef, but indicated that the client would not restore the ref again in the future. This - # operation was never implemented, so it was removed entirely. If a "delete" operation is desired, - # it should exist as a method on the same interface that handles restoring SturdyRefs. However, - # the utility of such an operation is questionable. You wouldn't be able to rely on it for - # garbage collection since a client could always disappear permanently without remembering to - # delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to - # design systems such that SturdyRefs never represent "owned" pointers. - # - # For example, say a SturdyRef points to an image file hosted on some server. That image file - # should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by - # a user who can delete the image at any time. If the user deletes the image, the SturdyRef - # stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the - # existence of the image in its collection. -} - -struct Call { - # **(level 0)** - # - # Message type initiating a method call on a capability. - - questionId @0 :QuestionId; - # A number, chosen by the caller, that identifies this call in future messages. This number - # must be different from all other calls originating from the same end of the connection (but - # may overlap with question IDs originating from the opposite end). A fine strategy is to use - # sequential question IDs, but the recipient should not assume this. - # - # A question ID can be reused once both: - # - A matching Return has been received from the callee. - # - A matching Finish has been sent from the caller. - - target @1 :MessageTarget; - # The object that should receive this call. - - interfaceId @2 :UInt64; - # The type ID of the interface being called. Each capability may implement multiple interfaces. - - methodId @3 :UInt16; - # The ordinal number of the method to call within the requested interface. - - allowThirdPartyTailCall @8 :Bool = false; - # Indicates whether or not the receiver is allowed to send a `Return` containing - # `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee - # will have to proxy the return in the case of a tail call to a third-party vat. - - params @4 :Payload; - # The call parameters. `params.content` is a struct whose fields correspond to the parameters of - # the method. - - sendResultsTo :union { - # Where should the return message be sent? - - caller @5 :Void; - # Send the return message back to the caller (the usual). - - yourself @6 :Void; - # **(level 1)** - # - # Don't actually return the results to the sender. Instead, hold on to them and await - # instructions from the sender regarding what to do with them. In particular, the sender - # may subsequently send a `Return` for some other call (which the receiver had previously made - # to the sender) with `takeFromOtherQuestion` set. The results from this call are then used - # as the results of the other call. - # - # When `yourself` is used, the receiver must still send a `Return` for the call, but sets the - # field `resultsSentElsewhere` in that `Return` rather than including the results. - # - # This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up - # returning the result of a call from Vat B back to Vat A. - # - # In particular, the most common use case for this feature is when Vat A makes a call to a - # promise in Vat B, and then that promise ends up resolving to a capability back in Vat A. - # Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself` - # in the calls so that the results need not pass back through Vat B. - # - # For example: - # - Alice, in Vat A, call foo() on Bob in Vat B. - # - Alice makes a pipelined call bar() on the promise returned by foo(). - # - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next - # to Alice). - # - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'(). - # Notice that bar() and bar'() are travelling in opposite directions on the same network - # link. - # - The `Call` for bar'() has `sendResultsTo` set to `yourself`, with the value being the - # question ID originally assigned to the bar() call. - # - Vat A receives bar'() and delivers it to Carol. - # - When bar'() returns, Vat A immediately takes the results and returns them from bar(). - # - Meanwhile, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere` set in - # place of results. - # - Vat A sends a `Finish` for that call to Vat B. - # - Vat B receives the `Return` for bar'() and sends a `Return` for bar(), with - # `receivedFromYourself` set in place of the results. - # - Vat B receives the `Finish` for bar() and sends a `Finish` to bar'(). - - thirdParty @7 :RecipientId; - # **(level 3)** - # - # The call's result should be returned to a different vat. The receiver (the callee) expects - # to receive an `Accept` message from the indicated vat, and should return the call's result - # to it, rather than to the sender of the `Call`. - # - # This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` - # messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from - # Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends - # an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C - # also sends a `Return` to Vat B with `resultsSentElsewhere`. - } -} - -struct Return { - # **(level 0)** - # - # Message type sent from callee to caller indicating that the call has completed. - - answerId @0 :AnswerId; - # Equal to the QuestionId of the corresponding `Call` message. - - releaseParamCaps @1 :Bool = true; - # If true, all capabilities that were in the params should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # to set it to false they'll quickly get errors. - - union { - results @2 :Payload; - # The result. - # - # For regular method calls, `results.content` points to the result struct. - # - # For a `Return` in response to an `Accept`, `results` contains a single capability (rather - # than a struct), and `results.content` is just a capability pointer with index 0. A `Finish` - # is still required in this case. - - exception @3 :Exception; - # Indicates that the call failed and explains why. - - canceled @4 :Void; - # Indicates that the call was canceled due to the caller sending a Finish message - # before the call had completed. - - resultsSentElsewhere @5 :Void; - # This is set when returning from a `Call` that had `sendResultsTo` set to something other - # than `caller`. - - takeFromOtherQuestion @6 :QuestionId; - # The sender has also sent (before this message) a `Call` with the given question ID and with - # `sendResultsTo.yourself` set, and the results of that other call should be used as the - # results here. - - acceptFromThirdParty @7 :ThirdPartyCapId; - # **(level 3)** - # - # The caller should contact a third-party vat to pick up the results. An `Accept` message - # sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`. - # It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set. - } -} - -struct Finish { - # **(level 0)** - # - # Message type sent from the caller to the callee to indicate: - # 1) The questionId will no longer be used in any messages sent by the callee (no further - # pipelined requests). - # 2) If the call has not returned yet, the caller no longer cares about the result. If nothing - # else cares about the result either (e.g. there are no other outstanding calls pipelined on - # the result of this one) then the callee may wish to immediately cancel the operation and - # send back a Return message with "canceled" set. However, implementations are not required - # to support premature cancellation -- instead, the implementation may wait until the call - # actually completes and send a normal `Return` message. - # - # TODO(someday): Should we separate (1) and implicitly releasing result capabilities? It would be - # possible and useful to notify the server that it doesn't need to keep around the response to - # service pipeline requests even though the caller still wants to receive it / hasn't yet - # finished processing it. It could also be useful to notify the server that it need not marshal - # the results because the caller doesn't want them anyway, even if the caller is still sending - # pipelined calls, although this seems less useful (just saving some bytes on the wire). - - questionId @0 :QuestionId; - # ID of the call whose result is to be released. - - releaseResultCaps @1 :Bool = true; - # If true, all capabilities that were in the results should be considered released. The sender - # must not send separate `Release` messages for them. Level 0 implementations in particular - # should always set this true. This defaults true because if level 0 implementations forget to - # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget - # set it false they'll quickly get errors. -} - -# Level 1 message types ---------------------------------------------- - -struct Resolve { - # **(level 1)** - # - # Message type sent to indicate that a previously-sent promise has now been resolved to some other - # object (possibly another promise) -- or broken, or canceled. - # - # Keep in mind that it's possible for a `Resolve` to be sent to a level 0 implementation that - # doesn't implement it. For example, a method call or return might contain a capability in the - # payload. Normally this is fine even if the receiver is level 0, because they will implicitly - # release all such capabilities on return / finish. But if the cap happens to be a promise, then - # a follow-up `Resolve` may be sent regardless of this release. The level 0 receiver will reply - # with an `unimplemented` message, and the sender (of the `Resolve`) can respond to this as if the - # receiver had immediately released any capability to which the promise resolved. - # - # When implementing promise resolution, it's important to understand how embargos work and the - # tricky case of the Tribble 4-way race condition. See the comments for the Disembargo message, - # below. - - promiseId @0 :ExportId; - # The ID of the promise to be resolved. - # - # Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does - # _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver - # will release the export soon after receiving `Resolve`, and the sender will not send this - # `ExportId` again until it has been released and recycled. - # - # When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise, - # this indicates that the sender will follow up at some point with a `Resolve` message. If the - # same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the - # same ID is sent again later _after_ a `Resolve`, it can only be because the export's - # reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore - # this later promise does _not_ correspond to the earlier `Resolve`. - # - # If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve` - # message may or may not still be sent (the `Resolve` may have already been in-flight when - # `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer - # any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which - # the receiver has no knowledge, because it already released it earlier. In this case, the - # receiver should simply release the capability to which the promise resolved. - - union { - cap @1 :CapDescriptor; - # The object to which the promise resolved. - # - # The sender promises that from this point forth, until `promiseId` is released, it shall - # simply forward all messages to the capability designated by `cap`. This is true even if - # `cap` itself happens to desigate another promise, and that other promise later resolves -- - # messages sent to `promiseId` shall still go to that other promise, not to its resolution. - # This is important in the case that the receiver of the `Resolve` ends up sending a - # `Disembargo` message towards `promiseId` in order to control message ordering -- that - # `Disembargo` really needs to reflect back to exactly the object designated by `cap` even - # if that object is itself a promise. - - exception @2 :Exception; - # Indicates that the promise was broken. - } -} - -struct Release { - # **(level 1)** - # - # Message type sent to indicate that the sender is done with the given capability and the receiver - # can free resources allocated to it. - - id @0 :ImportId; - # What to release. - - referenceCount @1 :UInt32; - # The amount by which to decrement the reference count. The export is only actually released - # when the reference count reaches zero. -} - -struct Disembargo { - # **(level 1)** - # - # Message sent to indicate that an embargo on a recently-resolved promise may now be lifted. - # - # Embargos are used to enforce E-order in the presence of promise resolution. That is, if an - # application makes two calls foo() and bar() on the same capability reference, in that order, - # the calls should be delivered in the order in which they were made. But if foo() is called - # on a promise, and that promise happens to resolve before bar() is called, then the two calls - # may travel different paths over the network, and thus could arrive in the wrong order. In - # this case, the call to `bar()` must be embargoed, and a `Disembargo` message must be sent along - # the same path as `foo()` to ensure that the `Disembargo` arrives after `foo()`. Once the - # `Disembargo` arrives, `bar()` can then be delivered. - # - # There are two particular cases where embargos are important. Consider object Alice, in Vat A, - # who holds a promise P, pointing towards Vat B, that eventually resolves to Carol. The two - # cases are: - # - Carol lives in Vat A, i.e. next to Alice. In this case, Vat A needs to send a `Disembargo` - # message that echos through Vat B and back, to ensure that all pipelined calls on the promise - # have been delivered. - # - Carol lives in a different Vat C. When the promise resolves, a three-party handoff occurs - # (see `Provide` and `Accept`, which constitute level 3 of the protocol). In this case, we - # piggyback on the state that has already been set up to handle the handoff: the `Accept` - # message (from Vat A to Vat C) is embargoed, as are all pipelined messages sent to it, while - # a `Disembargo` message is sent from Vat A through Vat B to Vat C. See `Accept.embargo` for - # an example. - # - # Note that in the case where Carol actually lives in Vat B (i.e., the same vat that the promise - # already pointed at), no embargo is needed, because the pipelined calls are delivered over the - # same path as the later direct calls. - # - # Keep in mind that promise resolution happens both in the form of Resolve messages as well as - # Return messages (which resolve PromisedAnswers). Embargos apply in both cases. - # - # An alternative strategy for enforcing E-order over promise resolution could be for Vat A to - # implement the embargo internally. When Vat A is notified of promise resolution, it could - # send a dummy no-op call to promise P and wait for it to complete. Until that call completes, - # all calls to the capability are queued locally. This strategy works, but is pessimistic: - # in the three-party case, it requires an A -> B -> C -> B -> A round trip before calls can start - # being delivered directly to from Vat A to Vat C. The `Disembargo` message allows latency to be - # reduced. (In the two-party loopback case, the `Disembargo` message is just a more explicit way - # of accomplishing the same thing as a no-op call, but isn't any faster.) - # - # *The Tribble 4-way Race Condition* - # - # Any implementation of promise resolution and embargos must be aware of what we call the - # "Tribble 4-way race condition", after Dean Tribble, who explained the problem in a lively - # Friam meeting. - # - # Embargos are designed to work in the case where a two-hop path is being shortened to one hop. - # But sometimes there are more hops. Imagine that Alice has a reference to a remote promise P1 - # that eventually resolves to _another_ remote promise P2 (in a third vat), which _at the same - # time_ happens to resolve to Bob (in a fourth vat). In this case, we're shortening from a 3-hop - # path (with four parties) to a 1-hop path (Alice -> Bob). - # - # Extending the embargo/disembargo protocol to be able to shorted multiple hops at once seems - # difficult. Instead, we make a rule that prevents this case from coming up: - # - # One a promise P has been resolved to a remove object reference R, then all further messages - # received addressed to P will be forwarded strictly to R. Even if it turns out later that R is - # itself a promise, and has resolved to some other object Q, messages sent to P will still be - # forwarded to R, not directly to Q (R will of course further forward the messages to Q). - # - # This rule does not cause a significant performance burden because once P has resolved to R, it - # is expected that people sending messages to P will shortly start sending them to R instead and - # drop P. P is at end-of-life anyway, so it doesn't matter if it ignores chances to further - # optimize its path. - - target @0 :MessageTarget; - # What is to be disembargoed. - - using EmbargoId = UInt32; - # Used in `senderLoopback` and `receiverLoopback`, below. - - context :union { - senderLoopback @1 :EmbargoId; - # The sender is requesting a disembargo on a promise that is known to resolve back to a - # capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls - # on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback` - # set to the same value as `senderLoopback`. This value is chosen by the sender, and since - # it is also consumed be the sender, the sender can use whatever strategy it wants to make sure - # the value is unambiguous. - # - # The receiver must verify that the target capability actually resolves back to the sender's - # vat. Otherwise, the sender has committed a protocol error and should be disconnected. - - receiverLoopback @2 :EmbargoId; - # The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to - # this capability, and that Disembargo is now being echoed back. - - accept @3 :Void; - # **(level 3)** - # - # The sender is requesting a disembargo on a promise that is known to resolve to a third-party - # capability that the sender is currently in the process of accepting (using `Accept`). - # The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The - # receiver should now send a `Disembargo` with `provide` set to the question ID of that - # `Provide` message. - # - # See `Accept.embargo` for an example. - - provide @4 :QuestionId; - # **(level 3)** - # - # The sender is requesting a disembargo on a capability currently being provided to a third - # party. The question ID identifies the `Provide` message previously sent by the sender to - # this capability. On receipt, the receiver (the capability host) shall release the embargo - # on the `Accept` message that it has received from the third party. See `Accept.embargo` for - # an example. - } -} - -# Level 2 message types ---------------------------------------------- - -# See persistent.capnp. - -# Level 3 message types ---------------------------------------------- - -struct Provide { - # **(level 3)** - # - # Message type sent to indicate that the sender wishes to make a particular capability implemented - # by the receiver available to a third party for direct access (without the need for the third - # party to proxy through the sender). - # - # (In CapTP, `Provide` and `Accept` are methods of the global `NonceLocator` object exported by - # every vat. In Cap'n Proto, we bake this into the core protocol.) - - questionId @0 :QuestionId; - # Question ID to be held open until the recipient has received the capability. A result will be - # returned once the third party has successfully received the capability. The sender must at some - # point send a `Finish` message as with any other call, and that message can be used to cancel the - # whole operation. - - target @1 :MessageTarget; - # What is to be provided to the third party. - - recipient @2 :RecipientId; - # Identity of the third party that is expected to pick up the capability. -} - -struct Accept { - # **(level 3)** - # - # Message type sent to pick up a capability hosted by the receiving vat and provided by a third - # party. The third party previously designated the capability using `Provide`. - # - # This message is also used to pick up a redirected return -- see `Return.redirect`. - - questionId @0 :QuestionId; - # A new question ID identifying this accept message, which will eventually receive a Return - # message containing the provided capability (or the call result in the case of a redirected - # return). - - provision @1 :ProvisionId; - # Identifies the provided object to be picked up. - - embargo @2 :Bool; - # If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent, - # and any pipelined calls will not be delivered, until the embargo is released. The receiver - # (the capability host) will expect the provider (the vat that sent the `Provide` message) to - # eventually send a `Disembargo` message with the field `context.provide` set to the question ID - # of the original `Provide` message. At that point, the embargo is released and the queued - # messages are delivered. - # - # For example: - # - Alice, in Vat A, holds a promise P, which currently points toward Vat B. - # - Alice calls foo() on P. The `Call` message is sent to Vat B. - # - The promise P in Vat B ends up resolving to Carol, in Vat C. - # - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient. - # - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a - # `ThirdPartyCapId` identifying Carol in Vat C. - # - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that - # it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept` - # message. - # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set. - # - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't - # know anything about the mechanics of promise resolution happening under the hood, but she - # expects that bar() will be delivered after foo() because that is the order in which she - # initiated the calls. - # - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which - # hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability - # are embargoed, Vat C does not deliver the call yet. - # - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C. - # - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the - # question ID of the `Provide` message it had sent previously. - # - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo() - # before delivering bar(). - # - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from - # Vat A, as well as deliver bar(). -} - -# Level 4 message types ---------------------------------------------- - -struct Join { - # **(level 4)** - # - # Message type sent to implement E.join(), which, given a number of capabilities that are - # expected to be equivalent, finds the underlying object upon which they all agree and forms a - # direct connection to it, skipping any proxies that may have been constructed by other vats - # while transmitting the capability. See: - # http://erights.org/elib/equality/index.html - # - # Note that this should only serve to bypass fully-transparent proxies -- proxies that were - # created merely for convenience, without any intention of hiding the underlying object. - # - # For example, say Bob holds two capabilities hosted by Alice and Carol, but he expects that both - # are simply proxies for a capability hosted elsewhere. He then issues a join request, which - # operates as follows: - # - Bob issues Join requests on both Alice and Carol. Each request contains a different piece - # of the JoinKey. - # - Alice is proxying a capability hosted by Dana, so forwards the request to Dana's cap. - # - Dana receives the first request and sees that the JoinKeyPart is one of two. She notes that - # she doesn't have the other part yet, so she records the request and responds with a - # JoinResult. - # - Alice relays the JoinAswer back to Bob. - # - Carol is also proxying a capability from Dana, and so forwards her Join request to Dana as - # well. - # - Dana receives Carol's request and notes that she now has both parts of a JoinKey. She - # combines them in order to form information needed to form a secure connection to Bob. She - # also responds with another JoinResult. - # - Bob receives the responses from Alice and Carol. He uses the returned JoinResults to - # determine how to connect to Dana and attempts to form the connection. Since Bob and Dana now - # agree on a secret key that neither Alice nor Carol ever saw, this connection can be made - # securely even if Alice or Carol is conspiring against the other. (If Alice and Carol are - # conspiring _together_, they can obviously reproduce the key, but this doesn't matter because - # the whole point of the join is to verify that Alice and Carol agree on what capability they - # are proxying.) - # - # If the two capabilities aren't actually proxies of the same object, then the join requests - # will come back with conflicting `hostId`s and the join will fail before attempting to form any - # connection. - - questionId @0 :QuestionId; - # Question ID used to respond to this Join. (Note that this ID only identifies one part of the - # request for one hop; each part has a different ID and relayed copies of the request have - # (probably) different IDs still.) - # - # The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult` - # is relayed from the joined object's host, possibly with transformation applied as needed - # by the network. - # - # Like any return, the result must be released using a `Finish`. However, this release - # should not occur until the joiner has either successfully connected to the joined object. - # Vats relaying a `Join` message similarly must not release the result they receive until the - # return they relayed back towards the joiner has itself been released. This allows the - # joined object's host to detect when the Join operation is canceled before completing -- if - # it receives a `Finish` for one of the join results before the joiner successfully - # connects. It can then free any resources it had allocated as part of the join. - - target @1 :MessageTarget; - # The capability to join. - - keyPart @2 :JoinKeyPart; - # A part of the join key. These combine to form the complete join key, which is used to establish - # a direct connection. - - # TODO(before implementing): Change this so that multiple parts can be sent in a single Join - # message, so that if multiple join parts are going to cross the same connection they can be sent - # together, so that the receive can potentially optimize its handling of them. In the case where - # all parts are bundled together, should the recipient be expected to simply return a cap, so - # that the caller can immediately start pipelining to it? -} - -# ======================================================================================== -# Common structures used in messages - -struct MessageTarget { - # The target of a `Call` or other messages that target a capability. - - union { - importedCap @0 :ImportId; - # This message is to a capability or promise previously imported by the caller (exported by - # the receiver). - - promisedAnswer @1 :PromisedAnswer; - # This message is to a capability that is expected to be returned by another call that has not - # yet been completed. - # - # At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so - # that initial startup doesn't require a round trip. - } -} - -struct Payload { - # Represents some data structure that might contain capabilities. - - content @0 :AnyPointer; - # Some Cap'n Proto data structure. Capability pointers embedded in this structure index into - # `capTable`. - - capTable @1 :List(CapDescriptor); - # Descriptors corresponding to the cap pointers in `content`. -} - -struct CapDescriptor { - # **(level 1)** - # - # When an application-defined type contains an interface pointer, that pointer contains an index - # into the message's capability table -- i.e. the `capTable` part of the `Payload`. Each - # capability in the table is represented as a `CapDescriptor`. The runtime API should not reveal - # the CapDescriptor directly to the application, but should instead wrap it in some kind of - # callable object with methods corresponding to the interface that the capability implements. - # - # Keep in mind that `ExportIds` in a `CapDescriptor` are subject to reference counting. See the - # description of `ExportId`. - - union { - none @0 :Void; - # There is no capability here. This `CapDescriptor` should not appear in the payload content. - # A `none` CapDescriptor can be generated when an application inserts a capability into a - # message and then later changes its mind and removes it -- rewriting all of the other - # capability pointers may be hard, so instead a tombstone is left, similar to the way a removed - # struct or list instance is zeroed out of the message but the space is not reclaimed. - # Hopefully this is unusual. - - senderHosted @1 :ExportId; - # A capability newly exported by the sender. This is the ID of the new capability in the - # sender's export table (receiver's import table). - - senderPromise @2 :ExportId; - # A promise that the sender will resolve later. The sender will send exactly one Resolve - # message at a future point in time to replace this promise. Note that even if the same - # `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of - # them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this - # `CapDescriptor`) may choose not to send the `Resolve` at all. - - receiverHosted @3 :ImportId; - # A capability (or promise) previously exported by the receiver (imported by the sender). - - receiverAnswer @4 :PromisedAnswer; - # A capability expected to be returned in the results of a currently-outstanding call posed - # by the sender. - - thirdPartyHosted @5 :ThirdPartyCapDescriptor; - # **(level 3)** - # - # A capability that lives in neither the sender's nor the receiver's vat. The sender needs - # to form a direct connection to a third party to pick up the capability. - # - # Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its - # `vine` instead. - } -} - -struct PromisedAnswer { - # **(mostly level 1)** - # - # Specifies how to derive a promise from an unanswered question, by specifying the path of fields - # to follow from the root of the eventual result struct to get to the desired capability. Used - # to address method calls to a not-yet-returned capability or to pass such a capability as an - # input to some other method call. - # - # Level 0 implementations must support `PromisedAnswer` only for the case where the answer is - # to a `Bootstrap` message. In this case, `path` is always empty since `Bootstrap` always returns - # a raw capability. - - questionId @0 :QuestionId; - # ID of the question (in the sender's question table / receiver's answer table) whose answer is - # expected to contain the capability. - - transform @1 :List(Op); - # Operations / transformations to apply to the result in order to get the capability actually - # being addressed. E.g. if the result is a struct and you want to call a method on a capability - # pointed to by a field of the struct, you need a `getPointerField` op. - - struct Op { - union { - noop @0 :Void; - # Does nothing. This member is mostly defined so that we can make `Op` a union even - # though (as of this writing) only one real operation is defined. - - getPointerField @1 :UInt16; - # Get a pointer field within a struct. The number is an index into the pointer section, NOT - # a field ordinal, so that the receiver does not need to understand the schema. - - # TODO(someday): We could add: - # - For lists, the ability to address every member of the list, or a slice of the list, the - # result of which would be another list. This is useful for implementing the equivalent of - # a SQL table join (not to be confused with the `Join` message type). - # - Maybe some ability to test a union. - # - Probably not a good idea: the ability to specify an arbitrary script to run on the - # result. We could define a little stack-based language where `Op` specifies one - # "instruction" or transformation to apply. Although this is not a good idea - # (over-engineered), any narrower additions to `Op` should be designed as if this - # were the eventual goal. - } - } -} - -struct ThirdPartyCapDescriptor { - # **(level 3)** - # - # Identifies a capability in a third-party vat that the sender wants the receiver to pick up. - - id @0 :ThirdPartyCapId; - # Identifies the third-party host and the specific capability to accept from it. - - vineId @1 :ExportId; - # A proxy for the third-party object exported by the sender. In CapTP terminology this is called - # a "vine", because it is an indirect reference to the third-party object that snakes through the - # sender vat. This serves two purposes: - # - # * Level 1 and 2 implementations that don't understand how to connect to a third party may - # simply send calls to the vine. Such calls will be forwarded to the third-party by the - # sender. - # - # * Level 3 implementations must release the vine once they have successfully picked up the - # object from the third party. This ensures that the capability is not released by the sender - # prematurely. - # - # The sender will close the `Provide` request that it has sent to the third party as soon as - # it receives either a `Call` or a `Release` message directed at the vine. -} - -struct Exception { - # **(level 0)** - # - # Describes an arbitrary error that prevented an operation (e.g. a call) from completing. - # - # Cap'n Proto exceptions always indicate that something went wrong. In other words, in a fantasy - # world where everything always works as expected, no exceptions would ever be thrown. Clients - # should only ever catch exceptions as a means to implement fault-tolerance, where "fault" can - # mean: - # - Bugs. - # - Invalid input. - # - Configuration errors. - # - Network problems. - # - Insufficient resources. - # - Version skew (unimplemented functionality). - # - Other logistical problems. - # - # Exceptions should NOT be used to flag application-specific conditions that a client is expected - # to handle in an application-specific way. Put another way, in the Cap'n Proto world, - # "checked exceptions" (where an interface explicitly defines the exceptions it throws and - # clients are forced by the type system to handle those exceptions) do NOT make sense. - - reason @0 :Text; - # Human-readable failure description. - - type @3 :Type; - # The type of the error. The purpose of this enum is not to describe the error itself, but - # rather to describe how the client might want to respond to the error. - - enum Type { - failed @0; - # A generic problem occurred, and it is believed that if the operation were repeated without - # any change in the state of the world, the problem would occur again. - # - # A client might respond to this error by logging it for investigation by the developer and/or - # displaying it to the user. - - overloaded @1; - # The request was rejected due to a temporary lack of resources. - # - # Examples include: - # - There's not enough CPU time to keep up with incoming requests, so some are rejected. - # - The server ran out of RAM or disk space during the request. - # - The operation timed out (took significantly longer than it should have). - # - # A client might respond to this error by scheduling to retry the operation much later. The - # client should NOT retry again immediately since this would likely exacerbate the problem. - - disconnected @2; - # The method failed because a connection to some necessary capability was lost. - # - # Examples include: - # - The client introduced the server to a third-party capability, the connection to that third - # party was subsequently lost, and then the client requested that the server use the dead - # capability for something. - # - The client previously requested that the server obtain a capability from some third party. - # The server returned a capability to an object wrapping the third-party capability. Later, - # the server's connection to the third party was lost. - # - The capability has been revoked. Revocation does not necessarily mean that the client is - # no longer authorized to use the capability; it is often used simply as a way to force the - # client to repeat the setup process, perhaps to efficiently move them to a new back-end or - # get them to recognize some other change that has occurred. - # - # A client should normally respond to this error by releasing all capabilities it is currently - # holding related to the one it called and then re-creating them by restoring SturdyRefs and/or - # repeating the method calls used to create them originally. In other words, disconnect and - # start over. This should in turn cause the server to obtain a new copy of the capability that - # it lost, thus making everything work. - # - # If the client receives another `disconnencted` error in the process of rebuilding the - # capability and retrying the call, it should treat this as an `overloaded` error: the network - # is currently unreliable, possibly due to load or other temporary issues. - - unimplemented @3; - # The server doesn't implement the requested method. If there is some other method that the - # client could call (perhaps an older and/or slower interface), it should try that instead. - # Otherwise, this should be treated like `failed`. - } - - obsoleteIsCallersFault @1 :Bool; - # OBSOLETE. Ignore. - - obsoleteDurability @2 :UInt16; - # OBSOLETE. See `type` instead. -} - -# ======================================================================================== -# Network-specific Parameters -# -# Some parts of the Cap'n Proto RPC protocol are not specified here because different vat networks -# may wish to use different approaches to solving them. For example, on the public internet, you -# may want to authenticate vats using public-key cryptography, but on a local intranet with trusted -# infrastructure, you may be happy to authenticate based on network address only, or some other -# lightweight mechanism. -# -# To accommodate this, we specify several "parameter" types. Each type is defined here as an -# alias for `AnyPointer`, but a specific network will want to define a specific set of types to use. -# All vats in a vat network must agree on these parameters in order to be able to communicate. -# Inter-network communication can be accomplished through "gateways" that perform translation -# between the primitives used on each network; these gateways may need to be deeply stateful, -# depending on the translations they perform. -# -# For interaction over the global internet between parties with no other prior arrangement, a -# particular set of bindings for these types is defined elsewhere. (TODO(someday): Specify where -# these common definitions live.) -# -# Another common network type is the two-party network, in which one of the parties typically -# interacts with the outside world entirely through the other party. In such a connection between -# Alice and Bob, all objects that exist on Bob's other networks appear to Alice as if they were -# hosted by Bob himself, and similarly all objects on Alice's network (if she even has one) appear -# to Bob as if they were hosted by Alice. This network type is interesting because from the point -# of view of a simple application that communicates with only one other party via the two-party -# protocol, there are no three-party interactions at all, and joins are unusually simple to -# implement, so implementing at level 4 is barely more complicated than implementing at level 1. -# Moreover, if you pair an app implementing the two-party network with a container that implements -# some other network, the app can then participate on the container's network just as if it -# implemented that network directly. The types used by the two-party network are defined in -# `rpc-twoparty.capnp`. -# -# The things that we need to parameterize are: -# - How to store capabilities long-term without holding a connection open (mostly level 2). -# - How to authenticate vats in three-party introductions (level 3). -# - How to implement `Join` (level 4). -# -# Persistent references -# --------------------- -# -# **(mostly level 2)** -# -# We want to allow some capabilities to be stored long-term, even if a connection is lost and later -# recreated. ExportId is a short-term identifier that is specific to a connection, so it doesn't -# help here. We need a way to specify long-term identifiers, as well as a strategy for -# reconnecting to a referenced capability later. -# -# Three-party interactions -# ------------------------ -# -# **(level 3)** -# -# In cases where more than two vats are interacting, we have situations where VatA holds a -# capability hosted by VatB and wants to send that capability to VatC. This can be accomplished -# by VatA proxying requests on the new capability, but doing so has two big problems: -# - It's inefficient, requiring an extra network hop. -# - If VatC receives another capability to the same object from VatD, it is difficult for VatC to -# detect that the two capabilities are really the same and to implement the E "join" operation, -# which is necessary for certain four-or-more-party interactions, such as the escrow pattern. -# See: http://www.erights.org/elib/equality/grant-matcher/index.html -# -# Instead, we want a way for VatC to form a direct, authenticated connection to VatB. -# -# Join -# ---- -# -# **(level 4)** -# -# The `Join` message type and corresponding operation arranges for a direct connection to be formed -# between the joiner and the host of the joined object, and this connection must be authenticated. -# Thus, the details are network-dependent. - -using SturdyRef = AnyPointer; -# **(level 2)** -# -# Identifies a persisted capability that can be restored in the future. How exactly a SturdyRef -# is restored to a live object is specified along with the SturdyRef definition (i.e. not by -# rpc.capnp). -# -# Generally a SturdyRef needs to specify three things: -# - How to reach the vat that can restore the ref (e.g. a hostname or IP address). -# - How to authenticate the vat after connecting (e.g. a public key fingerprint). -# - The identity of a specific object hosted by the vat. Generally, this is an opaque pointer whose -# format is defined by the specific vat -- the client has no need to inspect the object ID. -# It is important that the objec ID be unguessable if the object is not public (and objects -# should almost never be public). -# -# The above are only suggestions. Some networks might work differently. For example, a private -# network might employ a special restorer service whose sole purpose is to restore SturdyRefs. -# In this case, the entire contents of SturdyRef might be opaque, because they are intended only -# to be forwarded to the restorer service. - -using ProvisionId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in an `Accept` message to identify the object being accepted. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the provider vat along with the question ID used in the `Provide` message sent from -# that provider. - -using RecipientId = AnyPointer; -# **(level 3)** -# -# The information that must be sent in a `Provide` message to identify the recipient of the -# capability. -# -# In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the recipient. (CapTP also calls for a nonce to identify the object. In our -# case, the `Provide` message's `questionId` can serve as the nonce.) - -using ThirdPartyCapId = AnyPointer; -# **(level 3)** -# -# The information needed to connect to a third party and accept a capability from it. -# -# In a network where each vat has a public/private key pair, this could be a combination of the -# third party's public key fingerprint, hints on how to connect to the third party (e.g. an IP -# address), and the question ID used in the corresponding `Provide` message sent to that third party -# (used to identify which capability to pick up). - -using JoinKeyPart = AnyPointer; -# **(level 4)** -# -# A piece of a secret key. One piece is sent along each path that is expected to lead to the same -# place. Once the pieces are combined, a direct connection may be formed between the sender and -# the receiver, bypassing any men-in-the-middle along the paths. See the `Join` message type. -# -# The motivation for Joins is discussed under "Supporting Equality" in the "Unibus" protocol -# sketch: http://www.erights.org/elib/distrib/captp/unibus.html -# -# In a network where each vat has a public/private key pair and each vat forms no more than one -# connection to each other vat, Joins will rarely -- perhaps never -- be needed, as objects never -# need to be transparently proxied and references to the same object sent over the same connection -# have the same export ID. Thus, a successful join requires only checking that the two objects -# come from the same connection and have the same ID, and then completes immediately. -# -# However, in networks where two vats may form more than one connection between each other, or -# where proxying of objects occurs, joins are necessary. -# -# Typically, each JoinKeyPart would include a fixed-length data value such that all value parts -# XOR'd together forms a shared secret that can be used to form an encrypted connection between -# the joiner and the joined object's host. Each JoinKeyPart should also include an indication of -# how many parts to expect and a hash of the shared secret (used to match up parts). - -using JoinResult = AnyPointer; -# **(level 4)** -# -# Information returned as the result to a `Join` message, needed by the joiner in order to form a -# direct connection to a joined object. This might simply be the address of the joined object's -# host vat, since the `JoinKey` has already been communicated so the two vats already have a shared -# secret to use to authenticate each other. -# -# The `JoinResult` should also contain information that can be used to detect when the Join -# requests ended up reaching different objects, so that this situation can be detected easily. -# This could be a simple matter of including a sequence number -- if the joiner receives two -# `JoinResult`s with sequence number 0, then they must have come from different objects and the -# whole join is a failure. - -# ======================================================================================== -# Network interface sketch -# -# The interfaces below are meant to be pseudo-code to illustrate how the details of a particular -# vat network might be abstracted away. They are written like Cap'n Proto interfaces, but in -# practice you'd probably define these interfaces manually in the target programming language. A -# Cap'n Proto RPC implementation should be able to use these interfaces without knowing the -# definitions of the various network-specific parameters defined above. - -# interface VatNetwork { -# # Represents a vat network, with the ability to connect to particular vats and receive -# # connections from vats. -# # -# # Note that methods returning a `Connection` may return a pre-existing `Connection`, and the -# # caller is expected to find and share state with existing users of the connection. -# -# # Level 0 features ----------------------------------------------- -# -# connect(vatId :VatId) :Connection; -# # Connect to the given vat. The transport should return a promise that does not -# # resolve until authentication has completed, but allows messages to be pipelined in before -# # that; the transport either queues these messages until authenticated, or sends them encrypted -# # such that only the authentic vat would be able to decrypt them. The latter approach avoids a -# # round trip for authentication. -# -# accept() :Connection; -# # Wait for the next incoming connection and return it. Only connections formed by -# # connect() are returned by this method. -# -# # Level 4 features ----------------------------------------------- -# -# newJoiner(count :UInt32) :NewJoinerResponse; -# # Prepare a new Join operation, which will eventually lead to forming a new direct connection -# # to the host of the joined capability. `count` is the number of capabilities to join. -# -# struct NewJoinerResponse { -# joinKeyParts :List(JoinKeyPart); -# # Key parts to send in Join messages to each capability. -# -# joiner :Joiner; -# # Used to establish the final connection. -# } -# -# interface Joiner { -# addJoinResult(result :JoinResult) :Void; -# # Add a JoinResult received in response to one of the `Join` messages. All `JoinResult`s -# # returned from all paths must be added before trying to connect. -# -# connect() :ConnectionAndProvisionId; -# # Try to form a connection to the joined capability's host, verifying that it has received -# # all of the JoinKeyParts. Once the connection is formed, the caller should send an `Accept` -# # message on it with the specified `ProvisionId` in order to receive the final capability. -# } -# -# acceptConnectionFromJoiner(parts :List(JoinKeyPart), paths :List(VatPath)) -# :ConnectionAndProvisionId; -# # Called on a joined capability's host to receive the connection from the joiner, once all -# # key parts have arrived. The caller should expect to receive an `Accept` message over the -# # connection with the given ProvisionId. -# } -# -# interface Connection { -# # Level 0 features ----------------------------------------------- -# -# send(message :Message) :Void; -# # Send the message. Returns successfully when the message (and all preceding messages) has -# # been acknowledged by the recipient. -# -# receive() :Message; -# # Receive the next message, and acknowledges receipt to the sender. Messages are received in -# # the order in which they are sent. -# -# # Level 3 features ----------------------------------------------- -# -# introduceTo(recipient :Connection) :IntroductionInfo; -# # Call before starting a three-way introduction, assuming a `Provide` message is to be sent on -# # this connection and a `ThirdPartyCapId` is to be sent to `recipient`. -# -# struct IntroductionInfo { -# sendToRecipient :ThirdPartyCapId; -# sendToTarget :RecipientId; -# } -# -# connectToIntroduced(capId :ThirdPartyCapId) :ConnectionAndProvisionId; -# # Given a ThirdPartyCapId received over this connection, connect to the third party. The -# # caller should then send an `Accept` message over the new connection. -# -# acceptIntroducedConnection(recipientId :RecipientId) :Connection; -# # Given a RecipientId received in a `Provide` message on this `Connection`, wait for the -# # recipient to connect, and return the connection formed. Usually, the first message received -# # on the new connection will be an `Accept` message. -# } -# -# struct ConnectionAndProvisionId { -# # **(level 3)** -# -# connection :Connection; -# # Connection on which to issue `Accept` message. -# -# provision :ProvisionId; -# # `ProvisionId` to send in the `Accept` message. -# } diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp.h deleted file mode 100644 index 0a440397fc..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc.capnp.h +++ /dev/null @@ -1,4898 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: rpc.capnp - -#ifndef CAPNP_INCLUDED_b312981b2552a250_ -#define CAPNP_INCLUDED_b312981b2552a250_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(91b79f1f808db032); -CAPNP_DECLARE_SCHEMA(e94ccf8031176ec4); -CAPNP_DECLARE_SCHEMA(836a53ce789d4cd4); -CAPNP_DECLARE_SCHEMA(dae8b0f61aab5f99); -CAPNP_DECLARE_SCHEMA(9e19b28d3db3573a); -CAPNP_DECLARE_SCHEMA(d37d2eb2c2f80e63); -CAPNP_DECLARE_SCHEMA(bbc29655fa89086e); -CAPNP_DECLARE_SCHEMA(ad1a6c0d7dd07497); -CAPNP_DECLARE_SCHEMA(f964368b0fbd3711); -CAPNP_DECLARE_SCHEMA(d562b4df655bdd4d); -CAPNP_DECLARE_SCHEMA(9c6a046bfbc1ac5a); -CAPNP_DECLARE_SCHEMA(d4c9b56290554016); -CAPNP_DECLARE_SCHEMA(fbe1980490e001af); -CAPNP_DECLARE_SCHEMA(95bc14545813fbc1); -CAPNP_DECLARE_SCHEMA(9a0e61223d96743b); -CAPNP_DECLARE_SCHEMA(8523ddc40b86b8b0); -CAPNP_DECLARE_SCHEMA(d800b1d6cd6f1ca0); -CAPNP_DECLARE_SCHEMA(f316944415569081); -CAPNP_DECLARE_SCHEMA(d37007fde1f0027d); -CAPNP_DECLARE_SCHEMA(d625b7063acf691a); -CAPNP_DECLARE_SCHEMA(b28c96e23f4cbd58); -enum class Type_b28c96e23f4cbd58: uint16_t { - FAILED, - OVERLOADED, - DISCONNECTED, - UNIMPLEMENTED, -}; -CAPNP_DECLARE_ENUM(Type, b28c96e23f4cbd58); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace rpc { - -struct Message { - Message() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNIMPLEMENTED, - ABORT, - CALL, - RETURN, - FINISH, - RESOLVE, - RELEASE, - OBSOLETE_SAVE, - BOOTSTRAP, - OBSOLETE_DELETE, - PROVIDE, - ACCEPT, - JOIN, - DISEMBARGO, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(91b79f1f808db032, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Bootstrap { - Bootstrap() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e94ccf8031176ec4, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call { - Call() = delete; - - class Reader; - class Builder; - class Pipeline; - struct SendResultsTo; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(836a53ce789d4cd4, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Call::SendResultsTo { - SendResultsTo() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CALLER, - YOURSELF, - THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(dae8b0f61aab5f99, 3, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Return { - Return() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - RESULTS, - EXCEPTION, - CANCELED, - RESULTS_SENT_ELSEWHERE, - TAKE_FROM_OTHER_QUESTION, - ACCEPT_FROM_THIRD_PARTY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e19b28d3db3573a, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Finish { - Finish() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37d2eb2c2f80e63, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Resolve { - Resolve() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - CAP, - EXCEPTION, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bbc29655fa89086e, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Release { - Release() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ad1a6c0d7dd07497, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo { - Disembargo() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Context; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f964368b0fbd3711, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Disembargo::Context { - Context() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SENDER_LOOPBACK, - RECEIVER_LOOPBACK, - ACCEPT, - PROVIDE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d562b4df655bdd4d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Provide { - Provide() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9c6a046bfbc1ac5a, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Accept { - Accept() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d4c9b56290554016, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Join { - Join() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(fbe1980490e001af, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct MessageTarget { - MessageTarget() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPORTED_CAP, - PROMISED_ANSWER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(95bc14545813fbc1, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Payload { - Payload() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9a0e61223d96743b, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CapDescriptor { - CapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NONE, - SENDER_HOSTED, - SENDER_PROMISE, - RECEIVER_HOSTED, - RECEIVER_ANSWER, - THIRD_PARTY_HOSTED, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8523ddc40b86b8b0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer { - PromisedAnswer() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Op; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d800b1d6cd6f1ca0, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct PromisedAnswer::Op { - Op() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - NOOP, - GET_POINTER_FIELD, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f316944415569081, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct ThirdPartyCapDescriptor { - ThirdPartyCapDescriptor() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d37007fde1f0027d, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Exception { - Exception() = delete; - - class Reader; - class Builder; - class Pipeline; - typedef ::capnp::schemas::Type_b28c96e23f4cbd58 Type; - - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d625b7063acf691a, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Message::Reader { -public: - typedef Message Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnimplemented() const; - inline bool hasUnimplemented() const; - inline ::capnp::rpc::Message::Reader getUnimplemented() const; - - inline bool isAbort() const; - inline bool hasAbort() const; - inline ::capnp::rpc::Exception::Reader getAbort() const; - - inline bool isCall() const; - inline bool hasCall() const; - inline ::capnp::rpc::Call::Reader getCall() const; - - inline bool isReturn() const; - inline bool hasReturn() const; - inline ::capnp::rpc::Return::Reader getReturn() const; - - inline bool isFinish() const; - inline bool hasFinish() const; - inline ::capnp::rpc::Finish::Reader getFinish() const; - - inline bool isResolve() const; - inline bool hasResolve() const; - inline ::capnp::rpc::Resolve::Reader getResolve() const; - - inline bool isRelease() const; - inline bool hasRelease() const; - inline ::capnp::rpc::Release::Reader getRelease() const; - - inline bool isObsoleteSave() const; - inline bool hasObsoleteSave() const; - inline ::capnp::AnyPointer::Reader getObsoleteSave() const; - - inline bool isBootstrap() const; - inline bool hasBootstrap() const; - inline ::capnp::rpc::Bootstrap::Reader getBootstrap() const; - - inline bool isObsoleteDelete() const; - inline bool hasObsoleteDelete() const; - inline ::capnp::AnyPointer::Reader getObsoleteDelete() const; - - inline bool isProvide() const; - inline bool hasProvide() const; - inline ::capnp::rpc::Provide::Reader getProvide() const; - - inline bool isAccept() const; - inline bool hasAccept() const; - inline ::capnp::rpc::Accept::Reader getAccept() const; - - inline bool isJoin() const; - inline bool hasJoin() const; - inline ::capnp::rpc::Join::Reader getJoin() const; - - inline bool isDisembargo() const; - inline bool hasDisembargo() const; - inline ::capnp::rpc::Disembargo::Reader getDisembargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Message::Builder { -public: - typedef Message Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnimplemented(); - inline bool hasUnimplemented(); - inline ::capnp::rpc::Message::Builder getUnimplemented(); - inline void setUnimplemented( ::capnp::rpc::Message::Reader value); - inline ::capnp::rpc::Message::Builder initUnimplemented(); - inline void adoptUnimplemented(::capnp::Orphan< ::capnp::rpc::Message>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Message> disownUnimplemented(); - - inline bool isAbort(); - inline bool hasAbort(); - inline ::capnp::rpc::Exception::Builder getAbort(); - inline void setAbort( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initAbort(); - inline void adoptAbort(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownAbort(); - - inline bool isCall(); - inline bool hasCall(); - inline ::capnp::rpc::Call::Builder getCall(); - inline void setCall( ::capnp::rpc::Call::Reader value); - inline ::capnp::rpc::Call::Builder initCall(); - inline void adoptCall(::capnp::Orphan< ::capnp::rpc::Call>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Call> disownCall(); - - inline bool isReturn(); - inline bool hasReturn(); - inline ::capnp::rpc::Return::Builder getReturn(); - inline void setReturn( ::capnp::rpc::Return::Reader value); - inline ::capnp::rpc::Return::Builder initReturn(); - inline void adoptReturn(::capnp::Orphan< ::capnp::rpc::Return>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Return> disownReturn(); - - inline bool isFinish(); - inline bool hasFinish(); - inline ::capnp::rpc::Finish::Builder getFinish(); - inline void setFinish( ::capnp::rpc::Finish::Reader value); - inline ::capnp::rpc::Finish::Builder initFinish(); - inline void adoptFinish(::capnp::Orphan< ::capnp::rpc::Finish>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Finish> disownFinish(); - - inline bool isResolve(); - inline bool hasResolve(); - inline ::capnp::rpc::Resolve::Builder getResolve(); - inline void setResolve( ::capnp::rpc::Resolve::Reader value); - inline ::capnp::rpc::Resolve::Builder initResolve(); - inline void adoptResolve(::capnp::Orphan< ::capnp::rpc::Resolve>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Resolve> disownResolve(); - - inline bool isRelease(); - inline bool hasRelease(); - inline ::capnp::rpc::Release::Builder getRelease(); - inline void setRelease( ::capnp::rpc::Release::Reader value); - inline ::capnp::rpc::Release::Builder initRelease(); - inline void adoptRelease(::capnp::Orphan< ::capnp::rpc::Release>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Release> disownRelease(); - - inline bool isObsoleteSave(); - inline bool hasObsoleteSave(); - inline ::capnp::AnyPointer::Builder getObsoleteSave(); - inline ::capnp::AnyPointer::Builder initObsoleteSave(); - - inline bool isBootstrap(); - inline bool hasBootstrap(); - inline ::capnp::rpc::Bootstrap::Builder getBootstrap(); - inline void setBootstrap( ::capnp::rpc::Bootstrap::Reader value); - inline ::capnp::rpc::Bootstrap::Builder initBootstrap(); - inline void adoptBootstrap(::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> disownBootstrap(); - - inline bool isObsoleteDelete(); - inline bool hasObsoleteDelete(); - inline ::capnp::AnyPointer::Builder getObsoleteDelete(); - inline ::capnp::AnyPointer::Builder initObsoleteDelete(); - - inline bool isProvide(); - inline bool hasProvide(); - inline ::capnp::rpc::Provide::Builder getProvide(); - inline void setProvide( ::capnp::rpc::Provide::Reader value); - inline ::capnp::rpc::Provide::Builder initProvide(); - inline void adoptProvide(::capnp::Orphan< ::capnp::rpc::Provide>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Provide> disownProvide(); - - inline bool isAccept(); - inline bool hasAccept(); - inline ::capnp::rpc::Accept::Builder getAccept(); - inline void setAccept( ::capnp::rpc::Accept::Reader value); - inline ::capnp::rpc::Accept::Builder initAccept(); - inline void adoptAccept(::capnp::Orphan< ::capnp::rpc::Accept>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Accept> disownAccept(); - - inline bool isJoin(); - inline bool hasJoin(); - inline ::capnp::rpc::Join::Builder getJoin(); - inline void setJoin( ::capnp::rpc::Join::Reader value); - inline ::capnp::rpc::Join::Builder initJoin(); - inline void adoptJoin(::capnp::Orphan< ::capnp::rpc::Join>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Join> disownJoin(); - - inline bool isDisembargo(); - inline bool hasDisembargo(); - inline ::capnp::rpc::Disembargo::Builder getDisembargo(); - inline void setDisembargo( ::capnp::rpc::Disembargo::Reader value); - inline ::capnp::rpc::Disembargo::Builder initDisembargo(); - inline void adoptDisembargo(::capnp::Orphan< ::capnp::rpc::Disembargo>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Disembargo> disownDisembargo(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Message::Pipeline { -public: - typedef Message Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Bootstrap::Reader { -public: - typedef Bootstrap Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasDeprecatedObjectId() const; - inline ::capnp::AnyPointer::Reader getDeprecatedObjectId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Bootstrap::Builder { -public: - typedef Bootstrap Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder getDeprecatedObjectId(); - inline ::capnp::AnyPointer::Builder initDeprecatedObjectId(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Bootstrap::Pipeline { -public: - typedef Bootstrap Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::Reader { -public: - typedef Call Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline ::uint64_t getInterfaceId() const; - - inline ::uint16_t getMethodId() const; - - inline bool hasParams() const; - inline ::capnp::rpc::Payload::Reader getParams() const; - - inline typename SendResultsTo::Reader getSendResultsTo() const; - - inline bool getAllowThirdPartyTailCall() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::Builder { -public: - typedef Call Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline ::uint64_t getInterfaceId(); - inline void setInterfaceId( ::uint64_t value); - - inline ::uint16_t getMethodId(); - inline void setMethodId( ::uint16_t value); - - inline bool hasParams(); - inline ::capnp::rpc::Payload::Builder getParams(); - inline void setParams( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initParams(); - inline void adoptParams(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownParams(); - - inline typename SendResultsTo::Builder getSendResultsTo(); - inline typename SendResultsTo::Builder initSendResultsTo(); - - inline bool getAllowThirdPartyTailCall(); - inline void setAllowThirdPartyTailCall(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::Pipeline { -public: - typedef Call Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline ::capnp::rpc::Payload::Pipeline getParams(); - inline typename SendResultsTo::Pipeline getSendResultsTo(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Call::SendResultsTo::Reader { -public: - typedef SendResultsTo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isCaller() const; - inline ::capnp::Void getCaller() const; - - inline bool isYourself() const; - inline ::capnp::Void getYourself() const; - - inline bool isThirdParty() const; - inline bool hasThirdParty() const; - inline ::capnp::AnyPointer::Reader getThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Call::SendResultsTo::Builder { -public: - typedef SendResultsTo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isCaller(); - inline ::capnp::Void getCaller(); - inline void setCaller( ::capnp::Void value = ::capnp::VOID); - - inline bool isYourself(); - inline ::capnp::Void getYourself(); - inline void setYourself( ::capnp::Void value = ::capnp::VOID); - - inline bool isThirdParty(); - inline bool hasThirdParty(); - inline ::capnp::AnyPointer::Builder getThirdParty(); - inline ::capnp::AnyPointer::Builder initThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Call::SendResultsTo::Pipeline { -public: - typedef SendResultsTo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Return::Reader { -public: - typedef Return Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getAnswerId() const; - - inline bool getReleaseParamCaps() const; - - inline bool isResults() const; - inline bool hasResults() const; - inline ::capnp::rpc::Payload::Reader getResults() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - - inline bool isCanceled() const; - inline ::capnp::Void getCanceled() const; - - inline bool isResultsSentElsewhere() const; - inline ::capnp::Void getResultsSentElsewhere() const; - - inline bool isTakeFromOtherQuestion() const; - inline ::uint32_t getTakeFromOtherQuestion() const; - - inline bool isAcceptFromThirdParty() const; - inline bool hasAcceptFromThirdParty() const; - inline ::capnp::AnyPointer::Reader getAcceptFromThirdParty() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Return::Builder { -public: - typedef Return Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getAnswerId(); - inline void setAnswerId( ::uint32_t value); - - inline bool getReleaseParamCaps(); - inline void setReleaseParamCaps(bool value); - - inline bool isResults(); - inline bool hasResults(); - inline ::capnp::rpc::Payload::Builder getResults(); - inline void setResults( ::capnp::rpc::Payload::Reader value); - inline ::capnp::rpc::Payload::Builder initResults(); - inline void adoptResults(::capnp::Orphan< ::capnp::rpc::Payload>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Payload> disownResults(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - - inline bool isCanceled(); - inline ::capnp::Void getCanceled(); - inline void setCanceled( ::capnp::Void value = ::capnp::VOID); - - inline bool isResultsSentElsewhere(); - inline ::capnp::Void getResultsSentElsewhere(); - inline void setResultsSentElsewhere( ::capnp::Void value = ::capnp::VOID); - - inline bool isTakeFromOtherQuestion(); - inline ::uint32_t getTakeFromOtherQuestion(); - inline void setTakeFromOtherQuestion( ::uint32_t value); - - inline bool isAcceptFromThirdParty(); - inline bool hasAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder getAcceptFromThirdParty(); - inline ::capnp::AnyPointer::Builder initAcceptFromThirdParty(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Return::Pipeline { -public: - typedef Return Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Finish::Reader { -public: - typedef Finish Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool getReleaseResultCaps() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Finish::Builder { -public: - typedef Finish Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool getReleaseResultCaps(); - inline void setReleaseResultCaps(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Finish::Pipeline { -public: - typedef Finish Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Resolve::Reader { -public: - typedef Resolve Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint32_t getPromiseId() const; - - inline bool isCap() const; - inline bool hasCap() const; - inline ::capnp::rpc::CapDescriptor::Reader getCap() const; - - inline bool isException() const; - inline bool hasException() const; - inline ::capnp::rpc::Exception::Reader getException() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Resolve::Builder { -public: - typedef Resolve Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint32_t getPromiseId(); - inline void setPromiseId( ::uint32_t value); - - inline bool isCap(); - inline bool hasCap(); - inline ::capnp::rpc::CapDescriptor::Builder getCap(); - inline void setCap( ::capnp::rpc::CapDescriptor::Reader value); - inline ::capnp::rpc::CapDescriptor::Builder initCap(); - inline void adoptCap(::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> disownCap(); - - inline bool isException(); - inline bool hasException(); - inline ::capnp::rpc::Exception::Builder getException(); - inline void setException( ::capnp::rpc::Exception::Reader value); - inline ::capnp::rpc::Exception::Builder initException(); - inline void adoptException(::capnp::Orphan< ::capnp::rpc::Exception>&& value); - inline ::capnp::Orphan< ::capnp::rpc::Exception> disownException(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Resolve::Pipeline { -public: - typedef Resolve Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Release::Reader { -public: - typedef Release Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getId() const; - - inline ::uint32_t getReferenceCount() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Release::Builder { -public: - typedef Release Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getId(); - inline void setId( ::uint32_t value); - - inline ::uint32_t getReferenceCount(); - inline void setReferenceCount( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Release::Pipeline { -public: - typedef Release Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Reader { -public: - typedef Disembargo Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline typename Context::Reader getContext() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Builder { -public: - typedef Disembargo Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline typename Context::Builder getContext(); - inline typename Context::Builder initContext(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Pipeline { -public: - typedef Disembargo Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); - inline typename Context::Pipeline getContext(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Disembargo::Context::Reader { -public: - typedef Context Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isSenderLoopback() const; - inline ::uint32_t getSenderLoopback() const; - - inline bool isReceiverLoopback() const; - inline ::uint32_t getReceiverLoopback() const; - - inline bool isAccept() const; - inline ::capnp::Void getAccept() const; - - inline bool isProvide() const; - inline ::uint32_t getProvide() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Disembargo::Context::Builder { -public: - typedef Context Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isSenderLoopback(); - inline ::uint32_t getSenderLoopback(); - inline void setSenderLoopback( ::uint32_t value); - - inline bool isReceiverLoopback(); - inline ::uint32_t getReceiverLoopback(); - inline void setReceiverLoopback( ::uint32_t value); - - inline bool isAccept(); - inline ::capnp::Void getAccept(); - inline void setAccept( ::capnp::Void value = ::capnp::VOID); - - inline bool isProvide(); - inline ::uint32_t getProvide(); - inline void setProvide( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Disembargo::Context::Pipeline { -public: - typedef Context Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Provide::Reader { -public: - typedef Provide Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasRecipient() const; - inline ::capnp::AnyPointer::Reader getRecipient() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Provide::Builder { -public: - typedef Provide Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasRecipient(); - inline ::capnp::AnyPointer::Builder getRecipient(); - inline ::capnp::AnyPointer::Builder initRecipient(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Provide::Pipeline { -public: - typedef Provide Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Accept::Reader { -public: - typedef Accept Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasProvision() const; - inline ::capnp::AnyPointer::Reader getProvision() const; - - inline bool getEmbargo() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Accept::Builder { -public: - typedef Accept Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasProvision(); - inline ::capnp::AnyPointer::Builder getProvision(); - inline ::capnp::AnyPointer::Builder initProvision(); - - inline bool getEmbargo(); - inline void setEmbargo(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Accept::Pipeline { -public: - typedef Accept Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Join::Reader { -public: - typedef Join Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTarget() const; - inline ::capnp::rpc::MessageTarget::Reader getTarget() const; - - inline bool hasKeyPart() const; - inline ::capnp::AnyPointer::Reader getKeyPart() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Join::Builder { -public: - typedef Join Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTarget(); - inline ::capnp::rpc::MessageTarget::Builder getTarget(); - inline void setTarget( ::capnp::rpc::MessageTarget::Reader value); - inline ::capnp::rpc::MessageTarget::Builder initTarget(); - inline void adoptTarget(::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value); - inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> disownTarget(); - - inline bool hasKeyPart(); - inline ::capnp::AnyPointer::Builder getKeyPart(); - inline ::capnp::AnyPointer::Builder initKeyPart(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Join::Pipeline { -public: - typedef Join Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::rpc::MessageTarget::Pipeline getTarget(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class MessageTarget::Reader { -public: - typedef MessageTarget Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImportedCap() const; - inline ::uint32_t getImportedCap() const; - - inline bool isPromisedAnswer() const; - inline bool hasPromisedAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getPromisedAnswer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class MessageTarget::Builder { -public: - typedef MessageTarget Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImportedCap(); - inline ::uint32_t getImportedCap(); - inline void setImportedCap( ::uint32_t value); - - inline bool isPromisedAnswer(); - inline bool hasPromisedAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getPromisedAnswer(); - inline void setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initPromisedAnswer(); - inline void adoptPromisedAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownPromisedAnswer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class MessageTarget::Pipeline { -public: - typedef MessageTarget Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Payload::Reader { -public: - typedef Payload Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasContent() const; - inline ::capnp::AnyPointer::Reader getContent() const; - - inline bool hasCapTable() const; - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader getCapTable() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Payload::Builder { -public: - typedef Payload Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasContent(); - inline ::capnp::AnyPointer::Builder getContent(); - inline ::capnp::AnyPointer::Builder initContent(); - - inline bool hasCapTable(); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder getCapTable(); - inline void setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value); - inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder initCapTable(unsigned int size); - inline void adoptCapTable(::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> disownCapTable(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Payload::Pipeline { -public: - typedef Payload Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapDescriptor::Reader { -public: - typedef CapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNone() const; - inline ::capnp::Void getNone() const; - - inline bool isSenderHosted() const; - inline ::uint32_t getSenderHosted() const; - - inline bool isSenderPromise() const; - inline ::uint32_t getSenderPromise() const; - - inline bool isReceiverHosted() const; - inline ::uint32_t getReceiverHosted() const; - - inline bool isReceiverAnswer() const; - inline bool hasReceiverAnswer() const; - inline ::capnp::rpc::PromisedAnswer::Reader getReceiverAnswer() const; - - inline bool isThirdPartyHosted() const; - inline bool hasThirdPartyHosted() const; - inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader getThirdPartyHosted() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapDescriptor::Builder { -public: - typedef CapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNone(); - inline ::capnp::Void getNone(); - inline void setNone( ::capnp::Void value = ::capnp::VOID); - - inline bool isSenderHosted(); - inline ::uint32_t getSenderHosted(); - inline void setSenderHosted( ::uint32_t value); - - inline bool isSenderPromise(); - inline ::uint32_t getSenderPromise(); - inline void setSenderPromise( ::uint32_t value); - - inline bool isReceiverHosted(); - inline ::uint32_t getReceiverHosted(); - inline void setReceiverHosted( ::uint32_t value); - - inline bool isReceiverAnswer(); - inline bool hasReceiverAnswer(); - inline ::capnp::rpc::PromisedAnswer::Builder getReceiverAnswer(); - inline void setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value); - inline ::capnp::rpc::PromisedAnswer::Builder initReceiverAnswer(); - inline void adoptReceiverAnswer(::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value); - inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> disownReceiverAnswer(); - - inline bool isThirdPartyHosted(); - inline bool hasThirdPartyHosted(); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder getThirdPartyHosted(); - inline void setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value); - inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder initThirdPartyHosted(); - inline void adoptThirdPartyHosted(::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value); - inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> disownThirdPartyHosted(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapDescriptor::Pipeline { -public: - typedef CapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Reader { -public: - typedef PromisedAnswer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId() const; - - inline bool hasTransform() const; - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader getTransform() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Builder { -public: - typedef PromisedAnswer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getQuestionId(); - inline void setQuestionId( ::uint32_t value); - - inline bool hasTransform(); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder getTransform(); - inline void setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value); - inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder initTransform(unsigned int size); - inline void adoptTransform(::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> disownTransform(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Pipeline { -public: - typedef PromisedAnswer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class PromisedAnswer::Op::Reader { -public: - typedef Op Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isNoop() const; - inline ::capnp::Void getNoop() const; - - inline bool isGetPointerField() const; - inline ::uint16_t getGetPointerField() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class PromisedAnswer::Op::Builder { -public: - typedef Op Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isNoop(); - inline ::capnp::Void getNoop(); - inline void setNoop( ::capnp::Void value = ::capnp::VOID); - - inline bool isGetPointerField(); - inline ::uint16_t getGetPointerField(); - inline void setGetPointerField( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class PromisedAnswer::Op::Pipeline { -public: - typedef Op Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class ThirdPartyCapDescriptor::Reader { -public: - typedef ThirdPartyCapDescriptor Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasId() const; - inline ::capnp::AnyPointer::Reader getId() const; - - inline ::uint32_t getVineId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class ThirdPartyCapDescriptor::Builder { -public: - typedef ThirdPartyCapDescriptor Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasId(); - inline ::capnp::AnyPointer::Builder getId(); - inline ::capnp::AnyPointer::Builder initId(); - - inline ::uint32_t getVineId(); - inline void setVineId( ::uint32_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class ThirdPartyCapDescriptor::Pipeline { -public: - typedef ThirdPartyCapDescriptor Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Exception::Reader { -public: - typedef Exception Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasReason() const; - inline ::capnp::Text::Reader getReason() const; - - inline bool getObsoleteIsCallersFault() const; - - inline ::uint16_t getObsoleteDurability() const; - - inline ::capnp::rpc::Exception::Type getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Exception::Builder { -public: - typedef Exception Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasReason(); - inline ::capnp::Text::Builder getReason(); - inline void setReason( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initReason(unsigned int size); - inline void adoptReason(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownReason(); - - inline bool getObsoleteIsCallersFault(); - inline void setObsoleteIsCallersFault(bool value); - - inline ::uint16_t getObsoleteDurability(); - inline void setObsoleteDurability( ::uint16_t value); - - inline ::capnp::rpc::Exception::Type getType(); - inline void setType( ::capnp::rpc::Exception::Type value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Exception::Pipeline { -public: - typedef Exception Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::rpc::Message::Which Message::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Message::Which Message::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Message::Reader::isUnimplemented() const { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Builder::isUnimplemented() { - return which() == Message::UNIMPLEMENTED; -} -inline bool Message::Reader::hasUnimplemented() const { - if (which() != Message::UNIMPLEMENTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasUnimplemented() { - if (which() != Message::UNIMPLEMENTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Message::Reader Message::Reader::getUnimplemented() const { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Message::Builder Message::Builder::getUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setUnimplemented( ::capnp::rpc::Message::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Message::Builder Message::Builder::initUnimplemented() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptUnimplemented( - ::capnp::Orphan< ::capnp::rpc::Message>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::UNIMPLEMENTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Message> Message::Builder::disownUnimplemented() { - KJ_IREQUIRE((which() == Message::UNIMPLEMENTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Message>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAbort() const { - return which() == Message::ABORT; -} -inline bool Message::Builder::isAbort() { - return which() == Message::ABORT; -} -inline bool Message::Reader::hasAbort() const { - if (which() != Message::ABORT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAbort() { - if (which() != Message::ABORT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Message::Reader::getAbort() const { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::getAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAbort( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Message::Builder::initAbort() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAbort( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ABORT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Message::Builder::disownAbort() { - KJ_IREQUIRE((which() == Message::ABORT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isCall() const { - return which() == Message::CALL; -} -inline bool Message::Builder::isCall() { - return which() == Message::CALL; -} -inline bool Message::Reader::hasCall() const { - if (which() != Message::CALL) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasCall() { - if (which() != Message::CALL) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Call::Reader Message::Reader::getCall() const { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Call::Builder Message::Builder::getCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setCall( ::capnp::rpc::Call::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Call::Builder Message::Builder::initCall() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptCall( - ::capnp::Orphan< ::capnp::rpc::Call>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::CALL); - ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Call> Message::Builder::disownCall() { - KJ_IREQUIRE((which() == Message::CALL), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Call>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isReturn() const { - return which() == Message::RETURN; -} -inline bool Message::Builder::isReturn() { - return which() == Message::RETURN; -} -inline bool Message::Reader::hasReturn() const { - if (which() != Message::RETURN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasReturn() { - if (which() != Message::RETURN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Return::Reader Message::Reader::getReturn() const { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Return::Builder Message::Builder::getReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setReturn( ::capnp::rpc::Return::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Return::Builder Message::Builder::initReturn() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptReturn( - ::capnp::Orphan< ::capnp::rpc::Return>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RETURN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Return> Message::Builder::disownReturn() { - KJ_IREQUIRE((which() == Message::RETURN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Return>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isFinish() const { - return which() == Message::FINISH; -} -inline bool Message::Builder::isFinish() { - return which() == Message::FINISH; -} -inline bool Message::Reader::hasFinish() const { - if (which() != Message::FINISH) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasFinish() { - if (which() != Message::FINISH) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Finish::Reader Message::Reader::getFinish() const { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::getFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setFinish( ::capnp::rpc::Finish::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Finish::Builder Message::Builder::initFinish() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptFinish( - ::capnp::Orphan< ::capnp::rpc::Finish>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::FINISH); - ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Finish> Message::Builder::disownFinish() { - KJ_IREQUIRE((which() == Message::FINISH), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Finish>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isResolve() const { - return which() == Message::RESOLVE; -} -inline bool Message::Builder::isResolve() { - return which() == Message::RESOLVE; -} -inline bool Message::Reader::hasResolve() const { - if (which() != Message::RESOLVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasResolve() { - if (which() != Message::RESOLVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Resolve::Reader Message::Reader::getResolve() const { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::getResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setResolve( ::capnp::rpc::Resolve::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Resolve::Builder Message::Builder::initResolve() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptResolve( - ::capnp::Orphan< ::capnp::rpc::Resolve>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RESOLVE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Resolve> Message::Builder::disownResolve() { - KJ_IREQUIRE((which() == Message::RESOLVE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Resolve>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isRelease() const { - return which() == Message::RELEASE; -} -inline bool Message::Builder::isRelease() { - return which() == Message::RELEASE; -} -inline bool Message::Reader::hasRelease() const { - if (which() != Message::RELEASE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasRelease() { - if (which() != Message::RELEASE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Release::Reader Message::Reader::getRelease() const { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Release::Builder Message::Builder::getRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setRelease( ::capnp::rpc::Release::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Release::Builder Message::Builder::initRelease() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptRelease( - ::capnp::Orphan< ::capnp::rpc::Release>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::RELEASE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Release> Message::Builder::disownRelease() { - KJ_IREQUIRE((which() == Message::RELEASE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Release>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteSave() const { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Builder::isObsoleteSave() { - return which() == Message::OBSOLETE_SAVE; -} -inline bool Message::Reader::hasObsoleteSave() const { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteSave() { - if (which() != Message::OBSOLETE_SAVE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteSave() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteSave() { - KJ_IREQUIRE((which() == Message::OBSOLETE_SAVE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteSave() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_SAVE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isBootstrap() const { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Builder::isBootstrap() { - return which() == Message::BOOTSTRAP; -} -inline bool Message::Reader::hasBootstrap() const { - if (which() != Message::BOOTSTRAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasBootstrap() { - if (which() != Message::BOOTSTRAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Bootstrap::Reader Message::Reader::getBootstrap() const { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::getBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setBootstrap( ::capnp::rpc::Bootstrap::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Bootstrap::Builder Message::Builder::initBootstrap() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptBootstrap( - ::capnp::Orphan< ::capnp::rpc::Bootstrap>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::BOOTSTRAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Bootstrap> Message::Builder::disownBootstrap() { - KJ_IREQUIRE((which() == Message::BOOTSTRAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Bootstrap>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isObsoleteDelete() const { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Builder::isObsoleteDelete() { - return which() == Message::OBSOLETE_DELETE; -} -inline bool Message::Reader::hasObsoleteDelete() const { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasObsoleteDelete() { - if (which() != Message::OBSOLETE_DELETE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Message::Reader::getObsoleteDelete() const { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::getObsoleteDelete() { - KJ_IREQUIRE((which() == Message::OBSOLETE_DELETE), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Message::Builder::initObsoleteDelete() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::OBSOLETE_DELETE); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Message::Reader::isProvide() const { - return which() == Message::PROVIDE; -} -inline bool Message::Builder::isProvide() { - return which() == Message::PROVIDE; -} -inline bool Message::Reader::hasProvide() const { - if (which() != Message::PROVIDE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasProvide() { - if (which() != Message::PROVIDE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Provide::Reader Message::Reader::getProvide() const { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::getProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setProvide( ::capnp::rpc::Provide::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Provide::Builder Message::Builder::initProvide() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptProvide( - ::capnp::Orphan< ::capnp::rpc::Provide>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::PROVIDE); - ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Provide> Message::Builder::disownProvide() { - KJ_IREQUIRE((which() == Message::PROVIDE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Provide>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isAccept() const { - return which() == Message::ACCEPT; -} -inline bool Message::Builder::isAccept() { - return which() == Message::ACCEPT; -} -inline bool Message::Reader::hasAccept() const { - if (which() != Message::ACCEPT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasAccept() { - if (which() != Message::ACCEPT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Accept::Reader Message::Reader::getAccept() const { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::getAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setAccept( ::capnp::rpc::Accept::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Accept::Builder Message::Builder::initAccept() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptAccept( - ::capnp::Orphan< ::capnp::rpc::Accept>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::ACCEPT); - ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Accept> Message::Builder::disownAccept() { - KJ_IREQUIRE((which() == Message::ACCEPT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Accept>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isJoin() const { - return which() == Message::JOIN; -} -inline bool Message::Builder::isJoin() { - return which() == Message::JOIN; -} -inline bool Message::Reader::hasJoin() const { - if (which() != Message::JOIN) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasJoin() { - if (which() != Message::JOIN) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Join::Reader Message::Reader::getJoin() const { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Join::Builder Message::Builder::getJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setJoin( ::capnp::rpc::Join::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Join::Builder Message::Builder::initJoin() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptJoin( - ::capnp::Orphan< ::capnp::rpc::Join>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::JOIN); - ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Join> Message::Builder::disownJoin() { - KJ_IREQUIRE((which() == Message::JOIN), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Join>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Message::Reader::isDisembargo() const { - return which() == Message::DISEMBARGO; -} -inline bool Message::Builder::isDisembargo() { - return which() == Message::DISEMBARGO; -} -inline bool Message::Reader::hasDisembargo() const { - if (which() != Message::DISEMBARGO) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Message::Builder::hasDisembargo() { - if (which() != Message::DISEMBARGO) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Disembargo::Reader Message::Reader::getDisembargo() const { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::getDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::setDisembargo( ::capnp::rpc::Disembargo::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Disembargo::Builder Message::Builder::initDisembargo() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Message::Builder::adoptDisembargo( - ::capnp::Orphan< ::capnp::rpc::Disembargo>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Message::DISEMBARGO); - ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Disembargo> Message::Builder::disownDisembargo() { - KJ_IREQUIRE((which() == Message::DISEMBARGO), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Disembargo>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Bootstrap::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Bootstrap::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Bootstrap::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Bootstrap::Reader::hasDeprecatedObjectId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Bootstrap::Builder::hasDeprecatedObjectId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Bootstrap::Reader::getDeprecatedObjectId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::getDeprecatedObjectId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Bootstrap::Builder::initDeprecatedObjectId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Call::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Call::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Call::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Call::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Call::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Call::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Call::Reader::getInterfaceId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Call::Builder::getInterfaceId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setInterfaceId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Call::Reader::getMethodId() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Call::Builder::getMethodId() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setMethodId( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::Reader::hasParams() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::Builder::hasParams() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Call::Reader::getParams() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::getParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::Payload::Pipeline Call::Pipeline::getParams() { - return ::capnp::rpc::Payload::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Call::Builder::setParams( ::capnp::rpc::Payload::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Call::Builder::initParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Call::Builder::adoptParams( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Call::Builder::disownParams() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline typename Call::SendResultsTo::Reader Call::Reader::getSendResultsTo() const { - return typename Call::SendResultsTo::Reader(_reader); -} -inline typename Call::SendResultsTo::Builder Call::Builder::getSendResultsTo() { - return typename Call::SendResultsTo::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Call::SendResultsTo::Pipeline Call::Pipeline::getSendResultsTo() { - return typename Call::SendResultsTo::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Call::SendResultsTo::Builder Call::Builder::initSendResultsTo() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<3>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - return typename Call::SendResultsTo::Builder(_builder); -} -inline bool Call::Reader::getAllowThirdPartyTailCall() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Call::Builder::getAllowThirdPartyTailCall() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Call::Builder::setAllowThirdPartyTailCall(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Call::SendResultsTo::Which Call::SendResultsTo::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline bool Call::SendResultsTo::Reader::isCaller() const { - return which() == Call::SendResultsTo::CALLER; -} -inline bool Call::SendResultsTo::Builder::isCaller() { - return which() == Call::SendResultsTo::CALLER; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getCaller() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getCaller() { - KJ_IREQUIRE((which() == Call::SendResultsTo::CALLER), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setCaller( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::CALLER); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isYourself() const { - return which() == Call::SendResultsTo::YOURSELF; -} -inline bool Call::SendResultsTo::Builder::isYourself() { - return which() == Call::SendResultsTo::YOURSELF; -} -inline ::capnp::Void Call::SendResultsTo::Reader::getYourself() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Call::SendResultsTo::Builder::getYourself() { - KJ_IREQUIRE((which() == Call::SendResultsTo::YOURSELF), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Call::SendResultsTo::Builder::setYourself( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::YOURSELF); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Call::SendResultsTo::Reader::isThirdParty() const { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Builder::isThirdParty() { - return which() == Call::SendResultsTo::THIRD_PARTY; -} -inline bool Call::SendResultsTo::Reader::hasThirdParty() const { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Call::SendResultsTo::Builder::hasThirdParty() { - if (which() != Call::SendResultsTo::THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Call::SendResultsTo::Reader::getThirdParty() const { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::getThirdParty() { - KJ_IREQUIRE((which() == Call::SendResultsTo::THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Call::SendResultsTo::Builder::initThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Call::SendResultsTo::THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::Return::Which Return::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Return::Which Return::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Reader::getAnswerId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getAnswerId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setAnswerId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::getReleaseParamCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Return::Builder::getReleaseParamCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Return::Builder::setReleaseParamCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline bool Return::Reader::isResults() const { - return which() == Return::RESULTS; -} -inline bool Return::Builder::isResults() { - return which() == Return::RESULTS; -} -inline bool Return::Reader::hasResults() const { - if (which() != Return::RESULTS) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasResults() { - if (which() != Return::RESULTS) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Payload::Reader Return::Reader::getResults() const { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::getResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setResults( ::capnp::rpc::Payload::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Payload::Builder Return::Builder::initResults() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptResults( - ::capnp::Orphan< ::capnp::rpc::Payload>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS); - ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Payload> Return::Builder::disownResults() { - KJ_IREQUIRE((which() == Return::RESULTS), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Payload>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isException() const { - return which() == Return::EXCEPTION; -} -inline bool Return::Builder::isException() { - return which() == Return::EXCEPTION; -} -inline bool Return::Reader::hasException() const { - if (which() != Return::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasException() { - if (which() != Return::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Return::Reader::getException() const { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::getException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Return::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Return::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Return::Builder::disownException() { - KJ_IREQUIRE((which() == Return::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Return::Reader::isCanceled() const { - return which() == Return::CANCELED; -} -inline bool Return::Builder::isCanceled() { - return which() == Return::CANCELED; -} -inline ::capnp::Void Return::Reader::getCanceled() const { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getCanceled() { - KJ_IREQUIRE((which() == Return::CANCELED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setCanceled( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::CANCELED); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isResultsSentElsewhere() const { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline bool Return::Builder::isResultsSentElsewhere() { - return which() == Return::RESULTS_SENT_ELSEWHERE; -} -inline ::capnp::Void Return::Reader::getResultsSentElsewhere() const { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Return::Builder::getResultsSentElsewhere() { - KJ_IREQUIRE((which() == Return::RESULTS_SENT_ELSEWHERE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setResultsSentElsewhere( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::RESULTS_SENT_ELSEWHERE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isTakeFromOtherQuestion() const { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline bool Return::Builder::isTakeFromOtherQuestion() { - return which() == Return::TAKE_FROM_OTHER_QUESTION; -} -inline ::uint32_t Return::Reader::getTakeFromOtherQuestion() const { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Return::Builder::getTakeFromOtherQuestion() { - KJ_IREQUIRE((which() == Return::TAKE_FROM_OTHER_QUESTION), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Return::Builder::setTakeFromOtherQuestion( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::TAKE_FROM_OTHER_QUESTION); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Return::Reader::isAcceptFromThirdParty() const { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Builder::isAcceptFromThirdParty() { - return which() == Return::ACCEPT_FROM_THIRD_PARTY; -} -inline bool Return::Reader::hasAcceptFromThirdParty() const { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Return::Builder::hasAcceptFromThirdParty() { - if (which() != Return::ACCEPT_FROM_THIRD_PARTY) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Return::Reader::getAcceptFromThirdParty() const { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::getAcceptFromThirdParty() { - KJ_IREQUIRE((which() == Return::ACCEPT_FROM_THIRD_PARTY), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Return::Builder::initAcceptFromThirdParty() { - _builder.setDataField( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, Return::ACCEPT_FROM_THIRD_PARTY); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Finish::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Finish::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Finish::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Finish::Reader::getReleaseResultCaps() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} - -inline bool Finish::Builder::getReleaseResultCaps() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, true); -} -inline void Finish::Builder::setReleaseResultCaps(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value, true); -} - -inline ::capnp::rpc::Resolve::Which Resolve::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Resolve::Which Resolve::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Reader::getPromiseId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Resolve::Builder::getPromiseId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Resolve::Builder::setPromiseId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Resolve::Reader::isCap() const { - return which() == Resolve::CAP; -} -inline bool Resolve::Builder::isCap() { - return which() == Resolve::CAP; -} -inline bool Resolve::Reader::hasCap() const { - if (which() != Resolve::CAP) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasCap() { - if (which() != Resolve::CAP) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::CapDescriptor::Reader Resolve::Reader::getCap() const { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::getCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setCap( ::capnp::rpc::CapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::CapDescriptor::Builder Resolve::Builder::initCap() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptCap( - ::capnp::Orphan< ::capnp::rpc::CapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::CAP); - ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::CapDescriptor> Resolve::Builder::disownCap() { - KJ_IREQUIRE((which() == Resolve::CAP), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::CapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Resolve::Reader::isException() const { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Builder::isException() { - return which() == Resolve::EXCEPTION; -} -inline bool Resolve::Reader::hasException() const { - if (which() != Resolve::EXCEPTION) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Resolve::Builder::hasException() { - if (which() != Resolve::EXCEPTION) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::Exception::Reader Resolve::Reader::getException() const { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::getException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::setException( ::capnp::rpc::Exception::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::Exception::Builder Resolve::Builder::initException() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Resolve::Builder::adoptException( - ::capnp::Orphan< ::capnp::rpc::Exception>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Resolve::EXCEPTION); - ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::Exception> Resolve::Builder::disownException() { - KJ_IREQUIRE((which() == Resolve::EXCEPTION), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::Exception>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Release::Reader::getId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Release::Reader::getReferenceCount() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Release::Builder::getReferenceCount() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Release::Builder::setReferenceCount( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Disembargo::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Disembargo::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Disembargo::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Disembargo::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Disembargo::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Disembargo::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Disembargo::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline typename Disembargo::Context::Reader Disembargo::Reader::getContext() const { - return typename Disembargo::Context::Reader(_reader); -} -inline typename Disembargo::Context::Builder Disembargo::Builder::getContext() { - return typename Disembargo::Context::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Disembargo::Context::Pipeline Disembargo::Pipeline::getContext() { - return typename Disembargo::Context::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Disembargo::Context::Builder Disembargo::Builder::initContext() { - _builder.setDataField< ::uint32_t>(::capnp::bounded<0>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Disembargo::Context::Builder(_builder); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::Disembargo::Context::Which Disembargo::Context::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool Disembargo::Context::Reader::isSenderLoopback() const { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isSenderLoopback() { - return which() == Disembargo::Context::SENDER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getSenderLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getSenderLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::SENDER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setSenderLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::SENDER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isReceiverLoopback() const { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline bool Disembargo::Context::Builder::isReceiverLoopback() { - return which() == Disembargo::Context::RECEIVER_LOOPBACK; -} -inline ::uint32_t Disembargo::Context::Reader::getReceiverLoopback() const { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getReceiverLoopback() { - KJ_IREQUIRE((which() == Disembargo::Context::RECEIVER_LOOPBACK), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setReceiverLoopback( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::RECEIVER_LOOPBACK); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isAccept() const { - return which() == Disembargo::Context::ACCEPT; -} -inline bool Disembargo::Context::Builder::isAccept() { - return which() == Disembargo::Context::ACCEPT; -} -inline ::capnp::Void Disembargo::Context::Reader::getAccept() const { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Disembargo::Context::Builder::getAccept() { - KJ_IREQUIRE((which() == Disembargo::Context::ACCEPT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setAccept( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::ACCEPT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Disembargo::Context::Reader::isProvide() const { - return which() == Disembargo::Context::PROVIDE; -} -inline bool Disembargo::Context::Builder::isProvide() { - return which() == Disembargo::Context::PROVIDE; -} -inline ::uint32_t Disembargo::Context::Reader::getProvide() const { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Disembargo::Context::Builder::getProvide() { - KJ_IREQUIRE((which() == Disembargo::Context::PROVIDE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Disembargo::Context::Builder::setProvide( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, Disembargo::Context::PROVIDE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Provide::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Provide::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Provide::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Provide::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Provide::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Provide::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Provide::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Provide::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Provide::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Provide::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Provide::Reader::hasRecipient() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Provide::Builder::hasRecipient() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Provide::Reader::getRecipient() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::getRecipient() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Provide::Builder::initRecipient() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t Accept::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Accept::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Accept::Reader::hasProvision() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Accept::Builder::hasProvision() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Accept::Reader::getProvision() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::getProvision() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Accept::Builder::initProvision() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Accept::Reader::getEmbargo() const { - return _reader.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} - -inline bool Accept::Builder::getEmbargo() { - return _builder.getDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS); -} -inline void Accept::Builder::setEmbargo(bool value) { - _builder.setDataField( - ::capnp::bounded<32>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Join::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Join::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Join::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Join::Reader::hasTarget() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasTarget() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::MessageTarget::Reader Join::Reader::getTarget() const { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::getTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::rpc::MessageTarget::Pipeline Join::Pipeline::getTarget() { - return ::capnp::rpc::MessageTarget::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Join::Builder::setTarget( ::capnp::rpc::MessageTarget::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::MessageTarget::Builder Join::Builder::initTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Join::Builder::adoptTarget( - ::capnp::Orphan< ::capnp::rpc::MessageTarget>&& value) { - ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::MessageTarget> Join::Builder::disownTarget() { - return ::capnp::_::PointerHelpers< ::capnp::rpc::MessageTarget>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Join::Reader::hasKeyPart() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Join::Builder::hasKeyPart() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Join::Reader::getKeyPart() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::getKeyPart() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Join::Builder::initKeyPart() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::MessageTarget::Which MessageTarget::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline bool MessageTarget::Reader::isImportedCap() const { - return which() == MessageTarget::IMPORTED_CAP; -} -inline bool MessageTarget::Builder::isImportedCap() { - return which() == MessageTarget::IMPORTED_CAP; -} -inline ::uint32_t MessageTarget::Reader::getImportedCap() const { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t MessageTarget::Builder::getImportedCap() { - KJ_IREQUIRE((which() == MessageTarget::IMPORTED_CAP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void MessageTarget::Builder::setImportedCap( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::IMPORTED_CAP); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool MessageTarget::Reader::isPromisedAnswer() const { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Builder::isPromisedAnswer() { - return which() == MessageTarget::PROMISED_ANSWER; -} -inline bool MessageTarget::Reader::hasPromisedAnswer() const { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool MessageTarget::Builder::hasPromisedAnswer() { - if (which() != MessageTarget::PROMISED_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader MessageTarget::Reader::getPromisedAnswer() const { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::getPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::setPromisedAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder MessageTarget::Builder::initPromisedAnswer() { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void MessageTarget::Builder::adoptPromisedAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, MessageTarget::PROMISED_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> MessageTarget::Builder::disownPromisedAnswer() { - KJ_IREQUIRE((which() == MessageTarget::PROMISED_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Payload::Reader::hasContent() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasContent() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Payload::Reader::getContent() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::getContent() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Payload::Builder::initContent() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Payload::Reader::hasCapTable() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Payload::Builder::hasCapTable() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader Payload::Reader::getCapTable() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::getCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Payload::Builder::setCapTable( ::capnp::List< ::capnp::rpc::CapDescriptor>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::CapDescriptor>::Builder Payload::Builder::initCapTable(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Payload::Builder::adoptCapTable( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::CapDescriptor>> Payload::Builder::disownCapTable() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::CapDescriptor>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::CapDescriptor::Which CapDescriptor::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool CapDescriptor::Reader::isNone() const { - return which() == CapDescriptor::NONE; -} -inline bool CapDescriptor::Builder::isNone() { - return which() == CapDescriptor::NONE; -} -inline ::capnp::Void CapDescriptor::Reader::getNone() const { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void CapDescriptor::Builder::getNone() { - KJ_IREQUIRE((which() == CapDescriptor::NONE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setNone( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::NONE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderHosted() const { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline bool CapDescriptor::Builder::isSenderHosted() { - return which() == CapDescriptor::SENDER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getSenderHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderHosted() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isSenderPromise() const { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline bool CapDescriptor::Builder::isSenderPromise() { - return which() == CapDescriptor::SENDER_PROMISE; -} -inline ::uint32_t CapDescriptor::Reader::getSenderPromise() const { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getSenderPromise() { - KJ_IREQUIRE((which() == CapDescriptor::SENDER_PROMISE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setSenderPromise( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::SENDER_PROMISE); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverHosted() const { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline bool CapDescriptor::Builder::isReceiverHosted() { - return which() == CapDescriptor::RECEIVER_HOSTED; -} -inline ::uint32_t CapDescriptor::Reader::getReceiverHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t CapDescriptor::Builder::getReceiverHosted() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_HOSTED), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void CapDescriptor::Builder::setReceiverHosted( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_HOSTED); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool CapDescriptor::Reader::isReceiverAnswer() const { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Builder::isReceiverAnswer() { - return which() == CapDescriptor::RECEIVER_ANSWER; -} -inline bool CapDescriptor::Reader::hasReceiverAnswer() const { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasReceiverAnswer() { - if (which() != CapDescriptor::RECEIVER_ANSWER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::PromisedAnswer::Reader CapDescriptor::Reader::getReceiverAnswer() const { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::getReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setReceiverAnswer( ::capnp::rpc::PromisedAnswer::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::PromisedAnswer::Builder CapDescriptor::Builder::initReceiverAnswer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptReceiverAnswer( - ::capnp::Orphan< ::capnp::rpc::PromisedAnswer>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::RECEIVER_ANSWER); - ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::PromisedAnswer> CapDescriptor::Builder::disownReceiverAnswer() { - KJ_IREQUIRE((which() == CapDescriptor::RECEIVER_ANSWER), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::PromisedAnswer>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CapDescriptor::Reader::isThirdPartyHosted() const { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Builder::isThirdPartyHosted() { - return which() == CapDescriptor::THIRD_PARTY_HOSTED; -} -inline bool CapDescriptor::Reader::hasThirdPartyHosted() const { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CapDescriptor::Builder::hasThirdPartyHosted() { - if (which() != CapDescriptor::THIRD_PARTY_HOSTED) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Reader CapDescriptor::Reader::getThirdPartyHosted() const { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::getThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::setThirdPartyHosted( ::capnp::rpc::ThirdPartyCapDescriptor::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::rpc::ThirdPartyCapDescriptor::Builder CapDescriptor::Builder::initThirdPartyHosted() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CapDescriptor::Builder::adoptThirdPartyHosted( - ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, CapDescriptor::THIRD_PARTY_HOSTED); - ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::rpc::ThirdPartyCapDescriptor> CapDescriptor::Builder::disownThirdPartyHosted() { - KJ_IREQUIRE((which() == CapDescriptor::THIRD_PARTY_HOSTED), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::rpc::ThirdPartyCapDescriptor>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t PromisedAnswer::Reader::getQuestionId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t PromisedAnswer::Builder::getQuestionId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Builder::setQuestionId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Reader::hasTransform() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool PromisedAnswer::Builder::hasTransform() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader PromisedAnswer::Reader::getTransform() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::getTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void PromisedAnswer::Builder::setTransform( ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>::Builder PromisedAnswer::Builder::initTransform(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void PromisedAnswer::Builder::adoptTransform( - ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>> PromisedAnswer::Builder::disownTransform() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::rpc::PromisedAnswer::Op>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::rpc::PromisedAnswer::Op::Which PromisedAnswer::Op::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool PromisedAnswer::Op::Reader::isNoop() const { - return which() == PromisedAnswer::Op::NOOP; -} -inline bool PromisedAnswer::Op::Builder::isNoop() { - return which() == PromisedAnswer::Op::NOOP; -} -inline ::capnp::Void PromisedAnswer::Op::Reader::getNoop() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void PromisedAnswer::Op::Builder::getNoop() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::NOOP), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setNoop( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::NOOP); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool PromisedAnswer::Op::Reader::isGetPointerField() const { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline bool PromisedAnswer::Op::Builder::isGetPointerField() { - return which() == PromisedAnswer::Op::GET_POINTER_FIELD; -} -inline ::uint16_t PromisedAnswer::Op::Reader::getGetPointerField() const { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t PromisedAnswer::Op::Builder::getGetPointerField() { - KJ_IREQUIRE((which() == PromisedAnswer::Op::GET_POINTER_FIELD), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void PromisedAnswer::Op::Builder::setGetPointerField( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, PromisedAnswer::Op::GET_POINTER_FIELD); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool ThirdPartyCapDescriptor::Reader::hasId() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool ThirdPartyCapDescriptor::Builder::hasId() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader ThirdPartyCapDescriptor::Reader::getId() const { - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::getId() { - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder ThirdPartyCapDescriptor::Builder::initId() { - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint32_t ThirdPartyCapDescriptor::Reader::getVineId() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t ThirdPartyCapDescriptor::Builder::getVineId() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void ThirdPartyCapDescriptor::Builder::setVineId( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Exception::Reader::hasReason() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Exception::Builder::hasReason() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Exception::Reader::getReason() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Exception::Builder::getReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Exception::Builder::setReason( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Exception::Builder::initReason(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Exception::Builder::adoptReason( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Exception::Builder::disownReason() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Exception::Reader::getObsoleteIsCallersFault() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Exception::Builder::getObsoleteIsCallersFault() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteIsCallersFault(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Exception::Reader::getObsoleteDurability() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Exception::Builder::getObsoleteDurability() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setObsoleteDurability( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::rpc::Exception::Type Exception::Reader::getType() const { - return _reader.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::capnp::rpc::Exception::Type Exception::Builder::getType() { - return _builder.getDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Exception::Builder::setType( ::capnp::rpc::Exception::Type value) { - _builder.setDataField< ::capnp::rpc::Exception::Type>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_b312981b2552a250_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/rpc.h b/phonelibs/capnp-cpp/mac/include/capnp/rpc.h deleted file mode 100644 index d84ed982e7..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/rpc.h +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_RPC_H_ -#define CAPNP_RPC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "capability.h" -#include "rpc-prelude.h" - -namespace capnp { - -template -class VatNetwork; -template -class SturdyRefRestorer; - -template -class BootstrapFactory: public _::BootstrapFactoryBase { - // Interface that constructs per-client bootstrap interfaces. Use this if you want each client - // who connects to see a different bootstrap interface based on their (authenticated) VatId. - // This allows an application to bootstrap off of the authentication performed at the VatNetwork - // level. (Typically VatId is some sort of public key.) - // - // This is only useful for multi-party networks. For TwoPartyVatNetwork, there's no reason to - // use a BootstrapFactory; just specify a single bootstrap capability in this case. - -public: - virtual Capability::Client createFor(typename VatId::Reader clientId) = 0; - // Create a bootstrap capability appropriate for exposing to the given client. VatNetwork will - // have authenticated the client VatId before this is called. - -private: - Capability::Client baseCreateFor(AnyStruct::Reader clientId) override; -}; - -template -class RpcSystem: public _::RpcSystemBase { - // Represents the RPC system, which is the portal to objects available on the network. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // See `makeRpcServer()` and `makeRpcClient()` below for convenient syntax for setting up an - // `RpcSystem` given a `VatNetwork`. - // - // See `ez-rpc.h` for an even simpler interface for setting up RPC in a typical two-party - // client/server scenario. - -public: - template - RpcSystem( - VatNetwork& network, - kj::Maybe bootstrapInterface, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway = nullptr); - - template - RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer); - - RpcSystem(RpcSystem&& other) = default; - - Capability::Client bootstrap(typename VatId::Reader vatId); - // Connect to the given vat and return its bootstrap interface. - - Capability::Client restore(typename VatId::Reader hostId, AnyPointer::Reader objectId) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); - // ** DEPRECATED ** - // - // Restores the given SturdyRef from the network and return the capability representing it. - // - // `hostId` identifies the host from which to request the ref, in the format specified by the - // `VatNetwork` in use. `objectId` is the object ID in whatever format is expected by said host. - // - // This method will be removed in a future version of Cap'n Proto. Instead, please transition - // to using bootstrap(), which is equivalent to calling restore() with a null `objectId`. - // You may emulate the old concept of object IDs by exporting a bootstrap interface which has - // methods that can be used to obtain other capabilities by ID. - - void setFlowLimit(size_t words); - // Sets the incoming call flow limit. If more than `words` worth of call messages have not yet - // received responses, the RpcSystem will not read further messages from the stream. This can be - // used as a crude way to prevent a resource exhaustion attack (or bug) in which a peer makes an - // excessive number of simultaneous calls that consume the receiver's RAM. - // - // There are some caveats. When over the flow limit, all messages are blocked, including returns. - // If the outstanding calls are themselves waiting on calls going in the opposite direction, the - // flow limit may prevent those calls from completing, leading to deadlock. However, a - // sufficiently high limit should make this unlikely. - // - // Note that a call's parameter size counts against the flow limit until the call returns, even - // if the recipient calls releaseParams() to free the parameter memory early. This is because - // releaseParams() may simply indicate that the parameters have been forwarded to another - // machine, but are still in-memory there. For illustration, say that Alice made a call to Bob - // who forwarded the call to Carol. Bob has imposed a flow limit on Alice. Alice's calls are - // being forwarded to Carol, so Bob never keeps the parameters in-memory for more than a brief - // period. However, the flow limit counts all calls that haven't returned, even if Bob has - // already freed the memory they consumed. You might argue that the right solution here is - // instead for Carol to impose her own flow limit on Bob. This has a serious problem, though: - // Bob might be forwarding requests to Carol on behalf of many different parties, not just Alice. - // If Alice can pump enough data to hit the Bob -> Carol flow limit, then those other parties - // will be disrupted. Thus, we can only really impose the limit on the Alice -> Bob link, which - // only affects Alice. We need that one flow limit to limit Alice's impact on the whole system, - // so it has to count all in-flight calls. - // - // In Sandstorm, flow limits are imposed by the supervisor on calls coming out of a grain, in - // order to prevent a grain from inundating the system with in-flight calls. In practice, the - // main time this happens is when a grain is pushing a large file download and doesn't implement - // proper cooperative flow control. -}; - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface); -// Make an RPC server. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// MyMainInterface::Client bootstrap = makeMain(); -// auto server = makeRpcServer(network, bootstrap); -// kj::NEVER_DONE.wait(waitScope); // run forever -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway); -// Make an RPC server for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway); -// Make an RPC server that can serve different bootstrap interfaces to different clients via a -// BootstrapInterface and communicates with a different realm than the application is in via a -// RealmGateway. - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) - KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); -// ** DEPRECATED ** -// -// Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object -// can be used to look up objects by ID. -// -// Please transition to exporting only one interface, which is known as the "bootstrap" interface. -// For backwards-compatibility with old clients, continue to implement SturdyRefRestorer, but -// return the new bootstrap interface when the request object ID is null. When new clients connect -// and request the bootstrap interface, they will get that interface. Eventually, once all clients -// are updated to request only the bootstrap interface, stop implementing SturdyRefRestorer and -// switch to passing the bootstrap capability itself as the second parameter to `makeRpcServer()`. - -template -RpcSystem makeRpcClient( - VatNetwork& network); -// Make an RPC client. Typical usage (e.g. in a main() function): -// -// MyEventLoop eventLoop; -// kj::WaitScope waitScope(eventLoop); -// MyNetwork network; -// auto client = makeRpcClient(network); -// MyCapability::Client cap = client.restore(hostId, objId).castAs(); -// auto response = cap.fooRequest().send().wait(waitScope); -// handleMyResponse(response); -// -// See also ez-rpc.h, which has simpler instructions for the common case of a two-party -// client-server RPC connection. - -template , - typename ExternalRef = _::ExternalRefFromRealmGatewayClient> -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway); -// Make an RPC client for a VatNetwork that resides in a different realm from the application. -// The given RealmGateway is used to translate SturdyRefs between the app's ("internal") format -// and the network's ("external") format. - -template -class SturdyRefRestorer: public _::SturdyRefRestorerBase { - // ** DEPRECATED ** - // - // In Cap'n Proto 0.4.x, applications could export multiple main interfaces identified by - // object IDs. The callback used to map object IDs to objects was `SturdyRefRestorer`, as we - // imagined this would eventually be used for restoring SturdyRefs as well. In practice, it was - // never used for real SturdyRefs, only for exporting singleton objects under well-known names. - // - // The new preferred strategy is to export only a _single_ such interface, called the - // "bootstrap interface". That interface can itself have methods for obtaining other objects, of - // course, but that is up to the app. `SturdyRefRestorer` exists for backwards-compatibility. - // - // Hint: Use SturdyRefRestorer to define a server that exports services under - // string names. - -public: - virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) - KJ_DEPRECATED( - "Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0; - // Restore the given object, returning a capability representing it. - -private: - Capability::Client baseRestore(AnyPointer::Reader ref) override final; -}; - -// ======================================================================================= -// VatNetwork - -class OutgoingRpcMessage { - // A message to be sent by a `VatNetwork`. - -public: - virtual AnyPointer::Builder getBody() = 0; - // Get the message body, which the caller may fill in any way it wants. (The standard RPC - // implementation initializes it as a Message as defined in rpc.capnp.) - - virtual void send() = 0; - // Send the message, or at least put it in a queue to be sent later. Note that the builder - // returned by `getBody()` remains valid at least until the `OutgoingRpcMessage` is destroyed. -}; - -class IncomingRpcMessage { - // A message received from a `VatNetwork`. - -public: - virtual AnyPointer::Reader getBody() = 0; - // Get the message body, to be interpreted by the caller. (The standard RPC implementation - // interprets it as a Message as defined in rpc.capnp.) -}; - -template -class VatNetwork: public _::VatNetworkBase { - // Cap'n Proto RPC operates between vats, where a "vat" is some sort of host of objects. - // Typically one Cap'n Proto process (in the Unix sense) is one vat. The RPC system is what - // allows calls between objects hosted in different vats. - // - // The RPC implementation sits on top of an implementation of `VatNetwork`. The `VatNetwork` - // determines how to form connections between vats -- specifically, two-way, private, reliable, - // sequenced datagram connections. The RPC implementation determines how to use such connections - // to manage object references and make method calls. - // - // The most common implementation of VatNetwork is TwoPartyVatNetwork (rpc-twoparty.h). Most - // simple client-server apps will want to use it. (You may even want to use the EZ RPC - // interfaces in `ez-rpc.h` and avoid all of this.) - // - // TODO(someday): Provide a standard implementation for the public internet. - -public: - class Connection; - - struct ConnectionAndProvisionId { - // Result of connecting to a vat introduced by another vat. - - kj::Own connection; - // Connection to the new vat. - - kj::Own firstMessage; - // An already-allocated `OutgoingRpcMessage` associated with `connection`. The RPC system will - // construct this as an `Accept` message and send it. - - Orphan provisionId; - // A `ProvisionId` already allocated inside `firstMessage`, which the RPC system will use to - // build the `Accept` message. - }; - - class Connection: public _::VatNetworkBase::Connection { - // A two-way RPC connection. - // - // This object may represent a connection that doesn't exist yet, but is expected to exist - // in the future. In this case, sent messages will automatically be queued and sent once the - // connection is ready, so that the caller doesn't need to know the difference. - - public: - // Level 0 features ---------------------------------------------- - - virtual typename VatId::Reader getPeerVatId() = 0; - // Returns the connected vat's authenticated VatId. It is the VatNetwork's responsibility to - // authenticate this, so that the caller can be assured that they are really talking to the - // identified vat and not an imposter. - - virtual kj::Own newOutgoingMessage(uint firstSegmentWordSize) override = 0; - // Allocate a new message to be sent on this connection. - // - // If `firstSegmentWordSize` is non-zero, it should be treated as a hint suggesting how large - // to make the first segment. This is entirely a hint and the connection may adjust it up or - // down. If it is zero, the connection should choose the size itself. - - virtual kj::Promise>> receiveIncomingMessage() override = 0; - // Wait for a message to be received and return it. If the read stream cleanly terminates, - // return null. If any other problem occurs, throw an exception. - - virtual kj::Promise shutdown() override KJ_WARN_UNUSED_RESULT = 0; - // Waits until all outgoing messages have been sent, then shuts down the outgoing stream. The - // returned promise resolves after shutdown is complete. - - private: - AnyStruct::Reader baseGetPeerVatId() override; - }; - - // Level 0 features ------------------------------------------------ - - virtual kj::Maybe> connect(typename VatId::Reader hostId) = 0; - // Connect to a VatId. Note that this method immediately returns a `Connection`, even - // if the network connection has not yet been established. Messages can be queued to this - // connection and will be delivered once it is open. The caller must attempt to read from the - // connection to verify that it actually succeeded; the read will fail if the connection - // couldn't be opened. Some network implementations may actually start sending messages before - // hearing back from the server at all, to avoid a round trip. - // - // Returns nullptr if `hostId` refers to the local host. - - virtual kj::Promise> accept() = 0; - // Wait for the next incoming connection and return it. - - // Level 4 features ------------------------------------------------ - // TODO(someday) - -private: - kj::Maybe> - baseConnect(AnyStruct::Reader hostId) override final; - kj::Promise> baseAccept() override final; -}; - -// ======================================================================================= -// *************************************************************************************** -// Inline implementation details start here -// *************************************************************************************** -// ======================================================================================= - -template -Capability::Client BootstrapFactory::baseCreateFor(AnyStruct::Reader clientId) { - return createFor(clientId.as()); -} - -template -kj::Maybe> - VatNetwork:: - baseConnect(AnyStruct::Reader ref) { - auto maybe = connect(ref.as()); - return maybe.map([](kj::Own& conn) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(conn); - }); -} - -template -kj::Promise> - VatNetwork::baseAccept() { - return accept().then( - [](kj::Own&& connection) -> kj::Own<_::VatNetworkBase::Connection> { - return kj::mv(connection); - }); -} - -template -AnyStruct::Reader VatNetwork< - SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>:: - Connection::baseGetPeerVatId() { - return getPeerVatId(); -} - -template -Capability::Client SturdyRefRestorer::baseRestore(AnyPointer::Reader ref) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return restore(ref.getAs()); -#pragma GCC diagnostic pop -} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - kj::Maybe bootstrap, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, kj::mv(bootstrap), kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, - kj::Maybe::Client> gateway) - : _::RpcSystemBase(network, bootstrapFactory, kj::mv(gateway)) {} - -template -template -RpcSystem::RpcSystem( - VatNetwork& network, - SturdyRefRestorer& restorer) - : _::RpcSystemBase(network, restorer) {} - -template -Capability::Client RpcSystem::bootstrap(typename VatId::Reader vatId) { - return baseBootstrap(_::PointerHelpers::getInternalReader(vatId)); -} - -template -Capability::Client RpcSystem::restore( - typename VatId::Reader hostId, AnyPointer::Reader objectId) { - return baseRestore(_::PointerHelpers::getInternalReader(hostId), objectId); -} - -template -inline void RpcSystem::setFlowLimit(size_t words) { - baseSetFlowLimit(words); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface) { - return RpcSystem(network, kj::mv(bootstrapInterface)); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - Capability::Client bootstrapInterface, RealmGatewayClient gateway) { - return RpcSystem(network, kj::mv(bootstrapInterface), - gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory) { - return RpcSystem(network, bootstrapFactory); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - BootstrapFactory& bootstrapFactory, RealmGatewayClient gateway) { - return RpcSystem(network, bootstrapFactory, gateway.template castAs>()); -} - -template -RpcSystem makeRpcServer( - VatNetwork& network, - SturdyRefRestorer& restorer) { - return RpcSystem(network, restorer); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network) { - return RpcSystem(network, nullptr); -} - -template -RpcSystem makeRpcClient( - VatNetwork& network, - RealmGatewayClient gateway) { - return RpcSystem(network, nullptr, gateway.template castAs>()); -} - -} // namespace capnp - -#endif // CAPNP_RPC_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema-lite.h b/phonelibs/capnp-cpp/mac/include/capnp/schema-lite.h deleted file mode 100644 index 58a8c14c05..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema-lite.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LITE_H_ -#define CAPNP_SCHEMA_LITE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -template -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(CapnpPrivate::encodedSchema()); -} - -template ::typeId> -inline schema::Node::Reader schemaProto() { - // Get the schema::Node for this type's schema. This function works even in lite mode. - return readMessageUnchecked(schemas::EnumInfo::encodedSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LITE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema-loader.h b/phonelibs/capnp-cpp/mac/include/capnp/schema-loader.h deleted file mode 100644 index 0e34cba77f..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema-loader.h +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_LOADER_H_ -#define CAPNP_SCHEMA_LOADER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema.h" -#include -#include - -namespace capnp { - -class SchemaLoader { - // Class which can be used to construct Schema objects from schema::Nodes as defined in - // schema.capnp. - // - // It is a bad idea to use this class on untrusted input with exceptions disabled -- you may - // be exposing yourself to denial-of-service attacks, as attackers can easily construct schemas - // that are subtly inconsistent in a way that causes exceptions to be thrown either by - // SchemaLoader or by the dynamic API when the schemas are subsequently used. If you enable and - // properly catch exceptions, you should be OK -- assuming no bugs in the Cap'n Proto - // implementation, of course. - -public: - class LazyLoadCallback { - public: - virtual void load(const SchemaLoader& loader, uint64_t id) const = 0; - // Request that the schema node with the given ID be loaded into the given SchemaLoader. If - // the callback is able to find a schema for this ID, it should invoke `loadOnce()` on - // `loader` to load it. If no such node exists, it should simply do nothing and return. - // - // The callback is allowed to load schema nodes other than the one requested, e.g. because it - // expects they will be needed soon. - // - // If the `SchemaLoader` is used from multiple threads, the callback must be thread-safe. - // In particular, it's possible for multiple threads to invoke `load()` with the same ID. - // If the callback performs a large amount of work to look up IDs, it should be sure to - // de-dup these requests. - }; - - SchemaLoader(); - - SchemaLoader(const LazyLoadCallback& callback); - // Construct a SchemaLoader which will invoke the given callback when a schema node is requested - // that isn't already loaded. - - ~SchemaLoader() noexcept(false); - KJ_DISALLOW_COPY(SchemaLoader); - - Schema get(uint64_t id, schema::Brand::Reader brand = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Gets the schema for the given ID, throwing an exception if it isn't present. - // - // The returned schema may be invalidated if load() is called with a new schema for the same ID. - // In general, you should not call load() while a schema from this loader is in-use. - // - // `brand` and `scope` are used to determine brand bindings where relevant. `brand` gives - // parameter bindings for the target type's brand parameters that were specified at the reference - // site. `scope` specifies the scope in which the type ID appeared -- if `brand` itself contains - // parameter references or indicates that some parameters will be inherited, these will be - // interpreted within / inherited from `scope`. - - kj::Maybe tryGet(uint64_t id, schema::Brand::Reader bindings = schema::Brand::Reader(), - Schema scope = Schema()) const; - // Like get() but doesn't throw. - - Schema getUnbound(uint64_t id) const; - // Gets a special version of the schema in which all brand parameters are "unbound". This means - // that if you look up a type via the Schema API, and it resolves to a brand parameter, the - // returned Type's getBrandParameter() method will return info about that parameter. Otherwise, - // normally, all brand parameters that aren't otherwise bound are assumed to simply be - // "AnyPointer". - - Type getType(schema::Type::Reader type, Schema scope = Schema()) const; - // Convenience method which interprets a schema::Type to produce a Type object. Implemented in - // terms of get(). - - Schema load(const schema::Node::Reader& reader); - // Loads the given schema node. Validates the node and throws an exception if invalid. This - // makes a copy of the schema, so the object passed in can be destroyed after this returns. - // - // If the node has any dependencies which are not already loaded, they will be initialized as - // stubs -- empty schemas of whichever kind is expected. - // - // If another schema for the given reader has already been seen, the loader will inspect both - // schemas to determine which one is newer, and use that that one. If the two versions are - // found to be incompatible, an exception is thrown. If the two versions differ but are - // compatible and the loader cannot determine which is newer (e.g., the only changes are renames), - // the existing schema will be preferred. Note that in any case, the loader will end up keeping - // around copies of both schemas, so you shouldn't repeatedly reload schemas into the same loader. - // - // The following properties of the schema node are validated: - // - Struct size and preferred list encoding are valid and consistent. - // - Struct members are fields or unions. - // - Union members are fields. - // - Field offsets are in-bounds. - // - Ordinals and codeOrders are sequential starting from zero. - // - Values are of the right union case to match their types. - // - // You should assume anything not listed above is NOT validated. In particular, things that are - // not validated now, but could be in the future, include but are not limited to: - // - Names. - // - Annotation values. (This is hard because the annotation declaration is not always - // available.) - // - Content of default/constant values of pointer type. (Validating these would require knowing - // their schema, but even if the schemas are available at validation time, they could be - // updated by a subsequent load(), invalidating existing values. Instead, these values are - // validated at the time they are used, as usual for Cap'n Proto objects.) - // - // Also note that unknown types are not considered invalid. Instead, the dynamic API returns - // a DynamicValue with type UNKNOWN for these. - - Schema loadOnce(const schema::Node::Reader& reader) const; - // Like `load()` but does nothing if a schema with the same ID is already loaded. In contrast, - // `load()` would attempt to compare the schemas and take the newer one. `loadOnce()` is safe - // to call even while concurrently using schemas from this loader. It should be considered an - // error to call `loadOnce()` with two non-identical schemas that share the same ID, although - // this error may or may not actually be detected by the implementation. - - template - void loadCompiledTypeAndDependencies(); - // Load the schema for the given compiled-in type and all of its dependencies. - // - // If you want to be able to cast a DynamicValue built from this SchemaLoader to the compiled-in - // type using as(), you must call this method before constructing the DynamicValue. Otherwise, - // as() will throw an exception complaining about type mismatch. - - kj::Array getAllLoaded() const; - // Get a complete list of all loaded schema nodes. It is particularly useful to call this after - // loadCompiledTypeAndDependencies() in order to get a flat list of all of T's transitive - // dependencies. - -private: - class Validator; - class CompatibilityChecker; - class Impl; - class InitializerImpl; - class BrandedInitializerImpl; - kj::MutexGuarded> impl; - - void loadNative(const _::RawSchema* nativeSchema); -}; - -template -inline void SchemaLoader::loadCompiledTypeAndDependencies() { - loadNative(&_::rawSchema()); -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_LOADER_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema-parser.h b/phonelibs/capnp-cpp/mac/include/capnp/schema-parser.h deleted file mode 100644 index 3322bbfbfb..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema-parser.h +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_PARSER_H_ -#define CAPNP_SCHEMA_PARSER_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "schema-loader.h" -#include - -namespace capnp { - -class ParsedSchema; -class SchemaFile; - -class SchemaParser { - // Parses `.capnp` files to produce `Schema` objects. - // - // This class is thread-safe, hence all its methods are const. - -public: - SchemaParser(); - ~SchemaParser() noexcept(false); - - ParsedSchema parseDiskFile(kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath) const; - // Parse a file located on disk. Throws an exception if the file dosen't exist. - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. (If the file has - // already been parsed, this will be ignored and the display name from the first time it was - // parsed will be kept.) - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). Must remain valid until the SchemaParser is destroyed. - // (If the file has already been parsed, this will be ignored and the import path from the - // first time it was parsed will be kept.) - // - // This method is a shortcut, equivalent to: - // parser.parseFile(SchemaFile::newDiskFile(displayName, diskPath, importPath))`; - // - // This method throws an exception if any errors are encountered in the file or in anything the - // file depends on. Note that merely importing another file does not count as a dependency on - // anything in the imported file -- only the imported types which are actually used are - // "dependencies". - - ParsedSchema parseFile(kj::Own&& file) const; - // Advanced interface for parsing a file that may or may not be located in any global namespace. - // Most users will prefer `parseDiskFile()`. - // - // If the file has already been parsed (that is, a SchemaFile that compares equal to this one - // was parsed previously), the existing schema will be returned again. - // - // This method reports errors by calling SchemaFile::reportError() on the file where the error - // is located. If that call does not throw an exception, `parseFile()` may in fact return - // normally. In this case, the result is a best-effort attempt to compile the schema, but it - // may be invalid or corrupt, and using it for anything may cause exceptions to be thrown. - - template - inline void loadCompiledTypeAndDependencies() { - // See SchemaLoader::loadCompiledTypeAndDependencies(). - getLoader().loadCompiledTypeAndDependencies(); - } - -private: - struct Impl; - class ModuleImpl; - kj::Own impl; - mutable bool hadErrors = false; - - ModuleImpl& getModuleImpl(kj::Own&& file) const; - SchemaLoader& getLoader(); - - friend class ParsedSchema; -}; - -class ParsedSchema: public Schema { - // ParsedSchema is an extension of Schema which also has the ability to look up nested nodes - // by name. See `SchemaParser`. - -public: - inline ParsedSchema(): parser(nullptr) {} - - kj::Maybe findNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or returns null if there is no such nested - // declaration. - - ParsedSchema getNested(kj::StringPtr name) const; - // Gets the nested node with the given name, or throws an exception if there is no such nested - // declaration. - -private: - inline ParsedSchema(Schema inner, const SchemaParser& parser): Schema(inner), parser(&parser) {} - - const SchemaParser* parser; - friend class SchemaParser; -}; - -// ======================================================================================= -// Advanced API - -class SchemaFile { - // Abstract interface representing a schema file. You can implement this yourself in order to - // gain more control over how the compiler resolves imports and reads files. For the - // common case of files on disk or other global filesystem-like namespaces, use - // `SchemaFile::newDiskFile()`. - -public: - class FileReader { - public: - virtual bool exists(kj::StringPtr path) const = 0; - virtual kj::Array read(kj::StringPtr path) const = 0; - }; - - class DiskFileReader final: public FileReader { - // Implementation of FileReader that uses the local disk. Files are read using mmap() if - // possible. - - public: - static const DiskFileReader instance; - - bool exists(kj::StringPtr path) const override; - kj::Array read(kj::StringPtr path) const override; - }; - - static kj::Own newDiskFile( - kj::StringPtr displayName, kj::StringPtr diskPath, - kj::ArrayPtr importPath, - const FileReader& fileReader = DiskFileReader::instance); - // Construct a SchemaFile representing a file on disk (or located in the filesystem-like - // namespace represented by `fileReader`). - // - // Parameters: - // * `displayName`: The name that will appear in the file's schema node. - // * `diskPath`: The path to the file on disk. - // * `importPath`: Directories to search when resolving absolute imports within this file - // (imports that start with a `/`). The array content must remain valid as long as the - // SchemaFile exists (which is at least as long as the SchemaParser that parses it exists). - // * `fileReader`: Allows you to use a filesystem other than the actual local disk. Although, - // if you find yourself using this, it may make more sense for you to implement SchemaFile - // yourself. - // - // The SchemaFile compares equal to any other SchemaFile that has exactly the same disk path, - // after canonicalization. - // - // The SchemaFile will throw an exception if any errors are reported. - - // ----------------------------------------------------------------- - // For more control, you can implement this interface. - - virtual kj::StringPtr getDisplayName() const = 0; - // Get the file's name, as it should appear in the schema. - - virtual kj::Array readContent() const = 0; - // Read the file's entire content and return it as a byte array. - - virtual kj::Maybe> import(kj::StringPtr path) const = 0; - // Resolve an import, relative to this file. - // - // `path` is exactly what appears between quotes after the `import` keyword in the source code. - // It is entirely up to the `SchemaFile` to decide how to map this to another file. Typically, - // a leading '/' means that the file is an "absolute" path and is searched for in some list of - // schema file repositories. On the other hand, a path that doesn't start with '/' is relative - // to the importing file. - - virtual bool operator==(const SchemaFile& other) const = 0; - virtual bool operator!=(const SchemaFile& other) const = 0; - virtual size_t hashCode() const = 0; - // Compare two SchemaFiles to see if they refer to the same underlying file. This is an - // optimization used to avoid the need to re-parse a file to check its ID. - - struct SourcePos { - uint byte; - uint line; - uint column; - }; - virtual void reportError(SourcePos start, SourcePos end, kj::StringPtr message) const = 0; - // Report that the file contains an error at the given interval. - -private: - class DiskSchemaFile; -}; - -} // namespace capnp - -#endif // CAPNP_SCHEMA_PARSER_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp b/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp deleted file mode 100644 index 4bef693f6c..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp +++ /dev/null @@ -1,498 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -using Cxx = import "/capnp/c++.capnp"; - -@0xa93fc509624c72d9; -$Cxx.namespace("capnp::schema"); - -using Id = UInt64; -# The globally-unique ID of a file, type, or annotation. - -struct Node { - id @0 :Id; - - displayName @1 :Text; - # Name to present to humans to identify this Node. You should not attempt to parse this. Its - # format could change. It is not guaranteed to be unique. - # - # (On Zooko's triangle, this is the node's nickname.) - - displayNamePrefixLength @2 :UInt32; - # If you want a shorter version of `displayName` (just naming this node, without its surrounding - # scope), chop off this many characters from the beginning of `displayName`. - - scopeId @3 :Id; - # ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back - # at this node, but robust code should avoid relying on this (and, in fact, group nodes are not - # listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is - # zero if the node has no parent, which is normally only the case with files, but should be - # allowed for any kind of node (in order to make runtime type generation easier). - - parameters @32 :List(Parameter); - # If this node is parameterized (generic), the list of parameters. Empty for non-generic types. - - isGeneric @33 :Bool; - # True if this node is generic, meaning that it or one of its parent scopes has a non-empty - # `parameters`. - - struct Parameter { - # Information about one of the node's parameters. - - name @0 :Text; - } - - nestedNodes @4 :List(NestedNode); - # List of nodes nested within this node, along with the names under which they were declared. - - struct NestedNode { - name @0 :Text; - # Unqualified symbol name. Unlike Node.displayName, this *can* be used programmatically. - # - # (On Zooko's triangle, this is the node's petname according to its parent scope.) - - id @1 :Id; - # ID of the nested node. Typically, the target node's scopeId points back to this node, but - # robust code should avoid relying on this. - } - - annotations @5 :List(Annotation); - # Annotations applied to this node. - - union { - # Info specific to each kind of node. - - file @6 :Void; - - struct :group { - dataWordCount @7 :UInt16; - # Size of the data section, in words. - - pointerCount @8 :UInt16; - # Size of the pointer section, in pointers (which are one word each). - - preferredListEncoding @9 :ElementSize; - # The preferred element size to use when encoding a list of this struct. If this is anything - # other than `inlineComposite` then the struct is one word or less in size and is a candidate - # for list packing optimization. - - isGroup @10 :Bool; - # If true, then this "struct" node is actually not an independent node, but merely represents - # some named union or group within a particular parent struct. This node's scopeId refers - # to the parent struct, which may itself be a union/group in yet another struct. - # - # All group nodes share the same dataWordCount and pointerCount as the top-level - # struct, and their fields live in the same ordinal and offset spaces as all other fields in - # the struct. - # - # Note that a named union is considered a special kind of group -- in fact, a named union - # is exactly equivalent to a group that contains nothing but an unnamed union. - - discriminantCount @11 :UInt16; - # Number of fields in this struct which are members of an anonymous union, and thus may - # overlap. If this is non-zero, then a 16-bit discriminant is present indicating which - # of the overlapping fields is active. This can never be 1 -- if it is non-zero, it must be - # two or more. - # - # Note that the fields of an unnamed union are considered fields of the scope containing the - # union -- an unnamed union is not its own group. So, a top-level struct may contain a - # non-zero discriminant count. Named unions, on the other hand, are equivalent to groups - # containing unnamed unions. So, a named union has its own independent schema node, with - # `isGroup` = true. - - discriminantOffset @12 :UInt32; - # If `discriminantCount` is non-zero, this is the offset of the union discriminant, in - # multiples of 16 bits. - - fields @13 :List(Field); - # Fields defined within this scope (either the struct's top-level fields, or the fields of - # a particular group; see `isGroup`). - # - # The fields are sorted by ordinal number, but note that because groups share the same - # ordinal space, the field's index in this list is not necessarily exactly its ordinal. - # On the other hand, the field's position in this list does remain the same even as the - # protocol evolves, since it is not possible to insert or remove an earlier ordinal. - # Therefore, for most use cases, if you want to identify a field by number, it may make the - # most sense to use the field's index in this list rather than its ordinal. - } - - enum :group { - enumerants@14 :List(Enumerant); - # Enumerants ordered by numeric value (ordinal). - } - - interface :group { - methods @15 :List(Method); - # Methods ordered by ordinal. - - superclasses @31 :List(Superclass); - # Superclasses of this interface. - } - - const :group { - type @16 :Type; - value @17 :Value; - } - - annotation :group { - type @18 :Type; - - targetsFile @19 :Bool; - targetsConst @20 :Bool; - targetsEnum @21 :Bool; - targetsEnumerant @22 :Bool; - targetsStruct @23 :Bool; - targetsField @24 :Bool; - targetsUnion @25 :Bool; - targetsGroup @26 :Bool; - targetsInterface @27 :Bool; - targetsMethod @28 :Bool; - targetsParam @29 :Bool; - targetsAnnotation @30 :Bool; - } - } -} - -struct Field { - # Schema for a field of a struct. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Indicates where this member appeared in the code, relative to other members. - # Code ordering may have semantic relevance -- programmers tend to place related fields - # together. So, using code ordering makes sense in human-readable formats where ordering is - # otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum - # value is count(members) - 1. Fields that are members of a union are only ordered relative to - # the other members of that union, so the maximum value there is count(union.members). - - annotations @2 :List(Annotation); - - const noDiscriminant :UInt16 = 0xffff; - - discriminantValue @3 :UInt16 = Field.noDiscriminant; - # If the field is in a union, this is the value which the union's discriminant should take when - # the field is active. If the field is not in a union, this is 0xffff. - - union { - slot :group { - # A regular, non-group, non-fixed-list field. - - offset @4 :UInt32; - # Offset, in units of the field's size, from the beginning of the section in which the field - # resides. E.g. for a UInt32 field, multiply this by 4 to get the byte offset from the - # beginning of the data section. - - type @5 :Type; - defaultValue @6 :Value; - - hadExplicitDefault @10 :Bool; - # Whether the default value was specified explicitly. Non-explicit default values are always - # zero or empty values. Usually, whether the default value was explicit shouldn't matter. - # The main use case for this flag is for structs representing method parameters: - # explicitly-defaulted parameters may be allowed to be omitted when calling the method. - } - - group :group { - # A group. - - typeId @7 :Id; - # The ID of the group's node. - } - } - - ordinal :union { - implicit @8 :Void; - explicit @9 :UInt16; - # The original ordinal number given to the field. You probably should NOT use this; if you need - # a numeric identifier for a field, use its position within the field array for its scope. - # The ordinal is given here mainly just so that the original schema text can be reproduced given - # the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. - } -} - -struct Enumerant { - # Schema for member of an enum. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the enumerants were declared in the code. - # Like Struct.Field.codeOrder. - - annotations @2 :List(Annotation); -} - -struct Superclass { - id @0 :Id; - brand @1 :Brand; -} - -struct Method { - # Schema for method of an interface. - - name @0 :Text; - - codeOrder @1 :UInt16; - # Specifies order in which the methods were declared in the code. - # Like Struct.Field.codeOrder. - - implicitParameters @7 :List(Node.Parameter); - # The parameters listed in [] (typically, type / generic parameters), whose bindings are intended - # to be inferred rather than specified explicitly, although not all languages support this. - - paramStructType @2 :Id; - # ID of the parameter struct type. If a named parameter list was specified in the method - # declaration (rather than a single struct parameter type) then a corresponding struct type is - # auto-generated. Such an auto-generated type will not be listed in the interface's - # `nestedNodes` and its `scopeId` will be zero -- it is completely detached from the namespace. - # (Awkwardly, it does of course inherit generic parameters from the method's scope, which makes - # this a situation where you can't just climb the scope chain to find where a particular - # generic parameter was introduced. Making the `scopeId` zero was a mistake.) - - paramBrand @5 :Brand; - # Brand of param struct type. - - resultStructType @3 :Id; - # ID of the return struct type; similar to `paramStructType`. - - resultBrand @6 :Brand; - # Brand of result struct type. - - annotations @4 :List(Annotation); -} - -struct Type { - # Represents a type expression. - - union { - # The ordinals intentionally match those of Value. - - void @0 :Void; - bool @1 :Void; - int8 @2 :Void; - int16 @3 :Void; - int32 @4 :Void; - int64 @5 :Void; - uint8 @6 :Void; - uint16 @7 :Void; - uint32 @8 :Void; - uint64 @9 :Void; - float32 @10 :Void; - float64 @11 :Void; - text @12 :Void; - data @13 :Void; - - list :group { - elementType @14 :Type; - } - - enum :group { - typeId @15 :Id; - brand @21 :Brand; - } - struct :group { - typeId @16 :Id; - brand @22 :Brand; - } - interface :group { - typeId @17 :Id; - brand @23 :Brand; - } - - anyPointer :union { - unconstrained :union { - # A regular AnyPointer. - # - # The name "unconstrained" means as opposed to constraining it to match a type parameter. - # In retrospect this name is probably a poor choice given that it may still be constrained - # to be a struct, list, or capability. - - anyKind @18 :Void; # truly AnyPointer - struct @25 :Void; # AnyStruct - list @26 :Void; # AnyList - capability @27 :Void; # Capability - } - - parameter :group { - # This is actually a reference to a type parameter defined within this scope. - - scopeId @19 :Id; - # ID of the generic type whose parameter we're referencing. This should be a parent of the - # current scope. - - parameterIndex @20 :UInt16; - # Index of the parameter within the generic type's parameter list. - } - - implicitMethodParameter :group { - # This is actually a reference to an implicit (generic) parameter of a method. The only - # legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. - - parameterIndex @24 :UInt16; - } - } - } -} - -struct Brand { - # Specifies bindings for parameters of generics. Since these bindings turn a generic into a - # non-generic, we call it the "brand". - - scopes @0 :List(Scope); - # For each of the target type and each of its parent scopes, a parameterization may be included - # in this list. If no parameterization is included for a particular relevant scope, then either - # that scope has no parameters or all parameters should be considered to be `AnyPointer`. - - struct Scope { - scopeId @0 :Id; - # ID of the scope to which these params apply. - - union { - bind @1 :List(Binding); - # List of parameter bindings. - - inherit @2 :Void; - # The place where this Brand appears is actually within this scope or a sub-scope, - # and the bindings for this scope should be inherited from the reference point. - } - } - - struct Binding { - union { - unbound @0 :Void; - type @1 :Type; - - # TODO(someday): Allow non-type parameters? Unsure if useful. - } - } -} - -struct Value { - # Represents a value, e.g. a field default value, constant value, or annotation value. - - union { - # The ordinals intentionally match those of Type. - - void @0 :Void; - bool @1 :Bool; - int8 @2 :Int8; - int16 @3 :Int16; - int32 @4 :Int32; - int64 @5 :Int64; - uint8 @6 :UInt8; - uint16 @7 :UInt16; - uint32 @8 :UInt32; - uint64 @9 :UInt64; - float32 @10 :Float32; - float64 @11 :Float64; - text @12 :Text; - data @13 :Data; - - list @14 :AnyPointer; - - enum @15 :UInt16; - struct @16 :AnyPointer; - - interface @17 :Void; - # The only interface value that can be represented statically is "null", whose methods always - # throw exceptions. - - anyPointer @18 :AnyPointer; - } -} - -struct Annotation { - # Describes an annotation applied to a declaration. Note AnnotationNode describes the - # annotation's declaration, while this describes a use of the annotation. - - id @0 :Id; - # ID of the annotation node. - - brand @2 :Brand; - # Brand of the annotation. - # - # Note that the annotation itself is not allowed to be parameterized, but its scope might be. - - value @1 :Value; -} - -enum ElementSize { - # Possible element sizes for encoded lists. These correspond exactly to the possible values of - # the 3-bit element size component of a list pointer. - - empty @0; # aka "void", but that's a keyword. - bit @1; - byte @2; - twoBytes @3; - fourBytes @4; - eightBytes @5; - pointer @6; - inlineComposite @7; -} - -struct CapnpVersion { - major @0 :UInt16; - minor @1 :UInt8; - micro @2 :UInt8; -} - -struct CodeGeneratorRequest { - capnpVersion @2 :CapnpVersion; - # Version of the `capnp` executable. Generally, code generators should ignore this, but the code - # generators that ship with `capnp` itself will print a warning if this mismatches since that - # probably indicates something is misconfigured. - # - # The first version of 'capnp' to set this was 0.6.0. So, if it's missing, the compiler version - # is older than that. - - nodes @0 :List(Node); - # All nodes parsed by the compiler, including for the files on the command line and their - # imports. - - requestedFiles @1 :List(RequestedFile); - # Files which were listed on the command line. - - struct RequestedFile { - id @0 :Id; - # ID of the file. - - filename @1 :Text; - # Name of the file as it appeared on the command-line (minus the src-prefix). You may use - # this to decide where to write the output. - - imports @2 :List(Import); - # List of all imported paths seen in this file. - - struct Import { - id @0 :Id; - # ID of the imported file. - - name @1 :Text; - # Name which *this* file used to refer to the foreign file. This may be a relative name. - # This information is provided because it might be useful for code generation, e.g. to - # generate #include directives in C++. We don't put this in Node.file because this - # information is only meaningful at compile time anyway. - # - # (On Zooko's triangle, this is the import's petname according to the importing file.) - } - } -} diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp.h b/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp.h deleted file mode 100644 index 1f116c9f8f..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema.capnp.h +++ /dev/null @@ -1,7861 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: schema.capnp - -#ifndef CAPNP_INCLUDED_a93fc509624c72d9_ -#define CAPNP_INCLUDED_a93fc509624c72d9_ - -#include - -#if CAPNP_VERSION != 6001 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(e682ab4cf923a417); -CAPNP_DECLARE_SCHEMA(b9521bccf10fa3b1); -CAPNP_DECLARE_SCHEMA(debf55bbfa0fc242); -CAPNP_DECLARE_SCHEMA(9ea0b19b37fb4435); -CAPNP_DECLARE_SCHEMA(b54ab3364333f598); -CAPNP_DECLARE_SCHEMA(e82753cff0c2218f); -CAPNP_DECLARE_SCHEMA(b18aa5ac7a0d9420); -CAPNP_DECLARE_SCHEMA(ec1619d4400a0290); -CAPNP_DECLARE_SCHEMA(9aad50a41f4af45f); -CAPNP_DECLARE_SCHEMA(97b14cbe7cfec712); -CAPNP_DECLARE_SCHEMA(c42305476bb4746f); -CAPNP_DECLARE_SCHEMA(cafccddb68db1d11); -CAPNP_DECLARE_SCHEMA(bb90d5c287870be6); -CAPNP_DECLARE_SCHEMA(978a7cebdc549a4d); -CAPNP_DECLARE_SCHEMA(a9962a9ed0a4d7f8); -CAPNP_DECLARE_SCHEMA(9500cce23b334d80); -CAPNP_DECLARE_SCHEMA(d07378ede1f9cc60); -CAPNP_DECLARE_SCHEMA(87e739250a60ea97); -CAPNP_DECLARE_SCHEMA(9e0e78711a7f87a9); -CAPNP_DECLARE_SCHEMA(ac3a6f60ef4cc6d3); -CAPNP_DECLARE_SCHEMA(ed8bca69f7fb0cbf); -CAPNP_DECLARE_SCHEMA(c2573fe8a23e49f1); -CAPNP_DECLARE_SCHEMA(8e3b5f79fe593656); -CAPNP_DECLARE_SCHEMA(9dd1f724f4614a85); -CAPNP_DECLARE_SCHEMA(baefc9120c56e274); -CAPNP_DECLARE_SCHEMA(903455f06065422b); -CAPNP_DECLARE_SCHEMA(abd73485a9636bc9); -CAPNP_DECLARE_SCHEMA(c863cd16969ee7fc); -CAPNP_DECLARE_SCHEMA(ce23dcd2d7b00c9b); -CAPNP_DECLARE_SCHEMA(f1c8950dab257542); -CAPNP_DECLARE_SCHEMA(d1958f7dba521926); -enum class ElementSize_d1958f7dba521926: uint16_t { - EMPTY, - BIT, - BYTE, - TWO_BYTES, - FOUR_BYTES, - EIGHT_BYTES, - POINTER, - INLINE_COMPOSITE, -}; -CAPNP_DECLARE_ENUM(ElementSize, d1958f7dba521926); -CAPNP_DECLARE_SCHEMA(d85d305b7d839963); -CAPNP_DECLARE_SCHEMA(bfc546f6210ad7ce); -CAPNP_DECLARE_SCHEMA(cfea0eb02e810062); -CAPNP_DECLARE_SCHEMA(ae504193122357e5); - -} // namespace schemas -} // namespace capnp - -namespace capnp { -namespace schema { - -struct Node { - Node() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - FILE, - STRUCT, - ENUM, - INTERFACE, - CONST, - ANNOTATION, - }; - struct Parameter; - struct NestedNode; - struct Struct; - struct Enum; - struct Interface; - struct Const; - struct Annotation; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e682ab4cf923a417, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b9521bccf10fa3b1, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::NestedNode { - NestedNode() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(debf55bbfa0fc242, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9ea0b19b37fb4435, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b54ab3364333f598, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(e82753cff0c2218f, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Const { - Const() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b18aa5ac7a0d9420, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Node::Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ec1619d4400a0290, 5, 6) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field { - Field() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - SLOT, - GROUP, - }; - static constexpr ::uint16_t NO_DISCRIMINANT = 65535u; - struct Slot; - struct Group; - struct Ordinal; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9aad50a41f4af45f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Slot { - Slot() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c42305476bb4746f, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Group { - Group() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cafccddb68db1d11, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Field::Ordinal { - Ordinal() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - IMPLICIT, - EXPLICIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bb90d5c287870be6, 3, 4) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Enumerant { - Enumerant() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(978a7cebdc549a4d, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Superclass { - Superclass() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(a9962a9ed0a4d7f8, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Method { - Method() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9500cce23b334d80, 3, 5) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type { - Type() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - struct List; - struct Enum; - struct Struct; - struct Interface; - struct AnyPointer; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d07378ede1f9cc60, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::List { - List() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(87e739250a60ea97, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Enum { - Enum() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9e0e78711a7f87a9, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Struct { - Struct() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ac3a6f60ef4cc6d3, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::Interface { - Interface() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ed8bca69f7fb0cbf, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer { - AnyPointer() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNCONSTRAINED, - PARAMETER, - IMPLICIT_METHOD_PARAMETER, - }; - struct Unconstrained; - struct Parameter; - struct ImplicitMethodParameter; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c2573fe8a23e49f1, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Unconstrained { - Unconstrained() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - ANY_KIND, - STRUCT, - LIST, - CAPABILITY, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(8e3b5f79fe593656, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::Parameter { - Parameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(9dd1f724f4614a85, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Type::AnyPointer::ImplicitMethodParameter { - ImplicitMethodParameter() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(baefc9120c56e274, 3, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand { - Brand() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Scope; - struct Binding; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(903455f06065422b, 0, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Scope { - Scope() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - BIND, - INHERIT, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(abd73485a9636bc9, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Brand::Binding { - Binding() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - UNBOUND, - TYPE, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(c863cd16969ee7fc, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Value { - Value() = delete; - - class Reader; - class Builder; - class Pipeline; - enum Which: uint16_t { - VOID, - BOOL, - INT8, - INT16, - INT32, - INT64, - UINT8, - UINT16, - UINT32, - UINT64, - FLOAT32, - FLOAT64, - TEXT, - DATA, - LIST, - ENUM, - STRUCT, - INTERFACE, - ANY_POINTER, - }; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ce23dcd2d7b00c9b, 2, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct Annotation { - Annotation() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(f1c8950dab257542, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -typedef ::capnp::schemas::ElementSize_d1958f7dba521926 ElementSize; - -struct CapnpVersion { - CapnpVersion() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(d85d305b7d839963, 1, 0) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest { - CodeGeneratorRequest() = delete; - - class Reader; - class Builder; - class Pipeline; - struct RequestedFile; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(bfc546f6210ad7ce, 0, 3) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile { - RequestedFile() = delete; - - class Reader; - class Builder; - class Pipeline; - struct Import; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(cfea0eb02e810062, 1, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -struct CodeGeneratorRequest::RequestedFile::Import { - Import() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(ae504193122357e5, 1, 1) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Node::Reader { -public: - typedef Node Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getId() const; - - inline bool hasDisplayName() const; - inline ::capnp::Text::Reader getDisplayName() const; - - inline ::uint32_t getDisplayNamePrefixLength() const; - - inline ::uint64_t getScopeId() const; - - inline bool hasNestedNodes() const; - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader getNestedNodes() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool isFile() const; - inline ::capnp::Void getFile() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isConst() const; - inline typename Const::Reader getConst() const; - - inline bool isAnnotation() const; - inline typename Annotation::Reader getAnnotation() const; - - inline bool hasParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getParameters() const; - - inline bool getIsGeneric() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Builder { -public: - typedef Node Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasDisplayName(); - inline ::capnp::Text::Builder getDisplayName(); - inline void setDisplayName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initDisplayName(unsigned int size); - inline void adoptDisplayName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownDisplayName(); - - inline ::uint32_t getDisplayNamePrefixLength(); - inline void setDisplayNamePrefixLength( ::uint32_t value); - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool hasNestedNodes(); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder getNestedNodes(); - inline void setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder initNestedNodes(unsigned int size); - inline void adoptNestedNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> disownNestedNodes(); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool isFile(); - inline ::capnp::Void getFile(); - inline void setFile( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isConst(); - inline typename Const::Builder getConst(); - inline typename Const::Builder initConst(); - - inline bool isAnnotation(); - inline typename Annotation::Builder getAnnotation(); - inline typename Annotation::Builder initAnnotation(); - - inline bool hasParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getParameters(); - inline void setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initParameters(unsigned int size); - inline void adoptParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownParameters(); - - inline bool getIsGeneric(); - inline void setIsGeneric(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Pipeline { -public: - typedef Node Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::NestedNode::Reader { -public: - typedef NestedNode Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint64_t getId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::NestedNode::Builder { -public: - typedef NestedNode Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::NestedNode::Pipeline { -public: - typedef NestedNode Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount() const; - - inline ::uint16_t getPointerCount() const; - - inline ::capnp::schema::ElementSize getPreferredListEncoding() const; - - inline bool getIsGroup() const; - - inline ::uint16_t getDiscriminantCount() const; - - inline ::uint32_t getDiscriminantOffset() const; - - inline bool hasFields() const; - inline ::capnp::List< ::capnp::schema::Field>::Reader getFields() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getDataWordCount(); - inline void setDataWordCount( ::uint16_t value); - - inline ::uint16_t getPointerCount(); - inline void setPointerCount( ::uint16_t value); - - inline ::capnp::schema::ElementSize getPreferredListEncoding(); - inline void setPreferredListEncoding( ::capnp::schema::ElementSize value); - - inline bool getIsGroup(); - inline void setIsGroup(bool value); - - inline ::uint16_t getDiscriminantCount(); - inline void setDiscriminantCount( ::uint16_t value); - - inline ::uint32_t getDiscriminantOffset(); - inline void setDiscriminantOffset( ::uint32_t value); - - inline bool hasFields(); - inline ::capnp::List< ::capnp::schema::Field>::Builder getFields(); - inline void setFields( ::capnp::List< ::capnp::schema::Field>::Reader value); - inline ::capnp::List< ::capnp::schema::Field>::Builder initFields(unsigned int size); - inline void adoptFields(::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> disownFields(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasEnumerants() const; - inline ::capnp::List< ::capnp::schema::Enumerant>::Reader getEnumerants() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasEnumerants(); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder getEnumerants(); - inline void setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value); - inline ::capnp::List< ::capnp::schema::Enumerant>::Builder initEnumerants(unsigned int size); - inline void adoptEnumerants(::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> disownEnumerants(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasMethods() const; - inline ::capnp::List< ::capnp::schema::Method>::Reader getMethods() const; - - inline bool hasSuperclasses() const; - inline ::capnp::List< ::capnp::schema::Superclass>::Reader getSuperclasses() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasMethods(); - inline ::capnp::List< ::capnp::schema::Method>::Builder getMethods(); - inline void setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value); - inline ::capnp::List< ::capnp::schema::Method>::Builder initMethods(unsigned int size); - inline void adoptMethods(::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> disownMethods(); - - inline bool hasSuperclasses(); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder getSuperclasses(); - inline void setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value); - inline ::capnp::List< ::capnp::schema::Superclass>::Builder initSuperclasses(unsigned int size); - inline void adoptSuperclasses(::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> disownSuperclasses(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Const::Reader { -public: - typedef Const Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Const::Builder { -public: - typedef Const Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Const::Pipeline { -public: - typedef Const Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Node::Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool getTargetsFile() const; - - inline bool getTargetsConst() const; - - inline bool getTargetsEnum() const; - - inline bool getTargetsEnumerant() const; - - inline bool getTargetsStruct() const; - - inline bool getTargetsField() const; - - inline bool getTargetsUnion() const; - - inline bool getTargetsGroup() const; - - inline bool getTargetsInterface() const; - - inline bool getTargetsMethod() const; - - inline bool getTargetsParam() const; - - inline bool getTargetsAnnotation() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Node::Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool getTargetsFile(); - inline void setTargetsFile(bool value); - - inline bool getTargetsConst(); - inline void setTargetsConst(bool value); - - inline bool getTargetsEnum(); - inline void setTargetsEnum(bool value); - - inline bool getTargetsEnumerant(); - inline void setTargetsEnumerant(bool value); - - inline bool getTargetsStruct(); - inline void setTargetsStruct(bool value); - - inline bool getTargetsField(); - inline void setTargetsField(bool value); - - inline bool getTargetsUnion(); - inline void setTargetsUnion(bool value); - - inline bool getTargetsGroup(); - inline void setTargetsGroup(bool value); - - inline bool getTargetsInterface(); - inline void setTargetsInterface(bool value); - - inline bool getTargetsMethod(); - inline void setTargetsMethod(bool value); - - inline bool getTargetsParam(); - inline void setTargetsParam(bool value); - - inline bool getTargetsAnnotation(); - inline void setTargetsAnnotation(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Node::Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Reader { -public: - typedef Field Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline ::uint16_t getDiscriminantValue() const; - - inline bool isSlot() const; - inline typename Slot::Reader getSlot() const; - - inline bool isGroup() const; - inline typename Group::Reader getGroup() const; - - inline typename Ordinal::Reader getOrdinal() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Builder { -public: - typedef Field Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline ::uint16_t getDiscriminantValue(); - inline void setDiscriminantValue( ::uint16_t value); - - inline bool isSlot(); - inline typename Slot::Builder getSlot(); - inline typename Slot::Builder initSlot(); - - inline bool isGroup(); - inline typename Group::Builder getGroup(); - inline typename Group::Builder initGroup(); - - inline typename Ordinal::Builder getOrdinal(); - inline typename Ordinal::Builder initOrdinal(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Pipeline { -public: - typedef Field Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline typename Ordinal::Pipeline getOrdinal(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Slot::Reader { -public: - typedef Slot Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset() const; - - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - - inline bool hasDefaultValue() const; - inline ::capnp::schema::Value::Reader getDefaultValue() const; - - inline bool getHadExplicitDefault() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Slot::Builder { -public: - typedef Slot Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint32_t getOffset(); - inline void setOffset( ::uint32_t value); - - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - - inline bool hasDefaultValue(); - inline ::capnp::schema::Value::Builder getDefaultValue(); - inline void setDefaultValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initDefaultValue(); - inline void adoptDefaultValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownDefaultValue(); - - inline bool getHadExplicitDefault(); - inline void setHadExplicitDefault(bool value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Slot::Pipeline { -public: - typedef Slot Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getType(); - inline ::capnp::schema::Value::Pipeline getDefaultValue(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Group::Reader { -public: - typedef Group Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Group::Builder { -public: - typedef Group Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Group::Pipeline { -public: - typedef Group Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Field::Ordinal::Reader { -public: - typedef Ordinal Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isImplicit() const; - inline ::capnp::Void getImplicit() const; - - inline bool isExplicit() const; - inline ::uint16_t getExplicit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Field::Ordinal::Builder { -public: - typedef Ordinal Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isImplicit(); - inline ::capnp::Void getImplicit(); - inline void setImplicit( ::capnp::Void value = ::capnp::VOID); - - inline bool isExplicit(); - inline ::uint16_t getExplicit(); - inline void setExplicit( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Field::Ordinal::Pipeline { -public: - typedef Ordinal Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Enumerant::Reader { -public: - typedef Enumerant Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Enumerant::Builder { -public: - typedef Enumerant Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Enumerant::Pipeline { -public: - typedef Enumerant Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Superclass::Reader { -public: - typedef Superclass Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Superclass::Builder { -public: - typedef Superclass Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Superclass::Pipeline { -public: - typedef Superclass Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Method::Reader { -public: - typedef Method Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - - inline ::uint16_t getCodeOrder() const; - - inline ::uint64_t getParamStructType() const; - - inline ::uint64_t getResultStructType() const; - - inline bool hasAnnotations() const; - inline ::capnp::List< ::capnp::schema::Annotation>::Reader getAnnotations() const; - - inline bool hasParamBrand() const; - inline ::capnp::schema::Brand::Reader getParamBrand() const; - - inline bool hasResultBrand() const; - inline ::capnp::schema::Brand::Reader getResultBrand() const; - - inline bool hasImplicitParameters() const; - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader getImplicitParameters() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Method::Builder { -public: - typedef Method Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - - inline ::uint16_t getCodeOrder(); - inline void setCodeOrder( ::uint16_t value); - - inline ::uint64_t getParamStructType(); - inline void setParamStructType( ::uint64_t value); - - inline ::uint64_t getResultStructType(); - inline void setResultStructType( ::uint64_t value); - - inline bool hasAnnotations(); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder getAnnotations(); - inline void setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value); - inline ::capnp::List< ::capnp::schema::Annotation>::Builder initAnnotations(unsigned int size); - inline void adoptAnnotations(::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> disownAnnotations(); - - inline bool hasParamBrand(); - inline ::capnp::schema::Brand::Builder getParamBrand(); - inline void setParamBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initParamBrand(); - inline void adoptParamBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownParamBrand(); - - inline bool hasResultBrand(); - inline ::capnp::schema::Brand::Builder getResultBrand(); - inline void setResultBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initResultBrand(); - inline void adoptResultBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownResultBrand(); - - inline bool hasImplicitParameters(); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder getImplicitParameters(); - inline void setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value); - inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder initImplicitParameters(unsigned int size); - inline void adoptImplicitParameters(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> disownImplicitParameters(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Method::Pipeline { -public: - typedef Method Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getParamBrand(); - inline ::capnp::schema::Brand::Pipeline getResultBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Reader { -public: - typedef Type Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline ::capnp::Void getBool() const; - - inline bool isInt8() const; - inline ::capnp::Void getInt8() const; - - inline bool isInt16() const; - inline ::capnp::Void getInt16() const; - - inline bool isInt32() const; - inline ::capnp::Void getInt32() const; - - inline bool isInt64() const; - inline ::capnp::Void getInt64() const; - - inline bool isUint8() const; - inline ::capnp::Void getUint8() const; - - inline bool isUint16() const; - inline ::capnp::Void getUint16() const; - - inline bool isUint32() const; - inline ::capnp::Void getUint32() const; - - inline bool isUint64() const; - inline ::capnp::Void getUint64() const; - - inline bool isFloat32() const; - inline ::capnp::Void getFloat32() const; - - inline bool isFloat64() const; - inline ::capnp::Void getFloat64() const; - - inline bool isText() const; - inline ::capnp::Void getText() const; - - inline bool isData() const; - inline ::capnp::Void getData() const; - - inline bool isList() const; - inline typename List::Reader getList() const; - - inline bool isEnum() const; - inline typename Enum::Reader getEnum() const; - - inline bool isStruct() const; - inline typename Struct::Reader getStruct() const; - - inline bool isInterface() const; - inline typename Interface::Reader getInterface() const; - - inline bool isAnyPointer() const; - inline typename AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Builder { -public: - typedef Type Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline ::capnp::Void getBool(); - inline void setBool( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt8(); - inline ::capnp::Void getInt8(); - inline void setInt8( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt16(); - inline ::capnp::Void getInt16(); - inline void setInt16( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt32(); - inline ::capnp::Void getInt32(); - inline void setInt32( ::capnp::Void value = ::capnp::VOID); - - inline bool isInt64(); - inline ::capnp::Void getInt64(); - inline void setInt64( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint8(); - inline ::capnp::Void getUint8(); - inline void setUint8( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint16(); - inline ::capnp::Void getUint16(); - inline void setUint16( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint32(); - inline ::capnp::Void getUint32(); - inline void setUint32( ::capnp::Void value = ::capnp::VOID); - - inline bool isUint64(); - inline ::capnp::Void getUint64(); - inline void setUint64( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat32(); - inline ::capnp::Void getFloat32(); - inline void setFloat32( ::capnp::Void value = ::capnp::VOID); - - inline bool isFloat64(); - inline ::capnp::Void getFloat64(); - inline void setFloat64( ::capnp::Void value = ::capnp::VOID); - - inline bool isText(); - inline ::capnp::Void getText(); - inline void setText( ::capnp::Void value = ::capnp::VOID); - - inline bool isData(); - inline ::capnp::Void getData(); - inline void setData( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline typename List::Builder getList(); - inline typename List::Builder initList(); - - inline bool isEnum(); - inline typename Enum::Builder getEnum(); - inline typename Enum::Builder initEnum(); - - inline bool isStruct(); - inline typename Struct::Builder getStruct(); - inline typename Struct::Builder initStruct(); - - inline bool isInterface(); - inline typename Interface::Builder getInterface(); - inline typename Interface::Builder initInterface(); - - inline bool isAnyPointer(); - inline typename AnyPointer::Builder getAnyPointer(); - inline typename AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Pipeline { -public: - typedef Type Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::List::Reader { -public: - typedef List Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasElementType() const; - inline ::capnp::schema::Type::Reader getElementType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::List::Builder { -public: - typedef List Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasElementType(); - inline ::capnp::schema::Type::Builder getElementType(); - inline void setElementType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initElementType(); - inline void adoptElementType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownElementType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::List::Pipeline { -public: - typedef List Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Type::Pipeline getElementType(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Enum::Reader { -public: - typedef Enum Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Enum::Builder { -public: - typedef Enum Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Enum::Pipeline { -public: - typedef Enum Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Struct::Reader { -public: - typedef Struct Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Struct::Builder { -public: - typedef Struct Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Struct::Pipeline { -public: - typedef Struct Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::Interface::Reader { -public: - typedef Interface Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::Interface::Builder { -public: - typedef Interface Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getTypeId(); - inline void setTypeId( ::uint64_t value); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::Interface::Pipeline { -public: - typedef Interface Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Reader { -public: - typedef AnyPointer Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnconstrained() const; - inline typename Unconstrained::Reader getUnconstrained() const; - - inline bool isParameter() const; - inline typename Parameter::Reader getParameter() const; - - inline bool isImplicitMethodParameter() const; - inline typename ImplicitMethodParameter::Reader getImplicitMethodParameter() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Builder { -public: - typedef AnyPointer Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnconstrained(); - inline typename Unconstrained::Builder getUnconstrained(); - inline typename Unconstrained::Builder initUnconstrained(); - - inline bool isParameter(); - inline typename Parameter::Builder getParameter(); - inline typename Parameter::Builder initParameter(); - - inline bool isImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder getImplicitMethodParameter(); - inline typename ImplicitMethodParameter::Builder initImplicitMethodParameter(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Pipeline { -public: - typedef AnyPointer Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Unconstrained::Reader { -public: - typedef Unconstrained Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isAnyKind() const; - inline ::capnp::Void getAnyKind() const; - - inline bool isStruct() const; - inline ::capnp::Void getStruct() const; - - inline bool isList() const; - inline ::capnp::Void getList() const; - - inline bool isCapability() const; - inline ::capnp::Void getCapability() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Unconstrained::Builder { -public: - typedef Unconstrained Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isAnyKind(); - inline ::capnp::Void getAnyKind(); - inline void setAnyKind( ::capnp::Void value = ::capnp::VOID); - - inline bool isStruct(); - inline ::capnp::Void getStruct(); - inline void setStruct( ::capnp::Void value = ::capnp::VOID); - - inline bool isList(); - inline ::capnp::Void getList(); - inline void setList( ::capnp::Void value = ::capnp::VOID); - - inline bool isCapability(); - inline ::capnp::Void getCapability(); - inline void setCapability( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Unconstrained::Pipeline { -public: - typedef Unconstrained Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::Parameter::Reader { -public: - typedef Parameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId() const; - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::Parameter::Builder { -public: - typedef Parameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::Parameter::Pipeline { -public: - typedef Parameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Type::AnyPointer::ImplicitMethodParameter::Reader { -public: - typedef ImplicitMethodParameter Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Type::AnyPointer::ImplicitMethodParameter::Builder { -public: - typedef ImplicitMethodParameter Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getParameterIndex(); - inline void setParameterIndex( ::uint16_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Type::AnyPointer::ImplicitMethodParameter::Pipeline { -public: - typedef ImplicitMethodParameter Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Reader { -public: - typedef Brand Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasScopes() const; - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader getScopes() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Builder { -public: - typedef Brand Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasScopes(); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder getScopes(); - inline void setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder initScopes(unsigned int size); - inline void adoptScopes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> disownScopes(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Pipeline { -public: - typedef Brand Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Scope::Reader { -public: - typedef Scope Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline ::uint64_t getScopeId() const; - - inline bool isBind() const; - inline bool hasBind() const; - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader getBind() const; - - inline bool isInherit() const; - inline ::capnp::Void getInherit() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Scope::Builder { -public: - typedef Scope Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline ::uint64_t getScopeId(); - inline void setScopeId( ::uint64_t value); - - inline bool isBind(); - inline bool hasBind(); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder getBind(); - inline void setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value); - inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder initBind(unsigned int size); - inline void adoptBind(::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> disownBind(); - - inline bool isInherit(); - inline ::capnp::Void getInherit(); - inline void setInherit( ::capnp::Void value = ::capnp::VOID); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Scope::Pipeline { -public: - typedef Scope Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Brand::Binding::Reader { -public: - typedef Binding Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isUnbound() const; - inline ::capnp::Void getUnbound() const; - - inline bool isType() const; - inline bool hasType() const; - inline ::capnp::schema::Type::Reader getType() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Brand::Binding::Builder { -public: - typedef Binding Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isUnbound(); - inline ::capnp::Void getUnbound(); - inline void setUnbound( ::capnp::Void value = ::capnp::VOID); - - inline bool isType(); - inline bool hasType(); - inline ::capnp::schema::Type::Builder getType(); - inline void setType( ::capnp::schema::Type::Reader value); - inline ::capnp::schema::Type::Builder initType(); - inline void adoptType(::capnp::Orphan< ::capnp::schema::Type>&& value); - inline ::capnp::Orphan< ::capnp::schema::Type> disownType(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Brand::Binding::Pipeline { -public: - typedef Binding Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Value::Reader { -public: - typedef Value Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline Which which() const; - inline bool isVoid() const; - inline ::capnp::Void getVoid() const; - - inline bool isBool() const; - inline bool getBool() const; - - inline bool isInt8() const; - inline ::int8_t getInt8() const; - - inline bool isInt16() const; - inline ::int16_t getInt16() const; - - inline bool isInt32() const; - inline ::int32_t getInt32() const; - - inline bool isInt64() const; - inline ::int64_t getInt64() const; - - inline bool isUint8() const; - inline ::uint8_t getUint8() const; - - inline bool isUint16() const; - inline ::uint16_t getUint16() const; - - inline bool isUint32() const; - inline ::uint32_t getUint32() const; - - inline bool isUint64() const; - inline ::uint64_t getUint64() const; - - inline bool isFloat32() const; - inline float getFloat32() const; - - inline bool isFloat64() const; - inline double getFloat64() const; - - inline bool isText() const; - inline bool hasText() const; - inline ::capnp::Text::Reader getText() const; - - inline bool isData() const; - inline bool hasData() const; - inline ::capnp::Data::Reader getData() const; - - inline bool isList() const; - inline bool hasList() const; - inline ::capnp::AnyPointer::Reader getList() const; - - inline bool isEnum() const; - inline ::uint16_t getEnum() const; - - inline bool isStruct() const; - inline bool hasStruct() const; - inline ::capnp::AnyPointer::Reader getStruct() const; - - inline bool isInterface() const; - inline ::capnp::Void getInterface() const; - - inline bool isAnyPointer() const; - inline bool hasAnyPointer() const; - inline ::capnp::AnyPointer::Reader getAnyPointer() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Value::Builder { -public: - typedef Value Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline Which which(); - inline bool isVoid(); - inline ::capnp::Void getVoid(); - inline void setVoid( ::capnp::Void value = ::capnp::VOID); - - inline bool isBool(); - inline bool getBool(); - inline void setBool(bool value); - - inline bool isInt8(); - inline ::int8_t getInt8(); - inline void setInt8( ::int8_t value); - - inline bool isInt16(); - inline ::int16_t getInt16(); - inline void setInt16( ::int16_t value); - - inline bool isInt32(); - inline ::int32_t getInt32(); - inline void setInt32( ::int32_t value); - - inline bool isInt64(); - inline ::int64_t getInt64(); - inline void setInt64( ::int64_t value); - - inline bool isUint8(); - inline ::uint8_t getUint8(); - inline void setUint8( ::uint8_t value); - - inline bool isUint16(); - inline ::uint16_t getUint16(); - inline void setUint16( ::uint16_t value); - - inline bool isUint32(); - inline ::uint32_t getUint32(); - inline void setUint32( ::uint32_t value); - - inline bool isUint64(); - inline ::uint64_t getUint64(); - inline void setUint64( ::uint64_t value); - - inline bool isFloat32(); - inline float getFloat32(); - inline void setFloat32(float value); - - inline bool isFloat64(); - inline double getFloat64(); - inline void setFloat64(double value); - - inline bool isText(); - inline bool hasText(); - inline ::capnp::Text::Builder getText(); - inline void setText( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initText(unsigned int size); - inline void adoptText(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownText(); - - inline bool isData(); - inline bool hasData(); - inline ::capnp::Data::Builder getData(); - inline void setData( ::capnp::Data::Reader value); - inline ::capnp::Data::Builder initData(unsigned int size); - inline void adoptData(::capnp::Orphan< ::capnp::Data>&& value); - inline ::capnp::Orphan< ::capnp::Data> disownData(); - - inline bool isList(); - inline bool hasList(); - inline ::capnp::AnyPointer::Builder getList(); - inline ::capnp::AnyPointer::Builder initList(); - - inline bool isEnum(); - inline ::uint16_t getEnum(); - inline void setEnum( ::uint16_t value); - - inline bool isStruct(); - inline bool hasStruct(); - inline ::capnp::AnyPointer::Builder getStruct(); - inline ::capnp::AnyPointer::Builder initStruct(); - - inline bool isInterface(); - inline ::capnp::Void getInterface(); - inline void setInterface( ::capnp::Void value = ::capnp::VOID); - - inline bool isAnyPointer(); - inline bool hasAnyPointer(); - inline ::capnp::AnyPointer::Builder getAnyPointer(); - inline ::capnp::AnyPointer::Builder initAnyPointer(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Value::Pipeline { -public: - typedef Value Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class Annotation::Reader { -public: - typedef Annotation Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasValue() const; - inline ::capnp::schema::Value::Reader getValue() const; - - inline bool hasBrand() const; - inline ::capnp::schema::Brand::Reader getBrand() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Annotation::Builder { -public: - typedef Annotation Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasValue(); - inline ::capnp::schema::Value::Builder getValue(); - inline void setValue( ::capnp::schema::Value::Reader value); - inline ::capnp::schema::Value::Builder initValue(); - inline void adoptValue(::capnp::Orphan< ::capnp::schema::Value>&& value); - inline ::capnp::Orphan< ::capnp::schema::Value> disownValue(); - - inline bool hasBrand(); - inline ::capnp::schema::Brand::Builder getBrand(); - inline void setBrand( ::capnp::schema::Brand::Reader value); - inline ::capnp::schema::Brand::Builder initBrand(); - inline void adoptBrand(::capnp::Orphan< ::capnp::schema::Brand>&& value); - inline ::capnp::Orphan< ::capnp::schema::Brand> disownBrand(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Annotation::Pipeline { -public: - typedef Annotation Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::Value::Pipeline getValue(); - inline ::capnp::schema::Brand::Pipeline getBrand(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CapnpVersion::Reader { -public: - typedef CapnpVersion Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor() const; - - inline ::uint8_t getMinor() const; - - inline ::uint8_t getMicro() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CapnpVersion::Builder { -public: - typedef CapnpVersion Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint16_t getMajor(); - inline void setMajor( ::uint16_t value); - - inline ::uint8_t getMinor(); - inline void setMinor( ::uint8_t value); - - inline ::uint8_t getMicro(); - inline void setMicro( ::uint8_t value); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CapnpVersion::Pipeline { -public: - typedef CapnpVersion Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::Reader { -public: - typedef CodeGeneratorRequest Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasNodes() const; - inline ::capnp::List< ::capnp::schema::Node>::Reader getNodes() const; - - inline bool hasRequestedFiles() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader getRequestedFiles() const; - - inline bool hasCapnpVersion() const; - inline ::capnp::schema::CapnpVersion::Reader getCapnpVersion() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::Builder { -public: - typedef CodeGeneratorRequest Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasNodes(); - inline ::capnp::List< ::capnp::schema::Node>::Builder getNodes(); - inline void setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value); - inline ::capnp::List< ::capnp::schema::Node>::Builder initNodes(unsigned int size); - inline void adoptNodes(::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> disownNodes(); - - inline bool hasRequestedFiles(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder getRequestedFiles(); - inline void setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder initRequestedFiles(unsigned int size); - inline void adoptRequestedFiles(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> disownRequestedFiles(); - - inline bool hasCapnpVersion(); - inline ::capnp::schema::CapnpVersion::Builder getCapnpVersion(); - inline void setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value); - inline ::capnp::schema::CapnpVersion::Builder initCapnpVersion(); - inline void adoptCapnpVersion(::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value); - inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> disownCapnpVersion(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::Pipeline { -public: - typedef CodeGeneratorRequest Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - - inline ::capnp::schema::CapnpVersion::Pipeline getCapnpVersion(); -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Reader { -public: - typedef RequestedFile Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasFilename() const; - inline ::capnp::Text::Reader getFilename() const; - - inline bool hasImports() const; - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader getImports() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Builder { -public: - typedef RequestedFile Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasFilename(); - inline ::capnp::Text::Builder getFilename(); - inline void setFilename( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initFilename(unsigned int size); - inline void adoptFilename(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownFilename(); - - inline bool hasImports(); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder getImports(); - inline void setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value); - inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder initImports(unsigned int size); - inline void adoptImports(::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> disownImports(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Pipeline { -public: - typedef RequestedFile Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -class CodeGeneratorRequest::RequestedFile::Import::Reader { -public: - typedef Import Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline ::uint64_t getId() const; - - inline bool hasName() const; - inline ::capnp::Text::Reader getName() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class CodeGeneratorRequest::RequestedFile::Import::Builder { -public: - typedef Import Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline ::uint64_t getId(); - inline void setId( ::uint64_t value); - - inline bool hasName(); - inline ::capnp::Text::Builder getName(); - inline void setName( ::capnp::Text::Reader value); - inline ::capnp::Text::Builder initName(unsigned int size); - inline void adoptName(::capnp::Orphan< ::capnp::Text>&& value); - inline ::capnp::Orphan< ::capnp::Text> disownName(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class CodeGeneratorRequest::RequestedFile::Import::Pipeline { -public: - typedef Import Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline ::capnp::schema::Node::Which Node::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Node::Which Node::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasDisplayName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasDisplayName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Reader::getDisplayName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Builder::getDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setDisplayName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Builder::initDisplayName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptDisplayName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Builder::disownDisplayName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint32_t Node::Reader::getDisplayNamePrefixLength() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Builder::getDisplayNamePrefixLength() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setDisplayNamePrefixLength( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Node::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::hasNestedNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasNestedNodes() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader Node::Reader::getNestedNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::getNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setNestedNodes( ::capnp::List< ::capnp::schema::Node::NestedNode>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::NestedNode>::Builder Node::Builder::initNestedNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptNestedNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::NestedNode>> Node::Builder::disownNestedNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::NestedNode>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Node::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Node::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Node::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::isFile() const { - return which() == Node::FILE; -} -inline bool Node::Builder::isFile() { - return which() == Node::FILE; -} -inline ::capnp::Void Node::Reader::getFile() const { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Node::Builder::getFile() { - KJ_IREQUIRE((which() == Node::FILE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setFile( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::FILE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Reader::isStruct() const { - return which() == Node::STRUCT; -} -inline bool Node::Builder::isStruct() { - return which() == Node::STRUCT; -} -inline typename Node::Struct::Reader Node::Reader::getStruct() const { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Reader(_reader); -} -inline typename Node::Struct::Builder Node::Builder::getStruct() { - KJ_IREQUIRE((which() == Node::STRUCT), - "Must check which() before get()ing a union member."); - return typename Node::Struct::Builder(_builder); -} -inline typename Node::Struct::Builder Node::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::STRUCT); - _builder.setDataField< ::uint16_t>(::capnp::bounded<7>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<12>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<13>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<224>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<15>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint32_t>(::capnp::bounded<8>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Struct::Builder(_builder); -} -inline bool Node::Reader::isEnum() const { - return which() == Node::ENUM; -} -inline bool Node::Builder::isEnum() { - return which() == Node::ENUM; -} -inline typename Node::Enum::Reader Node::Reader::getEnum() const { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Reader(_reader); -} -inline typename Node::Enum::Builder Node::Builder::getEnum() { - KJ_IREQUIRE((which() == Node::ENUM), - "Must check which() before get()ing a union member."); - return typename Node::Enum::Builder(_builder); -} -inline typename Node::Enum::Builder Node::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ENUM); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Enum::Builder(_builder); -} -inline bool Node::Reader::isInterface() const { - return which() == Node::INTERFACE; -} -inline bool Node::Builder::isInterface() { - return which() == Node::INTERFACE; -} -inline typename Node::Interface::Reader Node::Reader::getInterface() const { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Reader(_reader); -} -inline typename Node::Interface::Builder Node::Builder::getInterface() { - KJ_IREQUIRE((which() == Node::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Node::Interface::Builder(_builder); -} -inline typename Node::Interface::Builder Node::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::INTERFACE); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Interface::Builder(_builder); -} -inline bool Node::Reader::isConst() const { - return which() == Node::CONST; -} -inline bool Node::Builder::isConst() { - return which() == Node::CONST; -} -inline typename Node::Const::Reader Node::Reader::getConst() const { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Reader(_reader); -} -inline typename Node::Const::Builder Node::Builder::getConst() { - KJ_IREQUIRE((which() == Node::CONST), - "Must check which() before get()ing a union member."); - return typename Node::Const::Builder(_builder); -} -inline typename Node::Const::Builder Node::Builder::initConst() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::CONST); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS).clear(); - return typename Node::Const::Builder(_builder); -} -inline bool Node::Reader::isAnnotation() const { - return which() == Node::ANNOTATION; -} -inline bool Node::Builder::isAnnotation() { - return which() == Node::ANNOTATION; -} -inline typename Node::Annotation::Reader Node::Reader::getAnnotation() const { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Reader(_reader); -} -inline typename Node::Annotation::Builder Node::Builder::getAnnotation() { - KJ_IREQUIRE((which() == Node::ANNOTATION), - "Must check which() before get()ing a union member."); - return typename Node::Annotation::Builder(_builder); -} -inline typename Node::Annotation::Builder Node::Builder::initAnnotation() { - _builder.setDataField( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, Node::ANNOTATION); - _builder.setDataField(::capnp::bounded<112>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<113>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<114>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<115>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<116>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<117>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<118>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<119>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<120>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<121>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<122>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<123>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Node::Annotation::Builder(_builder); -} -inline bool Node::Reader::hasParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Builder::hasParameters() { - return !_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Node::Reader::getParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::getParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} -inline void Node::Builder::setParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Node::Builder::initParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), size); -} -inline void Node::Builder::adoptParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Node::Builder::disownParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<5>() * ::capnp::POINTERS)); -} - -inline bool Node::Reader::getIsGeneric() const { - return _reader.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} - -inline bool Node::Builder::getIsGeneric() { - return _builder.getDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS); -} -inline void Node::Builder::setIsGeneric(bool value) { - _builder.setDataField( - ::capnp::bounded<288>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Parameter::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Parameter::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::Parameter::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::Parameter::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::Parameter::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::Parameter::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::Parameter::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Node::NestedNode::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::NestedNode::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Node::NestedNode::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Node::NestedNode::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Node::NestedNode::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Node::NestedNode::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Node::NestedNode::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Node::NestedNode::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Node::NestedNode::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Node::NestedNode::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDataWordCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDataWordCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDataWordCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<7>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getPointerCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getPointerCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPointerCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<12>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::ElementSize Node::Struct::Reader::getPreferredListEncoding() const { - return _reader.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} - -inline ::capnp::schema::ElementSize Node::Struct::Builder::getPreferredListEncoding() { - return _builder.getDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setPreferredListEncoding( ::capnp::schema::ElementSize value) { - _builder.setDataField< ::capnp::schema::ElementSize>( - ::capnp::bounded<13>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::getIsGroup() const { - return _reader.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} - -inline bool Node::Struct::Builder::getIsGroup() { - return _builder.getDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setIsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<224>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Node::Struct::Reader::getDiscriminantCount() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Node::Struct::Builder::getDiscriminantCount() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantCount( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<15>() * ::capnp::ELEMENTS, value); -} - -inline ::uint32_t Node::Struct::Reader::getDiscriminantOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Node::Struct::Builder::getDiscriminantOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS); -} -inline void Node::Struct::Builder::setDiscriminantOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<8>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Struct::Reader::hasFields() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Struct::Builder::hasFields() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Field>::Reader Node::Struct::Reader::getFields() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::getFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Struct::Builder::setFields( ::capnp::List< ::capnp::schema::Field>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Field>::Builder Node::Struct::Builder::initFields(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Struct::Builder::adoptFields( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> Node::Struct::Builder::disownFields() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Field>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Enum::Reader::hasEnumerants() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Enum::Builder::hasEnumerants() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Reader Node::Enum::Reader::getEnumerants() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::getEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Enum::Builder::setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::initEnumerants(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Enum::Builder::adoptEnumerants( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> Node::Enum::Builder::disownEnumerants() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasMethods() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasMethods() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Method>::Reader Node::Interface::Reader::getMethods() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::getMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::initMethods(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptMethods( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> Node::Interface::Builder::disownMethods() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Interface::Reader::hasSuperclasses() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Interface::Builder::hasSuperclasses() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Reader Node::Interface::Reader::getSuperclasses() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::getSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Interface::Builder::setSuperclasses( ::capnp::List< ::capnp::schema::Superclass>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Superclass>::Builder Node::Interface::Builder::initSuperclasses(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Node::Interface::Builder::adoptSuperclasses( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Superclass>> Node::Interface::Builder::disownSuperclasses() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Superclass>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Const::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Const::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Const::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Const::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Const::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Const::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Node::Const::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Node::Const::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(4)); -} -#endif // !CAPNP_LITE -inline void Node::Const::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Node::Const::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Node::Const::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Node::Const::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Node::Annotation::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Node::Annotation::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Node::Annotation::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Node::Annotation::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Node::Annotation::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Node::Annotation::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Node::Annotation::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Node::Annotation::Reader::getTargetsFile() const { - return _reader.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsFile() { - return _builder.getDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsFile(bool value) { - _builder.setDataField( - ::capnp::bounded<112>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsConst() const { - return _reader.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsConst() { - return _builder.getDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsConst(bool value) { - _builder.setDataField( - ::capnp::bounded<113>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnum() const { - return _reader.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnum() { - return _builder.getDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnum(bool value) { - _builder.setDataField( - ::capnp::bounded<114>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsEnumerant() const { - return _reader.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsEnumerant() { - return _builder.getDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsEnumerant(bool value) { - _builder.setDataField( - ::capnp::bounded<115>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsStruct() const { - return _reader.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsStruct() { - return _builder.getDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsStruct(bool value) { - _builder.setDataField( - ::capnp::bounded<116>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsField() const { - return _reader.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsField() { - return _builder.getDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsField(bool value) { - _builder.setDataField( - ::capnp::bounded<117>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsUnion() const { - return _reader.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsUnion() { - return _builder.getDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsUnion(bool value) { - _builder.setDataField( - ::capnp::bounded<118>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsGroup() const { - return _reader.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsGroup() { - return _builder.getDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsGroup(bool value) { - _builder.setDataField( - ::capnp::bounded<119>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsInterface() const { - return _reader.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsInterface() { - return _builder.getDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsInterface(bool value) { - _builder.setDataField( - ::capnp::bounded<120>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsMethod() const { - return _reader.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsMethod() { - return _builder.getDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsMethod(bool value) { - _builder.setDataField( - ::capnp::bounded<121>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsParam() const { - return _reader.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsParam() { - return _builder.getDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsParam(bool value) { - _builder.setDataField( - ::capnp::bounded<122>() * ::capnp::ELEMENTS, value); -} - -inline bool Node::Annotation::Reader::getTargetsAnnotation() const { - return _reader.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} - -inline bool Node::Annotation::Builder::getTargetsAnnotation() { - return _builder.getDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS); -} -inline void Node::Annotation::Builder::setTargetsAnnotation(bool value) { - _builder.setDataField( - ::capnp::bounded<123>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Which Field::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Which Field::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Field::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Field::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Field::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Field::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Field::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Field::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Field::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Field::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Field::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Field::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Field::Reader::getDiscriminantValue() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} - -inline ::uint16_t Field::Builder::getDiscriminantValue() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, 65535u); -} -inline void Field::Builder::setDiscriminantValue( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value, 65535u); -} - -inline bool Field::Reader::isSlot() const { - return which() == Field::SLOT; -} -inline bool Field::Builder::isSlot() { - return which() == Field::SLOT; -} -inline typename Field::Slot::Reader Field::Reader::getSlot() const { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Reader(_reader); -} -inline typename Field::Slot::Builder Field::Builder::getSlot() { - KJ_IREQUIRE((which() == Field::SLOT), - "Must check which() before get()ing a union member."); - return typename Field::Slot::Builder(_builder); -} -inline typename Field::Slot::Builder Field::Builder::initSlot() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::SLOT); - _builder.setDataField< ::uint32_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.setDataField(::capnp::bounded<128>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<2>() * ::capnp::POINTERS).clear(); - _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS).clear(); - return typename Field::Slot::Builder(_builder); -} -inline bool Field::Reader::isGroup() const { - return which() == Field::GROUP; -} -inline bool Field::Builder::isGroup() { - return which() == Field::GROUP; -} -inline typename Field::Group::Reader Field::Reader::getGroup() const { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Reader(_reader); -} -inline typename Field::Group::Builder Field::Builder::getGroup() { - KJ_IREQUIRE((which() == Field::GROUP), - "Must check which() before get()ing a union member."); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Group::Builder Field::Builder::initGroup() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Field::GROUP); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Field::Group::Builder(_builder); -} -inline typename Field::Ordinal::Reader Field::Reader::getOrdinal() const { - return typename Field::Ordinal::Reader(_reader); -} -inline typename Field::Ordinal::Builder Field::Builder::getOrdinal() { - return typename Field::Ordinal::Builder(_builder); -} -#if !CAPNP_LITE -inline typename Field::Ordinal::Pipeline Field::Pipeline::getOrdinal() { - return typename Field::Ordinal::Pipeline(_typeless.noop()); -} -#endif // !CAPNP_LITE -inline typename Field::Ordinal::Builder Field::Builder::initOrdinal() { - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<6>() * ::capnp::ELEMENTS, 0); - return typename Field::Ordinal::Builder(_builder); -} -inline ::uint32_t Field::Slot::Reader::getOffset() const { - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Field::Slot::Builder::getOffset() { - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setOffset( ::uint32_t value) { - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Slot::Reader::hasType() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasType() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Field::Slot::Reader::getType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::getType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Field::Slot::Pipeline::getType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Field::Slot::Builder::initType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Field::Slot::Builder::disownType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::hasDefaultValue() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Field::Slot::Builder::hasDefaultValue() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Field::Slot::Reader::getDefaultValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::getDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Field::Slot::Pipeline::getDefaultValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Field::Slot::Builder::setDefaultValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Field::Slot::Builder::initDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Field::Slot::Builder::adoptDefaultValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Field::Slot::Builder::disownDefaultValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Field::Slot::Reader::getHadExplicitDefault() const { - return _reader.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} - -inline bool Field::Slot::Builder::getHadExplicitDefault() { - return _builder.getDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS); -} -inline void Field::Slot::Builder::setHadExplicitDefault(bool value) { - _builder.setDataField( - ::capnp::bounded<128>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Field::Group::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Field::Group::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Field::Group::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Field::Ordinal::Which Field::Ordinal::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Field::Ordinal::Reader::isImplicit() const { - return which() == Field::Ordinal::IMPLICIT; -} -inline bool Field::Ordinal::Builder::isImplicit() { - return which() == Field::Ordinal::IMPLICIT; -} -inline ::capnp::Void Field::Ordinal::Reader::getImplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Field::Ordinal::Builder::getImplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::IMPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setImplicit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::IMPLICIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Field::Ordinal::Reader::isExplicit() const { - return which() == Field::Ordinal::EXPLICIT; -} -inline bool Field::Ordinal::Builder::isExplicit() { - return which() == Field::Ordinal::EXPLICIT; -} -inline ::uint16_t Field::Ordinal::Reader::getExplicit() const { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Field::Ordinal::Builder::getExplicit() { - KJ_IREQUIRE((which() == Field::Ordinal::EXPLICIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS); -} -inline void Field::Ordinal::Builder::setExplicit( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Field::Ordinal::EXPLICIT); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<6>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Enumerant::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Enumerant::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Enumerant::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Enumerant::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Enumerant::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Enumerant::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Enumerant::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Enumerant::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Enumerant::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Enumerant::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Enumerant::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Enumerant::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Enumerant::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Enumerant::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Superclass::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Superclass::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Superclass::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Superclass::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Superclass::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Superclass::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Superclass::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Superclass::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Superclass::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Superclass::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Superclass::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Method::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Method::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Method::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Method::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint16_t Method::Reader::getCodeOrder() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Method::Builder::getCodeOrder() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setCodeOrder( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getParamStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getParamStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setParamStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Method::Reader::getResultStructType() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Method::Builder::getResultStructType() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Method::Builder::setResultStructType( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Method::Reader::hasAnnotations() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasAnnotations() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Reader Method::Reader::getAnnotations() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::getAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setAnnotations( ::capnp::List< ::capnp::schema::Annotation>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Annotation>::Builder Method::Builder::initAnnotations(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptAnnotations( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Annotation>> Method::Builder::disownAnnotations() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Annotation>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasParamBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasParamBrand() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getParamBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getParamBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setParamBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptParamBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownParamBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasResultBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasResultBrand() { - return !_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Method::Reader::getResultBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Method::Builder::getResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Method::Pipeline::getResultBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(3)); -} -#endif // !CAPNP_LITE -inline void Method::Builder::setResultBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Method::Builder::initResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} -inline void Method::Builder::adoptResultBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Method::Builder::disownResultBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<3>() * ::capnp::POINTERS)); -} - -inline bool Method::Reader::hasImplicitParameters() const { - return !_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline bool Method::Builder::hasImplicitParameters() { - return !_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Reader Method::Reader::getImplicitParameters() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_reader.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::getImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::get(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} -inline void Method::Builder::setImplicitParameters( ::capnp::List< ::capnp::schema::Node::Parameter>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::set(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node::Parameter>::Builder Method::Builder::initImplicitParameters(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::init(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), size); -} -inline void Method::Builder::adoptImplicitParameters( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::adopt(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node::Parameter>> Method::Builder::disownImplicitParameters() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node::Parameter>>::disown(_builder.getPointerField( - ::capnp::bounded<4>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::Which Type::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::Which Type::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Type::Reader::isVoid() const { - return which() == Type::VOID; -} -inline bool Type::Builder::isVoid() { - return which() == Type::VOID; -} -inline ::capnp::Void Type::Reader::getVoid() const { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getVoid() { - KJ_IREQUIRE((which() == Type::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isBool() const { - return which() == Type::BOOL; -} -inline bool Type::Builder::isBool() { - return which() == Type::BOOL; -} -inline ::capnp::Void Type::Reader::getBool() const { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getBool() { - KJ_IREQUIRE((which() == Type::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setBool( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::BOOL); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt8() const { - return which() == Type::INT8; -} -inline bool Type::Builder::isInt8() { - return which() == Type::INT8; -} -inline ::capnp::Void Type::Reader::getInt8() const { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt8() { - KJ_IREQUIRE((which() == Type::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt16() const { - return which() == Type::INT16; -} -inline bool Type::Builder::isInt16() { - return which() == Type::INT16; -} -inline ::capnp::Void Type::Reader::getInt16() const { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt16() { - KJ_IREQUIRE((which() == Type::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt32() const { - return which() == Type::INT32; -} -inline bool Type::Builder::isInt32() { - return which() == Type::INT32; -} -inline ::capnp::Void Type::Reader::getInt32() const { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt32() { - KJ_IREQUIRE((which() == Type::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isInt64() const { - return which() == Type::INT64; -} -inline bool Type::Builder::isInt64() { - return which() == Type::INT64; -} -inline ::capnp::Void Type::Reader::getInt64() const { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getInt64() { - KJ_IREQUIRE((which() == Type::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setInt64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint8() const { - return which() == Type::UINT8; -} -inline bool Type::Builder::isUint8() { - return which() == Type::UINT8; -} -inline ::capnp::Void Type::Reader::getUint8() const { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint8() { - KJ_IREQUIRE((which() == Type::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint8( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT8); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint16() const { - return which() == Type::UINT16; -} -inline bool Type::Builder::isUint16() { - return which() == Type::UINT16; -} -inline ::capnp::Void Type::Reader::getUint16() const { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint16() { - KJ_IREQUIRE((which() == Type::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint16( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT16); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint32() const { - return which() == Type::UINT32; -} -inline bool Type::Builder::isUint32() { - return which() == Type::UINT32; -} -inline ::capnp::Void Type::Reader::getUint32() const { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint32() { - KJ_IREQUIRE((which() == Type::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isUint64() const { - return which() == Type::UINT64; -} -inline bool Type::Builder::isUint64() { - return which() == Type::UINT64; -} -inline ::capnp::Void Type::Reader::getUint64() const { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getUint64() { - KJ_IREQUIRE((which() == Type::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setUint64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::UINT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat32() const { - return which() == Type::FLOAT32; -} -inline bool Type::Builder::isFloat32() { - return which() == Type::FLOAT32; -} -inline ::capnp::Void Type::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat32() { - KJ_IREQUIRE((which() == Type::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat32( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT32); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isFloat64() const { - return which() == Type::FLOAT64; -} -inline bool Type::Builder::isFloat64() { - return which() == Type::FLOAT64; -} -inline ::capnp::Void Type::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getFloat64() { - KJ_IREQUIRE((which() == Type::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setFloat64( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::FLOAT64); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isText() const { - return which() == Type::TEXT; -} -inline bool Type::Builder::isText() { - return which() == Type::TEXT; -} -inline ::capnp::Void Type::Reader::getText() const { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getText() { - KJ_IREQUIRE((which() == Type::TEXT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setText( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::TEXT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isData() const { - return which() == Type::DATA; -} -inline bool Type::Builder::isData() { - return which() == Type::DATA; -} -inline ::capnp::Void Type::Reader::getData() const { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::Builder::getData() { - KJ_IREQUIRE((which() == Type::DATA), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::Builder::setData( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::DATA); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Reader::isList() const { - return which() == Type::LIST; -} -inline bool Type::Builder::isList() { - return which() == Type::LIST; -} -inline typename Type::List::Reader Type::Reader::getList() const { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Reader(_reader); -} -inline typename Type::List::Builder Type::Builder::getList() { - KJ_IREQUIRE((which() == Type::LIST), - "Must check which() before get()ing a union member."); - return typename Type::List::Builder(_builder); -} -inline typename Type::List::Builder Type::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::LIST); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::List::Builder(_builder); -} -inline bool Type::Reader::isEnum() const { - return which() == Type::ENUM; -} -inline bool Type::Builder::isEnum() { - return which() == Type::ENUM; -} -inline typename Type::Enum::Reader Type::Reader::getEnum() const { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Reader(_reader); -} -inline typename Type::Enum::Builder Type::Builder::getEnum() { - KJ_IREQUIRE((which() == Type::ENUM), - "Must check which() before get()ing a union member."); - return typename Type::Enum::Builder(_builder); -} -inline typename Type::Enum::Builder Type::Builder::initEnum() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ENUM); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Enum::Builder(_builder); -} -inline bool Type::Reader::isStruct() const { - return which() == Type::STRUCT; -} -inline bool Type::Builder::isStruct() { - return which() == Type::STRUCT; -} -inline typename Type::Struct::Reader Type::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Reader(_reader); -} -inline typename Type::Struct::Builder Type::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::STRUCT), - "Must check which() before get()ing a union member."); - return typename Type::Struct::Builder(_builder); -} -inline typename Type::Struct::Builder Type::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::STRUCT); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Struct::Builder(_builder); -} -inline bool Type::Reader::isInterface() const { - return which() == Type::INTERFACE; -} -inline bool Type::Builder::isInterface() { - return which() == Type::INTERFACE; -} -inline typename Type::Interface::Reader Type::Reader::getInterface() const { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Reader(_reader); -} -inline typename Type::Interface::Builder Type::Builder::getInterface() { - KJ_IREQUIRE((which() == Type::INTERFACE), - "Must check which() before get()ing a union member."); - return typename Type::Interface::Builder(_builder); -} -inline typename Type::Interface::Builder Type::Builder::initInterface() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::INTERFACE); - _builder.setDataField< ::uint64_t>(::capnp::bounded<1>() * ::capnp::ELEMENTS, 0); - _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS).clear(); - return typename Type::Interface::Builder(_builder); -} -inline bool Type::Reader::isAnyPointer() const { - return which() == Type::ANY_POINTER; -} -inline bool Type::Builder::isAnyPointer() { - return which() == Type::ANY_POINTER; -} -inline typename Type::AnyPointer::Reader Type::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Reader(_reader); -} -inline typename Type::AnyPointer::Builder Type::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Type::ANY_POINTER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Builder(_builder); -} -inline typename Type::AnyPointer::Builder Type::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Type::ANY_POINTER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<4>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Builder(_builder); -} -inline bool Type::List::Reader::hasElementType() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::List::Builder::hasElementType() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Type::List::Reader::getElementType() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::getElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Type::Pipeline Type::List::Pipeline::getElementType() { - return ::capnp::schema::Type::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::List::Builder::setElementType( ::capnp::schema::Type::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Type::List::Builder::initElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::List::Builder::adoptElementType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Type::List::Builder::disownElementType() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Enum::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Enum::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Enum::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Enum::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Enum::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Enum::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Enum::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Enum::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Enum::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Enum::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Enum::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Struct::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Struct::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Struct::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Struct::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Struct::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Struct::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Struct::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Struct::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Struct::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Struct::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Struct::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::uint64_t Type::Interface::Reader::getTypeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::Interface::Builder::getTypeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Type::Interface::Builder::setTypeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::Interface::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Type::Interface::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Type::Interface::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Type::Interface::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Type::Interface::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Type::Interface::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Type::Interface::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Type::Interface::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Which Type::AnyPointer::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Reader::isUnconstrained() const { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline bool Type::AnyPointer::Builder::isUnconstrained() { - return which() == Type::AnyPointer::UNCONSTRAINED; -} -inline typename Type::AnyPointer::Unconstrained::Reader Type::AnyPointer::Reader::getUnconstrained() const { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Reader(_reader); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::getUnconstrained() { - KJ_IREQUIRE((which() == Type::AnyPointer::UNCONSTRAINED), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline typename Type::AnyPointer::Unconstrained::Builder Type::AnyPointer::Builder::initUnconstrained() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::UNCONSTRAINED); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Unconstrained::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isParameter() const { - return which() == Type::AnyPointer::PARAMETER; -} -inline bool Type::AnyPointer::Builder::isParameter() { - return which() == Type::AnyPointer::PARAMETER; -} -inline typename Type::AnyPointer::Parameter::Reader Type::AnyPointer::Reader::getParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Reader(_reader); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::getParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline typename Type::AnyPointer::Parameter::Builder Type::AnyPointer::Builder::initParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - _builder.setDataField< ::uint64_t>(::capnp::bounded<2>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::Parameter::Builder(_builder); -} -inline bool Type::AnyPointer::Reader::isImplicitMethodParameter() const { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline bool Type::AnyPointer::Builder::isImplicitMethodParameter() { - return which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER; -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Reader Type::AnyPointer::Reader::getImplicitMethodParameter() const { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Reader(_reader); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::getImplicitMethodParameter() { - KJ_IREQUIRE((which() == Type::AnyPointer::IMPLICIT_METHOD_PARAMETER), - "Must check which() before get()ing a union member."); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline typename Type::AnyPointer::ImplicitMethodParameter::Builder Type::AnyPointer::Builder::initImplicitMethodParameter() { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Type::AnyPointer::IMPLICIT_METHOD_PARAMETER); - _builder.setDataField< ::uint16_t>(::capnp::bounded<5>() * ::capnp::ELEMENTS, 0); - return typename Type::AnyPointer::ImplicitMethodParameter::Builder(_builder); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Type::AnyPointer::Unconstrained::Which Type::AnyPointer::Unconstrained::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isAnyKind() const { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isAnyKind() { - return which() == Type::AnyPointer::Unconstrained::ANY_KIND; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getAnyKind() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getAnyKind() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::ANY_KIND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setAnyKind( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::ANY_KIND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isStruct() const { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isStruct() { - return which() == Type::AnyPointer::Unconstrained::STRUCT; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getStruct() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getStruct() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::STRUCT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setStruct( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::STRUCT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isList() const { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isList() { - return which() == Type::AnyPointer::Unconstrained::LIST; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getList() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getList() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::LIST), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setList( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::LIST); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Type::AnyPointer::Unconstrained::Reader::isCapability() const { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline bool Type::AnyPointer::Unconstrained::Builder::isCapability() { - return which() == Type::AnyPointer::Unconstrained::CAPABILITY; -} -inline ::capnp::Void Type::AnyPointer::Unconstrained::Reader::getCapability() const { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Type::AnyPointer::Unconstrained::Builder::getCapability() { - KJ_IREQUIRE((which() == Type::AnyPointer::Unconstrained::CAPABILITY), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Unconstrained::Builder::setCapability( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, Type::AnyPointer::Unconstrained::CAPABILITY); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Type::AnyPointer::Parameter::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::Parameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::Parameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Reader::getParameterIndex() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Type::AnyPointer::ImplicitMethodParameter::Builder::getParameterIndex() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS); -} -inline void Type::AnyPointer::ImplicitMethodParameter::Builder::setParameterIndex( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<5>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Reader::hasScopes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Builder::hasScopes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Reader Brand::Reader::getScopes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::getScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Builder::setScopes( ::capnp::List< ::capnp::schema::Brand::Scope>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Scope>::Builder Brand::Builder::initScopes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Builder::adoptScopes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Scope>> Brand::Builder::disownScopes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Scope>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Scope::Which Brand::Scope::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Reader::getScopeId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Brand::Scope::Builder::getScopeId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setScopeId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Scope::Reader::isBind() const { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Builder::isBind() { - return which() == Brand::Scope::BIND; -} -inline bool Brand::Scope::Reader::hasBind() const { - if (which() != Brand::Scope::BIND) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Scope::Builder::hasBind() { - if (which() != Brand::Scope::BIND) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Reader Brand::Scope::Reader::getBind() const { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::getBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Scope::Builder::setBind( ::capnp::List< ::capnp::schema::Brand::Binding>::Reader value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Brand::Binding>::Builder Brand::Scope::Builder::initBind(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Brand::Scope::Builder::adoptBind( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>>&& value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::BIND); - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Brand::Binding>> Brand::Scope::Builder::disownBind() { - KJ_IREQUIRE((which() == Brand::Scope::BIND), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Brand::Binding>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Brand::Scope::Reader::isInherit() const { - return which() == Brand::Scope::INHERIT; -} -inline bool Brand::Scope::Builder::isInherit() { - return which() == Brand::Scope::INHERIT; -} -inline ::capnp::Void Brand::Scope::Reader::getInherit() const { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Scope::Builder::getInherit() { - KJ_IREQUIRE((which() == Brand::Scope::INHERIT), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Scope::Builder::setInherit( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<4>() * ::capnp::ELEMENTS, Brand::Scope::INHERIT); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Brand::Binding::Which Brand::Binding::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Brand::Binding::Reader::isUnbound() const { - return which() == Brand::Binding::UNBOUND; -} -inline bool Brand::Binding::Builder::isUnbound() { - return which() == Brand::Binding::UNBOUND; -} -inline ::capnp::Void Brand::Binding::Reader::getUnbound() const { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Brand::Binding::Builder::getUnbound() { - KJ_IREQUIRE((which() == Brand::Binding::UNBOUND), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Brand::Binding::Builder::setUnbound( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::UNBOUND); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Brand::Binding::Reader::isType() const { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Builder::isType() { - return which() == Brand::Binding::TYPE; -} -inline bool Brand::Binding::Reader::hasType() const { - if (which() != Brand::Binding::TYPE) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Brand::Binding::Builder::hasType() { - if (which() != Brand::Binding::TYPE) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Type::Reader Brand::Binding::Reader::getType() const { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::getType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::setType( ::capnp::schema::Type::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Type::Builder Brand::Binding::Builder::initType() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Brand::Binding::Builder::adoptType( - ::capnp::Orphan< ::capnp::schema::Type>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Brand::Binding::TYPE); - ::capnp::_::PointerHelpers< ::capnp::schema::Type>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Type> Brand::Binding::Builder::disownType() { - KJ_IREQUIRE((which() == Brand::Binding::TYPE), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::schema::Type>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline ::capnp::schema::Value::Which Value::Reader::which() const { - return _reader.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline ::capnp::schema::Value::Which Value::Builder::which() { - return _builder.getDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline bool Value::Reader::isVoid() const { - return which() == Value::VOID; -} -inline bool Value::Builder::isVoid() { - return which() == Value::VOID; -} -inline ::capnp::Void Value::Reader::getVoid() const { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getVoid() { - KJ_IREQUIRE((which() == Value::VOID), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setVoid( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::VOID); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isBool() const { - return which() == Value::BOOL; -} -inline bool Value::Builder::isBool() { - return which() == Value::BOOL; -} -inline bool Value::Reader::getBool() const { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} - -inline bool Value::Builder::getBool() { - KJ_IREQUIRE((which() == Value::BOOL), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setBool(bool value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::BOOL); - _builder.setDataField( - ::capnp::bounded<16>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt8() const { - return which() == Value::INT8; -} -inline bool Value::Builder::isInt8() { - return which() == Value::INT8; -} -inline ::int8_t Value::Reader::getInt8() const { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::int8_t Value::Builder::getInt8() { - KJ_IREQUIRE((which() == Value::INT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt8( ::int8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT8); - _builder.setDataField< ::int8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt16() const { - return which() == Value::INT16; -} -inline bool Value::Builder::isInt16() { - return which() == Value::INT16; -} -inline ::int16_t Value::Reader::getInt16() const { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int16_t Value::Builder::getInt16() { - KJ_IREQUIRE((which() == Value::INT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt16( ::int16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT16); - _builder.setDataField< ::int16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt32() const { - return which() == Value::INT32; -} -inline bool Value::Builder::isInt32() { - return which() == Value::INT32; -} -inline ::int32_t Value::Reader::getInt32() const { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int32_t Value::Builder::getInt32() { - KJ_IREQUIRE((which() == Value::INT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt32( ::int32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT32); - _builder.setDataField< ::int32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isInt64() const { - return which() == Value::INT64; -} -inline bool Value::Builder::isInt64() { - return which() == Value::INT64; -} -inline ::int64_t Value::Reader::getInt64() const { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::int64_t Value::Builder::getInt64() { - KJ_IREQUIRE((which() == Value::INT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInt64( ::int64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INT64); - _builder.setDataField< ::int64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint8() const { - return which() == Value::UINT8; -} -inline bool Value::Builder::isUint8() { - return which() == Value::UINT8; -} -inline ::uint8_t Value::Reader::getUint8() const { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t Value::Builder::getUint8() { - KJ_IREQUIRE((which() == Value::UINT8), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint8( ::uint8_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT8); - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint16() const { - return which() == Value::UINT16; -} -inline bool Value::Builder::isUint16() { - return which() == Value::UINT16; -} -inline ::uint16_t Value::Reader::getUint16() const { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getUint16() { - KJ_IREQUIRE((which() == Value::UINT16), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint16( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT16); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint32() const { - return which() == Value::UINT32; -} -inline bool Value::Builder::isUint32() { - return which() == Value::UINT32; -} -inline ::uint32_t Value::Reader::getUint32() const { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint32_t Value::Builder::getUint32() { - KJ_IREQUIRE((which() == Value::UINT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint32( ::uint32_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT32); - _builder.setDataField< ::uint32_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isUint64() const { - return which() == Value::UINT64; -} -inline bool Value::Builder::isUint64() { - return which() == Value::UINT64; -} -inline ::uint64_t Value::Reader::getUint64() const { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Value::Builder::getUint64() { - KJ_IREQUIRE((which() == Value::UINT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setUint64( ::uint64_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::UINT64); - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat32() const { - return which() == Value::FLOAT32; -} -inline bool Value::Builder::isFloat32() { - return which() == Value::FLOAT32; -} -inline float Value::Reader::getFloat32() const { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline float Value::Builder::getFloat32() { - KJ_IREQUIRE((which() == Value::FLOAT32), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat32(float value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT32); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isFloat64() const { - return which() == Value::FLOAT64; -} -inline bool Value::Builder::isFloat64() { - return which() == Value::FLOAT64; -} -inline double Value::Reader::getFloat64() const { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _reader.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline double Value::Builder::getFloat64() { - KJ_IREQUIRE((which() == Value::FLOAT64), - "Must check which() before get()ing a union member."); - return _builder.getDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setFloat64(double value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::FLOAT64); - _builder.setDataField( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isText() const { - return which() == Value::TEXT; -} -inline bool Value::Builder::isText() { - return which() == Value::TEXT; -} -inline bool Value::Reader::hasText() const { - if (which() != Value::TEXT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasText() { - if (which() != Value::TEXT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader Value::Reader::getText() const { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder Value::Builder::getText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setText( ::capnp::Text::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder Value::Builder::initText(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptText( - ::capnp::Orphan< ::capnp::Text>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::TEXT); - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> Value::Builder::disownText() { - KJ_IREQUIRE((which() == Value::TEXT), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isData() const { - return which() == Value::DATA; -} -inline bool Value::Builder::isData() { - return which() == Value::DATA; -} -inline bool Value::Reader::hasData() const { - if (which() != Value::DATA) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasData() { - if (which() != Value::DATA) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Data::Reader Value::Reader::getData() const { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Data::Builder Value::Builder::getData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Value::Builder::setData( ::capnp::Data::Reader value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Data::Builder Value::Builder::initData(unsigned int size) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - return ::capnp::_::PointerHelpers< ::capnp::Data>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Value::Builder::adoptData( - ::capnp::Orphan< ::capnp::Data>&& value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::DATA); - ::capnp::_::PointerHelpers< ::capnp::Data>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Data> Value::Builder::disownData() { - KJ_IREQUIRE((which() == Value::DATA), - "Must check which() before get()ing a union member."); - return ::capnp::_::PointerHelpers< ::capnp::Data>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Value::Reader::isList() const { - return which() == Value::LIST; -} -inline bool Value::Builder::isList() { - return which() == Value::LIST; -} -inline bool Value::Reader::hasList() const { - if (which() != Value::LIST) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasList() { - if (which() != Value::LIST) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getList() const { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getList() { - KJ_IREQUIRE((which() == Value::LIST), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initList() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::LIST); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isEnum() const { - return which() == Value::ENUM; -} -inline bool Value::Builder::isEnum() { - return which() == Value::ENUM; -} -inline ::uint16_t Value::Reader::getEnum() const { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t Value::Builder::getEnum() { - KJ_IREQUIRE((which() == Value::ENUM), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setEnum( ::uint16_t value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ENUM); - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isStruct() const { - return which() == Value::STRUCT; -} -inline bool Value::Builder::isStruct() { - return which() == Value::STRUCT; -} -inline bool Value::Reader::hasStruct() const { - if (which() != Value::STRUCT) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasStruct() { - if (which() != Value::STRUCT) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getStruct() const { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getStruct() { - KJ_IREQUIRE((which() == Value::STRUCT), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initStruct() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::STRUCT); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline bool Value::Reader::isInterface() const { - return which() == Value::INTERFACE; -} -inline bool Value::Builder::isInterface() { - return which() == Value::INTERFACE; -} -inline ::capnp::Void Value::Reader::getInterface() const { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _reader.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::capnp::Void Value::Builder::getInterface() { - KJ_IREQUIRE((which() == Value::INTERFACE), - "Must check which() before get()ing a union member."); - return _builder.getDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Value::Builder::setInterface( ::capnp::Void value) { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::INTERFACE); - _builder.setDataField< ::capnp::Void>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Value::Reader::isAnyPointer() const { - return which() == Value::ANY_POINTER; -} -inline bool Value::Builder::isAnyPointer() { - return which() == Value::ANY_POINTER; -} -inline bool Value::Reader::hasAnyPointer() const { - if (which() != Value::ANY_POINTER) return false; - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Value::Builder::hasAnyPointer() { - if (which() != Value::ANY_POINTER) return false; - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::AnyPointer::Reader Value::Reader::getAnyPointer() const { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Reader(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::getAnyPointer() { - KJ_IREQUIRE((which() == Value::ANY_POINTER), - "Must check which() before get()ing a union member."); - return ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::AnyPointer::Builder Value::Builder::initAnyPointer() { - _builder.setDataField( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, Value::ANY_POINTER); - auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); - result.clear(); - return result; -} - -inline ::uint64_t Annotation::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t Annotation::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void Annotation::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool Annotation::Reader::hasValue() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasValue() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Value::Reader Annotation::Reader::getValue() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::getValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Value::Pipeline Annotation::Pipeline::getValue() { - return ::capnp::schema::Value::Pipeline(_typeless.getPointerField(0)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setValue( ::capnp::schema::Value::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Value::Builder Annotation::Builder::initValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptValue( - ::capnp::Orphan< ::capnp::schema::Value>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Value>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Value> Annotation::Builder::disownValue() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Value>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Annotation::Reader::hasBrand() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Annotation::Builder::hasBrand() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::Brand::Reader Annotation::Reader::getBrand() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::getBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::Brand::Pipeline Annotation::Pipeline::getBrand() { - return ::capnp::schema::Brand::Pipeline(_typeless.getPointerField(1)); -} -#endif // !CAPNP_LITE -inline void Annotation::Builder::setBrand( ::capnp::schema::Brand::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::Brand::Builder Annotation::Builder::initBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Annotation::Builder::adoptBrand( - ::capnp::Orphan< ::capnp::schema::Brand>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::Brand> Annotation::Builder::disownBrand() { - return ::capnp::_::PointerHelpers< ::capnp::schema::Brand>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint16_t CapnpVersion::Reader::getMajor() const { - return _reader.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint16_t CapnpVersion::Builder::getMajor() { - return _builder.getDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMajor( ::uint16_t value) { - _builder.setDataField< ::uint16_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMinor() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMinor() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMinor( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<2>() * ::capnp::ELEMENTS, value); -} - -inline ::uint8_t CapnpVersion::Reader::getMicro() const { - return _reader.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} - -inline ::uint8_t CapnpVersion::Builder::getMicro() { - return _builder.getDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS); -} -inline void CapnpVersion::Builder::setMicro( ::uint8_t value) { - _builder.setDataField< ::uint8_t>( - ::capnp::bounded<3>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::Reader::hasNodes() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasNodes() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::Node>::Reader CodeGeneratorRequest::Reader::getNodes() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::getNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setNodes( ::capnp::List< ::capnp::schema::Node>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::Node>::Builder CodeGeneratorRequest::Builder::initNodes(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptNodes( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Node>> CodeGeneratorRequest::Builder::disownNodes() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Node>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasRequestedFiles() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasRequestedFiles() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader CodeGeneratorRequest::Reader::getRequestedFiles() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::getRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::setRequestedFiles( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>::Builder CodeGeneratorRequest::Builder::initRequestedFiles(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::Builder::adoptRequestedFiles( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>> CodeGeneratorRequest::Builder::disownRequestedFiles() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::Reader::hasCapnpVersion() const { - return !_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::Builder::hasCapnpVersion() { - return !_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::schema::CapnpVersion::Reader CodeGeneratorRequest::Reader::getCapnpVersion() const { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_reader.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::getCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::get(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -#if !CAPNP_LITE -inline ::capnp::schema::CapnpVersion::Pipeline CodeGeneratorRequest::Pipeline::getCapnpVersion() { - return ::capnp::schema::CapnpVersion::Pipeline(_typeless.getPointerField(2)); -} -#endif // !CAPNP_LITE -inline void CodeGeneratorRequest::Builder::setCapnpVersion( ::capnp::schema::CapnpVersion::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::set(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), value); -} -inline ::capnp::schema::CapnpVersion::Builder CodeGeneratorRequest::Builder::initCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::init(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::Builder::adoptCapnpVersion( - ::capnp::Orphan< ::capnp::schema::CapnpVersion>&& value) { - ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::adopt(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::schema::CapnpVersion> CodeGeneratorRequest::Builder::disownCapnpVersion() { - return ::capnp::_::PointerHelpers< ::capnp::schema::CapnpVersion>::disown(_builder.getPointerField( - ::capnp::bounded<2>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasFilename() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasFilename() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Reader::getFilename() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::getFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setFilename( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Builder::initFilename(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptFilename( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Builder::disownFilename() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool CodeGeneratorRequest::RequestedFile::Reader::hasImports() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Builder::hasImports() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader CodeGeneratorRequest::RequestedFile::Reader::getImports() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::getImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::setImports( ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>::Builder CodeGeneratorRequest::RequestedFile::Builder::initImports(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Builder::adoptImports( - ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>> CodeGeneratorRequest::RequestedFile::Builder::disownImports() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::CodeGeneratorRequest::RequestedFile::Import>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Reader::getId() const { - return _reader.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} - -inline ::uint64_t CodeGeneratorRequest::RequestedFile::Import::Builder::getId() { - return _builder.getDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setId( ::uint64_t value) { - _builder.setDataField< ::uint64_t>( - ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); -} - -inline bool CodeGeneratorRequest::RequestedFile::Import::Reader::hasName() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool CodeGeneratorRequest::RequestedFile::Import::Builder::hasName() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::Text::Reader CodeGeneratorRequest::RequestedFile::Import::Reader::getName() const { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::getName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::setName( ::capnp::Text::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::Text::Builder CodeGeneratorRequest::RequestedFile::Import::Builder::initName(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void CodeGeneratorRequest::RequestedFile::Import::Builder::adoptName( - ::capnp::Orphan< ::capnp::Text>&& value) { - ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::Text> CodeGeneratorRequest::RequestedFile::Import::Builder::disownName() { - return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -} // namespace -} // namespace - -#endif // CAPNP_INCLUDED_a93fc509624c72d9_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/schema.h b/phonelibs/capnp-cpp/mac/include/capnp/schema.h deleted file mode 100644 index d59fa75236..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/schema.h +++ /dev/null @@ -1,934 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SCHEMA_H_ -#define CAPNP_SCHEMA_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#if CAPNP_LITE -#error "Reflection APIs, including this header, are not available in lite mode." -#endif - -#include - -namespace capnp { - -class Schema; -class StructSchema; -class EnumSchema; -class InterfaceSchema; -class ConstSchema; -class ListSchema; -class Type; - -template ()> struct SchemaType_ { typedef Schema Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef schema::Type::Which Type; }; -template struct SchemaType_ { typedef EnumSchema Type; }; -template struct SchemaType_ { typedef StructSchema Type; }; -template struct SchemaType_ { typedef InterfaceSchema Type; }; -template struct SchemaType_ { typedef ListSchema Type; }; - -template -using SchemaType = typename SchemaType_::Type; -// SchemaType is the type of T's schema, e.g. StructSchema if T is a struct. - -namespace _ { // private -extern const RawSchema NULL_SCHEMA; -extern const RawSchema NULL_STRUCT_SCHEMA; -extern const RawSchema NULL_ENUM_SCHEMA; -extern const RawSchema NULL_INTERFACE_SCHEMA; -extern const RawSchema NULL_CONST_SCHEMA; -// The schema types default to these null (empty) schemas in case of error, especially when -// exceptions are disabled. -} // namespace _ (private) - -class Schema { - // Convenience wrapper around capnp::schema::Node. - -public: - inline Schema(): raw(&_::NULL_SCHEMA.defaultBrand) {} - - template - static inline SchemaType from() { return SchemaType::template fromImpl(); } - // Get the Schema for a particular compiled-in type. - - schema::Node::Reader getProto() const; - // Get the underlying Cap'n Proto representation of the schema node. (Note that this accessor - // has performance comparable to accessors of struct-typed fields on Reader classes.) - - kj::ArrayPtr asUncheckedMessage() const; - // Get the encoded schema node content as a single message segment. It is safe to read as an - // unchecked message. - - Schema getDependency(uint64_t id) const KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the dependency. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Gets the Schema for one of this Schema's dependencies. For example, if this Schema is for a - // struct, you could look up the schema for one of its fields' types. Throws an exception if this - // schema doesn't actually depend on the given id. - // - // Note that not all type IDs found in the schema node are considered "dependencies" -- only the - // ones that are needed to implement the dynamic API are. That includes: - // - Field types. - // - Group types. - // - scopeId for group nodes, but NOT otherwise. - // - Method parameter and return types. - // - // The following are NOT considered dependencies: - // - Nested nodes. - // - scopeId for a non-group node. - // - Annotations. - // - // To obtain schemas for those, you would need a SchemaLoader. - - bool isBranded() const; - // Returns true if this schema represents a non-default parameterization of this type. - - Schema getGeneric() const; - // Get the version of this schema with any brands removed. - - class BrandArgumentList; - BrandArgumentList getBrandArgumentsAtScope(uint64_t scopeId) const; - // Gets the values bound to the brand parameters at the given scope. - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ConstSchema asConst() const; - // Cast the Schema to a specific type. Throws an exception if the type doesn't match. Use - // getProto() to determine type, e.g. getProto().isStruct(). - - inline bool operator==(const Schema& other) const { return raw == other.raw; } - inline bool operator!=(const Schema& other) const { return raw != other.raw; } - // Determine whether two Schemas are wrapping the exact same underlying data, by identity. If - // you want to check if two Schemas represent the same type (but possibly different versions of - // it), compare their IDs instead. - - template - void requireUsableAs() const; - // Throws an exception if a value with this Schema cannot safely be cast to a native value of - // the given type. This passes if either: - // - *this == from() - // - This schema was loaded with SchemaLoader, the type ID matches typeId(), and - // loadCompiledTypeAndDependencies() was called on the SchemaLoader. - - kj::StringPtr getShortDisplayName() const; - // Get the short version of the node's display name. - -private: - const _::RawBrandedSchema* raw; - - inline explicit Schema(const _::RawBrandedSchema* raw): raw(raw) { - KJ_IREQUIRE(raw->lazyInitializer == nullptr, - "Must call ensureInitialized() on RawSchema before constructing Schema."); - } - - template static inline Schema fromImpl() { - return Schema(&_::rawSchema()); - } - - void requireUsableAs(const _::RawSchema* expected) const; - - uint32_t getSchemaOffset(const schema::Value::Reader& value) const; - - Type getBrandBinding(uint64_t scopeId, uint index) const; - // Look up the binding for a brand parameter used by this Schema. Returns `AnyPointer` if the - // parameter is not bound. - // - // TODO(someday): Public interface for iterating over all bindings? - - Schema getDependency(uint64_t id, uint location) const; - // Look up schema for a particular dependency of this schema. `location` is the dependency - // location number as defined in _::RawBrandedSchema. - - Type interpretType(schema::Type::Reader proto, uint location) const; - // Interpret a schema::Type in the given location within the schema, compiling it into a - // Type object. - - friend class StructSchema; - friend class EnumSchema; - friend class InterfaceSchema; - friend class ConstSchema; - friend class ListSchema; - friend class SchemaLoader; - friend class Type; - friend kj::StringTree _::structString( - _::StructReader reader, const _::RawBrandedSchema& schema); - friend kj::String _::enumString(uint16_t value, const _::RawBrandedSchema& schema); -}; - -kj::StringPtr KJ_STRINGIFY(const Schema& schema); - -class Schema::BrandArgumentList { - // A list of generic parameter bindings for parameters of some particular type. Note that since - // parameters on an outer type apply to all inner types as well, a deeply-nested type can have - // multiple BrandArgumentLists that apply to it. - // - // A BrandArgumentList only represents the arguments that the client of the type specified. Since - // new parameters can be added over time, this list may not cover all defined parameters for the - // type. Missing parameters should be treated as AnyPointer. This class's implementation of - // operator[] already does this for you; out-of-bounds access will safely return AnyPointer. - -public: - inline BrandArgumentList(): scopeId(0), size_(0), bindings(nullptr) {} - - inline uint size() const { return size_; } - Type operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - uint64_t scopeId; - uint size_; - bool isUnbound; - const _::RawBrandedSchema::Binding* bindings; - - inline BrandArgumentList(uint64_t scopeId, bool isUnbound) - : scopeId(scopeId), size_(0), isUnbound(isUnbound), bindings(nullptr) {} - inline BrandArgumentList(uint64_t scopeId, uint size, - const _::RawBrandedSchema::Binding* bindings) - : scopeId(scopeId), size_(size), isUnbound(false), bindings(bindings) {} - - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class StructSchema: public Schema { -public: - inline StructSchema(): Schema(&_::NULL_STRUCT_SCHEMA.defaultBrand) {} - - class Field; - class FieldList; - class FieldSubset; - - FieldList getFields() const; - // List top-level fields of this struct. This list will contain top-level groups (including - // named unions) but not the members of those groups. The list does, however, contain the - // members of the unnamed union, if there is one. - - FieldSubset getUnionFields() const; - // If the field contains an unnamed union, get a list of fields in the union, ordered by - // ordinal. Since discriminant values are assigned sequentially by ordinal, you may index this - // list by discriminant value. - - FieldSubset getNonUnionFields() const; - // Get the fields of this struct which are not in an unnamed union, ordered by ordinal. - - kj::Maybe findFieldByName(kj::StringPtr name) const; - // Find the field with the given name, or return null if there is no such field. If the struct - // contains an unnamed union, then this will find fields of that union in addition to fields - // of the outer struct, since they exist in the same namespace. It will not, however, find - // members of groups (including named unions) -- you must first look up the group itself, - // then dig into its type. - - Field getFieldByName(kj::StringPtr name) const; - // Like findFieldByName() but throws an exception on failure. - - kj::Maybe getFieldByDiscriminant(uint16_t discriminant) const; - // Finds the field whose `discriminantValue` is equal to the given value, or returns null if - // there is no such field. (If the schema does not represent a union or a struct containing - // an unnamed union, then this always returns null.) - -private: - StructSchema(Schema base): Schema(base) {} - template static inline StructSchema fromImpl() { - return StructSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class StructSchema::Field { -public: - Field() = default; - - inline schema::Field::Reader getProto() const { return proto; } - inline StructSchema getContainingStruct() const { return parent; } - - inline uint getIndex() const { return index; } - // Get the index of this field within the containing struct or union. - - Type getType() const; - // Get the type of this field. Note that this is preferred over getProto().getType() as this - // method will apply generics. - - uint32_t getDefaultValueSchemaOffset() const; - // For struct, list, and object fields, returns the offset, in words, within the first segment of - // the struct's schema, where this field's default value pointer is located. The schema is - // always stored as a single-segment unchecked message, which in turn means that the default - // value pointer itself can be treated as the root of an unchecked message -- if you know where - // to find it, which is what this method helps you with. - // - // For blobs, returns the offset of the beginning of the blob's content within the first segment - // of the struct's schema. - // - // This is primarily useful for code generators. The C++ code generator, for example, embeds - // the entire schema as a raw word array within the generated code. Of course, to implement - // field accessors, it needs access to those fields' default values. Embedding separate copies - // of those default values would be redundant since they are already included in the schema, but - // seeking through the schema at runtime to find the default values would be ugly. Instead, - // the code generator can use getDefaultValueSchemaOffset() to find the offset of the default - // value within the schema, and can simply apply that offset at runtime. - // - // If the above does not make sense, you probably don't need this method. - - inline bool operator==(const Field& other) const; - inline bool operator!=(const Field& other) const { return !(*this == other); } - -private: - StructSchema parent; - uint index; - schema::Field::Reader proto; - - inline Field(StructSchema parent, uint index, schema::Field::Reader proto) - : parent(parent), index(index), proto(proto) {} - - friend class StructSchema; -}; - -kj::StringPtr KJ_STRINGIFY(const StructSchema::Field& field); - -class StructSchema::FieldList { -public: - FieldList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Field operator[](uint index) const { return Field(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - - inline FieldList(StructSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class StructSchema; -}; - -class StructSchema::FieldSubset { -public: - FieldSubset() = default; // empty list - - inline uint size() const { return size_; } - inline Field operator[](uint index) const { - return Field(parent, indices[index], list[indices[index]]); - } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - StructSchema parent; - List::Reader list; - const uint16_t* indices; - uint size_; - - inline FieldSubset(StructSchema parent, List::Reader list, - const uint16_t* indices, uint size) - : parent(parent), list(list), indices(indices), size_(size) {} - - friend class StructSchema; -}; - -// ------------------------------------------------------------------- - -class EnumSchema: public Schema { -public: - inline EnumSchema(): Schema(&_::NULL_ENUM_SCHEMA.defaultBrand) {} - - class Enumerant; - class EnumerantList; - - EnumerantList getEnumerants() const; - - kj::Maybe findEnumerantByName(kj::StringPtr name) const; - - Enumerant getEnumerantByName(kj::StringPtr name) const; - // Like findEnumerantByName() but throws an exception on failure. - -private: - EnumSchema(Schema base): Schema(base) {} - template static inline EnumSchema fromImpl() { - return EnumSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; -}; - -class EnumSchema::Enumerant { -public: - Enumerant() = default; - - inline schema::Enumerant::Reader getProto() const { return proto; } - inline EnumSchema getContainingEnum() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - inline bool operator==(const Enumerant& other) const; - inline bool operator!=(const Enumerant& other) const { return !(*this == other); } - -private: - EnumSchema parent; - uint16_t ordinal; - schema::Enumerant::Reader proto; - - inline Enumerant(EnumSchema parent, uint16_t ordinal, schema::Enumerant::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class EnumSchema; -}; - -class EnumSchema::EnumerantList { -public: - EnumerantList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Enumerant operator[](uint index) const { return Enumerant(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - EnumSchema parent; - List::Reader list; - - inline EnumerantList(EnumSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class EnumSchema; -}; - -// ------------------------------------------------------------------- - -class InterfaceSchema: public Schema { -public: - inline InterfaceSchema(): Schema(&_::NULL_INTERFACE_SCHEMA.defaultBrand) {} - - class Method; - class MethodList; - - MethodList getMethods() const; - - kj::Maybe findMethodByName(kj::StringPtr name) const; - - Method getMethodByName(kj::StringPtr name) const; - // Like findMethodByName() but throws an exception on failure. - - class SuperclassList; - - SuperclassList getSuperclasses() const; - // Get the immediate superclasses of this type, after applying generics. - - bool extends(InterfaceSchema other) const; - // Returns true if `other` is a superclass of this interface (including if `other == *this`). - - kj::Maybe findSuperclass(uint64_t typeId) const; - // Find the superclass of this interface with the given type ID. Returns null if the interface - // extends no such type. - -private: - InterfaceSchema(Schema base): Schema(base) {} - template static inline InterfaceSchema fromImpl() { - return InterfaceSchema(Schema(&_::rawBrandedSchema())); - } - friend class Schema; - friend class Type; - - kj::Maybe findMethodByName(kj::StringPtr name, uint& counter) const; - bool extends(InterfaceSchema other, uint& counter) const; - kj::Maybe findSuperclass(uint64_t typeId, uint& counter) const; - // We protect against malicious schemas with large or cyclic hierarchies by cutting off the - // search when the counter reaches a threshold. -}; - -class InterfaceSchema::Method { -public: - Method() = default; - - inline schema::Method::Reader getProto() const { return proto; } - inline InterfaceSchema getContainingInterface() const { return parent; } - - inline uint16_t getOrdinal() const { return ordinal; } - inline uint getIndex() const { return ordinal; } - - StructSchema getParamType() const; - StructSchema getResultType() const; - // Get the parameter and result types, including substituting generic parameters. - - inline bool operator==(const Method& other) const; - inline bool operator!=(const Method& other) const { return !(*this == other); } - -private: - InterfaceSchema parent; - uint16_t ordinal; - schema::Method::Reader proto; - - inline Method(InterfaceSchema parent, uint16_t ordinal, - schema::Method::Reader proto) - : parent(parent), ordinal(ordinal), proto(proto) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::MethodList { -public: - MethodList() = default; // empty list - - inline uint size() const { return list.size(); } - inline Method operator[](uint index) const { return Method(parent, index, list[index]); } - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline MethodList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -class InterfaceSchema::SuperclassList { -public: - SuperclassList() = default; // empty list - - inline uint size() const { return list.size(); } - InterfaceSchema operator[](uint index) const; - - typedef _::IndexingIterator Iterator; - inline Iterator begin() const { return Iterator(this, 0); } - inline Iterator end() const { return Iterator(this, size()); } - -private: - InterfaceSchema parent; - List::Reader list; - - inline SuperclassList(InterfaceSchema parent, List::Reader list) - : parent(parent), list(list) {} - - friend class InterfaceSchema; -}; - -// ------------------------------------------------------------------- - -class ConstSchema: public Schema { - // Represents a constant declaration. - // - // `ConstSchema` can be implicitly cast to DynamicValue to read its value. - -public: - inline ConstSchema(): Schema(&_::NULL_CONST_SCHEMA.defaultBrand) {} - - template - ReaderFor as() const; - // Read the constant's value. This is a convenience method equivalent to casting the ConstSchema - // to a DynamicValue and then calling its `as()` method. For dependency reasons, this method - // is defined in , which you must #include explicitly. - - uint32_t getValueSchemaOffset() const; - // Much like StructSchema::Field::getDefaultValueSchemaOffset(), if the constant has pointer - // type, this gets the offset from the beginning of the constant's schema node to a pointer - // representing the constant value. - - Type getType() const; - -private: - ConstSchema(Schema base): Schema(base) {} - friend class Schema; -}; - -// ------------------------------------------------------------------- - -class Type { -public: - struct BrandParameter { - uint64_t scopeId; - uint index; - }; - struct ImplicitParameter { - uint index; - }; - - inline Type(); - inline Type(schema::Type::Which primitive); - inline Type(StructSchema schema); - inline Type(EnumSchema schema); - inline Type(InterfaceSchema schema); - inline Type(ListSchema schema); - inline Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind); - inline Type(BrandParameter param); - inline Type(ImplicitParameter param); - - template - inline static Type from(); - - inline schema::Type::Which which() const; - - StructSchema asStruct() const; - EnumSchema asEnum() const; - InterfaceSchema asInterface() const; - ListSchema asList() const; - // Each of these methods may only be called if which() returns the corresponding type. - - kj::Maybe getBrandParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. - - kj::Maybe getImplicitParameter() const; - // Only callable if which() returns ANY_POINTER. Returns null if the type is just a regular - // AnyPointer and not a parameter. "Implicit parameters" refer to type parameters on methods. - - inline schema::Type::AnyPointer::Unconstrained::Which whichAnyPointerKind() const; - // Only callable if which() returns ANY_POINTER. - - inline bool isVoid() const; - inline bool isBool() const; - inline bool isInt8() const; - inline bool isInt16() const; - inline bool isInt32() const; - inline bool isInt64() const; - inline bool isUInt8() const; - inline bool isUInt16() const; - inline bool isUInt32() const; - inline bool isUInt64() const; - inline bool isFloat32() const; - inline bool isFloat64() const; - inline bool isText() const; - inline bool isData() const; - inline bool isList() const; - inline bool isEnum() const; - inline bool isStruct() const; - inline bool isInterface() const; - inline bool isAnyPointer() const; - - bool operator==(const Type& other) const; - inline bool operator!=(const Type& other) const { return !(*this == other); } - - size_t hashCode() const; - - inline Type wrapInList(uint depth = 1) const; - // Return the Type formed by wrapping this type in List() `depth` times. - - inline Type(schema::Type::Which derived, const _::RawBrandedSchema* schema); - // For internal use. - -private: - schema::Type::Which baseType; // type not including applications of List() - uint8_t listDepth; // 0 for T, 1 for List(T), 2 for List(List(T)), ... - - bool isImplicitParam; - // If true, this refers to an implicit method parameter. baseType must be ANY_POINTER, scopeId - // must be zero, and paramIndex indicates the parameter index. - - union { - uint16_t paramIndex; - // If baseType is ANY_POINTER but this Type actually refers to a type parameter, this is the - // index of the parameter among the parameters at its scope, and `scopeId` below is the type ID - // of the scope where the parameter was defined. - - schema::Type::AnyPointer::Unconstrained::Which anyPointerKind; - // If scopeId is zero and isImplicitParam is false. - }; - - union { - const _::RawBrandedSchema* schema; // if type is struct, enum, interface... - uint64_t scopeId; // if type is AnyPointer but it's actually a type parameter... - }; - - Type(schema::Type::Which baseType, uint8_t listDepth, const _::RawBrandedSchema* schema) - : baseType(baseType), listDepth(listDepth), schema(schema) { - KJ_IREQUIRE(baseType != schema::Type::ANY_POINTER); - } - - void requireUsableAs(Type expected) const; - - friend class ListSchema; // only for requireUsableAs() -}; - -// ------------------------------------------------------------------- - -class ListSchema { - // ListSchema is a little different because list types are not described by schema nodes. So, - // ListSchema doesn't subclass Schema. - -public: - ListSchema() = default; - - static ListSchema of(schema::Type::Which primitiveType); - static ListSchema of(StructSchema elementType); - static ListSchema of(EnumSchema elementType); - static ListSchema of(InterfaceSchema elementType); - static ListSchema of(ListSchema elementType); - static ListSchema of(Type elementType); - // Construct the schema for a list of the given type. - - static ListSchema of(schema::Type::Reader elementType, Schema context) - KJ_DEPRECATED("Does not handle generics correctly."); - // DEPRECATED: This method cannot correctly account for generic type parameter bindings that - // may apply to the input type. Instead of using this method, use a method of the Schema API - // that corresponds to the exact kind of dependency. For example, to get a field type, use - // StructSchema::Field::getType(). - // - // Construct from an element type schema. Requires a context which can handle getDependency() - // requests for any type ID found in the schema. - - Type getElementType() const; - - inline schema::Type::Which whichElementType() const; - // Get the element type's "which()". ListSchema does not actually store a schema::Type::Reader - // describing the element type, but if it did, this would be equivalent to calling - // .getBody().which() on that type. - - StructSchema getStructElementType() const; - EnumSchema getEnumElementType() const; - InterfaceSchema getInterfaceElementType() const; - ListSchema getListElementType() const; - // Get the schema for complex element types. Each of these throws an exception if the element - // type is not of the requested kind. - - inline bool operator==(const ListSchema& other) const { return elementType == other.elementType; } - inline bool operator!=(const ListSchema& other) const { return elementType != other.elementType; } - - template - void requireUsableAs() const; - -private: - Type elementType; - - inline explicit ListSchema(Type elementType): elementType(elementType) {} - - template - struct FromImpl; - template static inline ListSchema fromImpl() { - return FromImpl::get(); - } - - void requireUsableAs(ListSchema expected) const; - - friend class Schema; -}; - -// ======================================================================================= -// inline implementation - -template <> inline schema::Type::Which Schema::from() { return schema::Type::VOID; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::BOOL; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::INT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT8; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT16; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::UINT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT32; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::FLOAT64; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::TEXT; } -template <> inline schema::Type::Which Schema::from() { return schema::Type::DATA; } - -inline Schema Schema::getDependency(uint64_t id) const { - return getDependency(id, 0); -} - -inline bool Schema::isBranded() const { - return raw != &raw->generic->defaultBrand; -} - -inline Schema Schema::getGeneric() const { - return Schema(&raw->generic->defaultBrand); -} - -template -inline void Schema::requireUsableAs() const { - requireUsableAs(&_::rawSchema()); -} - -inline bool StructSchema::Field::operator==(const Field& other) const { - return parent == other.parent && index == other.index; -} -inline bool EnumSchema::Enumerant::operator==(const Enumerant& other) const { - return parent == other.parent && ordinal == other.ordinal; -} -inline bool InterfaceSchema::Method::operator==(const Method& other) const { - return parent == other.parent && ordinal == other.ordinal; -} - -inline ListSchema ListSchema::of(StructSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(EnumSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(InterfaceSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(ListSchema elementType) { - return ListSchema(Type(elementType)); -} -inline ListSchema ListSchema::of(Type elementType) { - return ListSchema(elementType); -} - -inline Type ListSchema::getElementType() const { - return elementType; -} - -inline schema::Type::Which ListSchema::whichElementType() const { - return elementType.which(); -} - -inline StructSchema ListSchema::getStructElementType() const { - return elementType.asStruct(); -} - -inline EnumSchema ListSchema::getEnumElementType() const { - return elementType.asEnum(); -} - -inline InterfaceSchema ListSchema::getInterfaceElementType() const { - return elementType.asInterface(); -} - -inline ListSchema ListSchema::getListElementType() const { - return elementType.asList(); -} - -template -inline void ListSchema::requireUsableAs() const { - static_assert(kind() == Kind::LIST, - "ListSchema::requireUsableAs() requires T is a list type."); - requireUsableAs(Schema::from()); -} - -inline void ListSchema::requireUsableAs(ListSchema expected) const { - elementType.requireUsableAs(expected.elementType); -} - -template -struct ListSchema::FromImpl> { - static inline ListSchema get() { return of(Schema::from()); } -}; - -inline Type::Type(): baseType(schema::Type::VOID), listDepth(0), schema(nullptr) {} -inline Type::Type(schema::Type::Which primitive) - : baseType(primitive), listDepth(0), isImplicitParam(false) { - KJ_IREQUIRE(primitive != schema::Type::STRUCT && - primitive != schema::Type::ENUM && - primitive != schema::Type::INTERFACE && - primitive != schema::Type::LIST); - if (primitive == schema::Type::ANY_POINTER) { - scopeId = 0; - anyPointerKind = schema::Type::AnyPointer::Unconstrained::ANY_KIND; - } else { - schema = nullptr; - } -} -inline Type::Type(schema::Type::Which derived, const _::RawBrandedSchema* schema) - : baseType(derived), listDepth(0), isImplicitParam(false), schema(schema) { - KJ_IREQUIRE(derived == schema::Type::STRUCT || - derived == schema::Type::ENUM || - derived == schema::Type::INTERFACE); -} - -inline Type::Type(StructSchema schema) - : baseType(schema::Type::STRUCT), listDepth(0), schema(schema.raw) {} -inline Type::Type(EnumSchema schema) - : baseType(schema::Type::ENUM), listDepth(0), schema(schema.raw) {} -inline Type::Type(InterfaceSchema schema) - : baseType(schema::Type::INTERFACE), listDepth(0), schema(schema.raw) {} -inline Type::Type(ListSchema schema) - : Type(schema.getElementType()) { ++listDepth; } -inline Type::Type(schema::Type::AnyPointer::Unconstrained::Which anyPointerKind) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - anyPointerKind(anyPointerKind), scopeId(0) {} -inline Type::Type(BrandParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(false), - paramIndex(param.index), scopeId(param.scopeId) {} -inline Type::Type(ImplicitParameter param) - : baseType(schema::Type::ANY_POINTER), listDepth(0), isImplicitParam(true), - paramIndex(param.index), scopeId(0) {} - -inline schema::Type::Which Type::which() const { - return listDepth > 0 ? schema::Type::LIST : baseType; -} - -inline schema::Type::AnyPointer::Unconstrained::Which Type::whichAnyPointerKind() const { - KJ_IREQUIRE(baseType == schema::Type::ANY_POINTER); - return !isImplicitParam && scopeId == 0 ? anyPointerKind - : schema::Type::AnyPointer::Unconstrained::ANY_KIND; -} - -template -inline Type Type::from() { return Type(Schema::from()); } - -inline bool Type::isVoid () const { return baseType == schema::Type::VOID && listDepth == 0; } -inline bool Type::isBool () const { return baseType == schema::Type::BOOL && listDepth == 0; } -inline bool Type::isInt8 () const { return baseType == schema::Type::INT8 && listDepth == 0; } -inline bool Type::isInt16 () const { return baseType == schema::Type::INT16 && listDepth == 0; } -inline bool Type::isInt32 () const { return baseType == schema::Type::INT32 && listDepth == 0; } -inline bool Type::isInt64 () const { return baseType == schema::Type::INT64 && listDepth == 0; } -inline bool Type::isUInt8 () const { return baseType == schema::Type::UINT8 && listDepth == 0; } -inline bool Type::isUInt16 () const { return baseType == schema::Type::UINT16 && listDepth == 0; } -inline bool Type::isUInt32 () const { return baseType == schema::Type::UINT32 && listDepth == 0; } -inline bool Type::isUInt64 () const { return baseType == schema::Type::UINT64 && listDepth == 0; } -inline bool Type::isFloat32() const { return baseType == schema::Type::FLOAT32 && listDepth == 0; } -inline bool Type::isFloat64() const { return baseType == schema::Type::FLOAT64 && listDepth == 0; } -inline bool Type::isText () const { return baseType == schema::Type::TEXT && listDepth == 0; } -inline bool Type::isData () const { return baseType == schema::Type::DATA && listDepth == 0; } -inline bool Type::isList () const { return listDepth > 0; } -inline bool Type::isEnum () const { return baseType == schema::Type::ENUM && listDepth == 0; } -inline bool Type::isStruct () const { return baseType == schema::Type::STRUCT && listDepth == 0; } -inline bool Type::isInterface() const { - return baseType == schema::Type::INTERFACE && listDepth == 0; -} -inline bool Type::isAnyPointer() const { - return baseType == schema::Type::ANY_POINTER && listDepth == 0; -} - -inline Type Type::wrapInList(uint depth) const { - Type result = *this; - result.listDepth += depth; - return result; -} - -} // namespace capnp - -#endif // CAPNP_SCHEMA_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/serialize-async.h b/phonelibs/capnp-cpp/mac/include/capnp/serialize-async.h deleted file mode 100644 index a16bfd8975..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/serialize-async.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_ASYNC_H_ -#define CAPNP_SERIALIZE_ASYNC_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "message.h" - -namespace capnp { - -kj::Promise> readMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Read a message asynchronously. -// -// `input` must remain valid until the returned promise resolves (or is canceled). -// -// `scratchSpace`, if provided, must remain valid until the returned MessageReader is destroyed. - -kj::Promise>> tryReadMessage( - kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Like `readMessage` but returns null on EOF. - -kj::Promise writeMessage(kj::AsyncOutputStream& output, - kj::ArrayPtr> segments) - KJ_WARN_UNUSED_RESULT; -kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) - KJ_WARN_UNUSED_RESULT; -// Write asynchronously. The parameters must remain valid until the returned promise resolves. - -// ======================================================================================= -// inline implementation details - -inline kj::Promise writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) { - return writeMessage(output, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_ASYNC_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/serialize-packed.h b/phonelibs/capnp-cpp/mac/include/capnp/serialize-packed.h deleted file mode 100644 index a71260ce1d..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/serialize-packed.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_PACKED_H_ -#define CAPNP_SERIALIZE_PACKED_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "serialize.h" - -namespace capnp { - -namespace _ { // private - -class PackedInputStream: public kj::InputStream { - // An input stream that unpacks packed data with a picky constraint: The caller must read data - // in the exact same size and sequence as the data was written to PackedOutputStream. - -public: - explicit PackedInputStream(kj::BufferedInputStream& inner); - KJ_DISALLOW_COPY(PackedInputStream); - ~PackedInputStream() noexcept(false); - - // implements InputStream ------------------------------------------ - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - kj::BufferedInputStream& inner; -}; - -class PackedOutputStream: public kj::OutputStream { -public: - explicit PackedOutputStream(kj::BufferedOutputStream& inner); - KJ_DISALLOW_COPY(PackedOutputStream); - ~PackedOutputStream() noexcept(false); - - // implements OutputStream ----------------------------------------- - void write(const void* buffer, size_t bytes) override; - -private: - kj::BufferedOutputStream& inner; -}; - -} // namespace _ (private) - -class PackedMessageReader: private _::PackedInputStream, public InputStreamMessageReader { -public: - PackedMessageReader(kj::BufferedInputStream& inputStream, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - KJ_DISALLOW_COPY(PackedMessageReader); - ~PackedMessageReader() noexcept(false); -}; - -class PackedFdMessageReader: private kj::FdInputStream, private kj::BufferedInputStreamWrapper, - public PackedMessageReader { -public: - PackedFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read message from a file descriptor, without taking ownership of the descriptor. - // Note that if you want to reuse the descriptor after the reader is destroyed, you'll need to - // seek it, since otherwise the position is unspecified. - - PackedFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - // Read a message from a file descriptor, taking ownership of the descriptor. - - KJ_DISALLOW_COPY(PackedFdMessageReader); - - ~PackedFdMessageReader() noexcept(false); -}; - -void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::BufferedOutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to a buffered output stream. - -void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder); -void writePackedMessage(kj::OutputStream& output, - kj::ArrayPtr> segments); -// Write a packed message to an unbuffered output stream. If you intend to write multiple messages -// in succession, consider wrapping your output in a buffered stream in order to reduce system -// call overhead. - -void writePackedMessageToFd(int fd, MessageBuilder& builder); -void writePackedMessageToFd(int fd, kj::ArrayPtr> segments); -// Write a single packed message to the file descriptor. - -size_t computeUnpackedSizeInWords(kj::ArrayPtr packedBytes); -// Computes the number of words to which the given packed bytes will unpack. Not intended for use -// in performance-sensitive situations. - -// ======================================================================================= -// inline stuff - -inline void writePackedMessage(kj::BufferedOutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessage(kj::OutputStream& output, MessageBuilder& builder) { - writePackedMessage(output, builder.getSegmentsForOutput()); -} - -inline void writePackedMessageToFd(int fd, MessageBuilder& builder) { - writePackedMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_PACKED_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/serialize-text.h b/phonelibs/capnp-cpp/mac/include/capnp/serialize-text.h deleted file mode 100644 index d86fc2c00e..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/serialize-text.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015 Philip Quinn. -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef CAPNP_SERIALIZE_TEXT_H_ -#define CAPNP_SERIALIZE_TEXT_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include -#include "dynamic.h" -#include "orphan.h" -#include "schema.h" - -namespace capnp { - -class TextCodec { - // Reads and writes Cap'n Proto objects in a plain text format (as used in the schema - // language for constants, and read/written by the 'decode' and 'encode' commands of - // the capnp tool). - // - // This format is useful for debugging or human input, but it is not a robust alternative - // to the binary format. Changes to a schema's types or names that are permitted in a - // schema's binary evolution will likely break messages stored in this format. - // - // Note that definitions or references (to constants, other fields, or files) are not - // permitted in this format. To evaluate declarations with the full expressiveness of the - // schema language, see `capnp::SchemaParser`. - // - // Requires linking with the capnpc library. - -public: - TextCodec(); - ~TextCodec() noexcept(true); - - void setPrettyPrint(bool enabled); - // If enabled, pads the output of `encode()` with spaces and newlines to make it more - // human-readable. - - template - kj::String encode(T&& value) const; - kj::String encode(DynamicValue::Reader value) const; - // Encode any Cap'n Proto value. - - template - Orphan decode(kj::StringPtr input, Orphanage orphanage) const; - // Decode a text message into a Cap'n Proto object of type T, allocated in the given - // orphanage. Any errors parsing the input or assigning the fields of T are thrown as - // exceptions. - - void decode(kj::StringPtr input, DynamicStruct::Builder output) const; - // Decode a text message for a struct into the given builder. Any errors parsing the - // input or assigning the fields of the output are thrown as exceptions. - - // TODO(someday): expose some control over the error handling? -private: - Orphan decode(kj::StringPtr input, Type type, Orphanage orphanage) const; - - bool prettyPrint; -}; - -// ======================================================================================= -// inline stuff - -template -inline kj::String TextCodec::encode(T&& value) const { - return encode(DynamicValue::Reader(ReaderFor>(kj::fwd(value)))); -} - -template -inline Orphan TextCodec::decode(kj::StringPtr input, Orphanage orphanage) const { - return decode(input, Type::from(), orphanage).template releaseAs(); -} - -} // namespace capnp - -#endif // CAPNP_SERIALIZE_TEXT_H_ diff --git a/phonelibs/capnp-cpp/mac/include/capnp/serialize.h b/phonelibs/capnp-cpp/mac/include/capnp/serialize.h deleted file mode 100644 index 797db51766..0000000000 --- a/phonelibs/capnp-cpp/mac/include/capnp/serialize.h +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file implements a simple serialization format for Cap'n Proto messages. The format -// is as follows: -// -// * 32-bit little-endian segment count (4 bytes). -// * 32-bit little-endian size of each segment (4*(segment count) bytes). -// * Padding so that subsequent data is 64-bit-aligned (0 or 4 bytes). (I.e., if there are an even -// number of segments, there are 4 bytes of zeros here, otherwise there is no padding.) -// * Data from each segment, in order (8*sum(segment sizes) bytes) -// -// This format has some important properties: -// - It is self-delimiting, so multiple messages may be written to a stream without any external -// delimiter. -// - The total size and position of each segment can be determined by reading only the first part -// of the message, allowing lazy and random-access reading of the segment data. -// - A message is always at least 8 bytes. -// - A single-segment message can be read entirely in two system calls with no buffering. -// - A multi-segment message can be read entirely in three system calls with no buffering. -// - The format is appropriate for mmap()ing since all data is aligned. - -#ifndef CAPNP_SERIALIZE_H_ -#define CAPNP_SERIALIZE_H_ - -#if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS) -#pragma GCC system_header -#endif - -#include "message.h" -#include - -namespace capnp { - -class FlatArrayMessageReader: public MessageReader { - // Parses a message from a flat array. Note that it makes sense to use this together with mmap() - // for extremely fast parsing. - -public: - FlatArrayMessageReader(kj::ArrayPtr array, ReaderOptions options = ReaderOptions()); - // The array must remain valid until the MessageReader is destroyed. - - kj::ArrayPtr getSegment(uint id) override; - - const word* getEnd() const { return end; } - // Get a pointer just past the end of the message as determined by reading the message header. - // This could actually be before the end of the input array. This pointer is useful e.g. if - // you know that the input array has extra stuff appended after the message and you want to - // get at it. - -private: - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - const word* end; -}; - -kj::ArrayPtr initMessageBuilderFromFlatArrayCopy( - kj::ArrayPtr array, MessageBuilder& target, - ReaderOptions options = ReaderOptions()); -// Convenience function which reads a message using `FlatArrayMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// Returns an ArrayPtr containing any words left over in the array after consuming the whole -// message. This is useful when reading multiple messages that have been concatenated. See also -// FlatArrayMessageReader::getEnd(). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -kj::Array messageToFlatArray(MessageBuilder& builder); -// Constructs a flat array containing the entire content of the given message. -// -// To output the message as bytes, use `.asBytes()` on the returned word array. Keep in mind that -// `asBytes()` returns an ArrayPtr, so you have to save the Array as well to prevent it from being -// deleted. For example: -// -// kj::Array words = messageToFlatArray(myMessage); -// kj::ArrayPtr bytes = words.asBytes(); -// write(fd, bytes.begin(), bytes.size()); - -kj::Array messageToFlatArray(kj::ArrayPtr> segments); -// Version of messageToFlatArray that takes a raw segment array. - -size_t computeSerializedSizeInWords(MessageBuilder& builder); -// Returns the size, in words, that will be needed to serialize the message, including the header. - -size_t computeSerializedSizeInWords(kj::ArrayPtr> segments); -// Version of computeSerializedSizeInWords that takes a raw segment array. - -size_t expectedSizeInWordsFromPrefix(kj::ArrayPtr messagePrefix); -// Given a prefix of a serialized message, try to determine the expected total size of the message, -// in words. The returned size is based on the information known so far; it may be an underestimate -// if the prefix doesn't contain the full segment table. -// -// If the returned value is greater than `messagePrefix.size()`, then the message is not yet -// complete and the app cannot parse it yet. If the returned value is less than or equal to -// `messagePrefix.size()`, then the returned value is the exact total size of the message; any -// remaining bytes are part of the next message. -// -// This function is useful when reading messages from a stream in an asynchronous way, but when -// using the full KJ async infrastructure would be too difficult. Each time bytes are received, -// use this function to determine if an entire message is ready to be parsed. - -// ======================================================================================= - -class InputStreamMessageReader: public MessageReader { - // A MessageReader that reads from an abstract kj::InputStream. See also StreamFdMessageReader - // for a subclass specific to file descriptors. - -public: - InputStreamMessageReader(kj::InputStream& inputStream, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); - ~InputStreamMessageReader() noexcept(false); - - // implements MessageReader ---------------------------------------- - kj::ArrayPtr getSegment(uint id) override; - -private: - kj::InputStream& inputStream; - byte* readPos; - - // Optimize for single-segment case. - kj::ArrayPtr segment0; - kj::Array> moreSegments; - - kj::Array ownedSpace; - // Only if scratchSpace wasn't big enough. - - kj::UnwindDetector unwindDetector; -}; - -void readMessageCopy(kj::InputStream& input, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `InputStreamMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessage(kj::OutputStream& output, MessageBuilder& builder); -// Write the message to the given output stream. - -void writeMessage(kj::OutputStream& output, kj::ArrayPtr> segments); -// Write the segment array to the given output stream. - -// ======================================================================================= -// Specializations for reading from / writing to file descriptors. - -class StreamFdMessageReader: private kj::FdInputStream, public InputStreamMessageReader { - // A MessageReader that reads from a steam-based file descriptor. - -public: - StreamFdMessageReader(int fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(fd), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read message from a file descriptor, without taking ownership of the descriptor. - - StreamFdMessageReader(kj::AutoCloseFd fd, ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr) - : FdInputStream(kj::mv(fd)), InputStreamMessageReader(*this, options, scratchSpace) {} - // Read a message from a file descriptor, taking ownership of the descriptor. - - ~StreamFdMessageReader() noexcept(false); -}; - -void readMessageCopyFromFd(int fd, MessageBuilder& target, - ReaderOptions options = ReaderOptions(), - kj::ArrayPtr scratchSpace = nullptr); -// Convenience function which reads a message using `StreamFdMessageReader` then copies the -// content into the target `MessageBuilder`, verifying that the message structure is valid -// (although not necessarily that it matches the desired schema). -// -// (Note that it's also possible to initialize a `MessageBuilder` directly without a copy using one -// of `MessageBuilder`'s constructors. However, this approach skips the validation step and is not -// safe to use on untrusted input. Therefore, we do not provide a convenience method for it.) - -void writeMessageToFd(int fd, MessageBuilder& builder); -// Write the message to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -void writeMessageToFd(int fd, kj::ArrayPtr> segments); -// Write the segment array to the given file descriptor. -// -// This function throws an exception on any I/O error. If your code is not exception-safe, be sure -// you catch this exception at the call site. If throwing an exception is not acceptable, you -// can implement your own OutputStream with arbitrary error handling and then use writeMessage(). - -// ======================================================================================= -// inline stuff - -inline kj::Array messageToFlatArray(MessageBuilder& builder) { - return messageToFlatArray(builder.getSegmentsForOutput()); -} - -inline size_t computeSerializedSizeInWords(MessageBuilder& builder) { - return computeSerializedSizeInWords(builder.getSegmentsForOutput()); -} - -inline void writeMessage(kj::OutputStream& output, MessageBuilder& builder) { - writeMessage(output, builder.getSegmentsForOutput()); -} - -inline void writeMessageToFd(int fd, MessageBuilder& builder) { - writeMessageToFd(fd, builder.getSegmentsForOutput()); -} - -} // namespace capnp - -#endif // SERIALIZE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/arena.h b/phonelibs/capnp-cpp/mac/include/kj/arena.h deleted file mode 100644 index 32c1f61c51..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/arena.h +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARENA_H_ -#define KJ_ARENA_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class Arena { - // A class which allows several objects to be allocated in contiguous chunks of memory, then - // frees them all at once. - // - // Allocating from the same Arena in multiple threads concurrently is NOT safe, because making - // it safe would require atomic operations that would slow down allocation even when - // single-threaded. If you need to use arena allocation in a multithreaded context, consider - // allocating thread-local arenas. - -public: - explicit Arena(size_t chunkSizeHint = 1024); - // Create an Arena. `chunkSizeHint` hints at where to start when allocating chunks, but is only - // a hint -- the Arena will, for example, allocate progressively larger chunks as time goes on, - // in order to reduce overall allocation overhead. - - explicit Arena(ArrayPtr scratch); - // Allocates from the given scratch space first, only resorting to the heap when it runs out. - - KJ_DISALLOW_COPY(Arena); - ~Arena() noexcept(false); - - template - T& allocate(Params&&... params); - template - ArrayPtr allocateArray(size_t size); - // Allocate an object or array of type T. If T has a non-trivial destructor, that destructor - // will be run during the Arena's destructor. Such destructors are run in opposite order of - // allocation. Note that these methods must maintain a list of destructors to call, which has - // overhead, but this overhead only applies if T has a non-trivial destructor. - - template - Own allocateOwn(Params&&... params); - template - Array allocateOwnArray(size_t size); - template - ArrayBuilder allocateOwnArrayBuilder(size_t capacity); - // Allocate an object or array of type T. Destructors are executed when the returned Own - // or Array goes out-of-scope, which must happen before the Arena is destroyed. This variant - // is useful when you need to control when the destructor is called. This variant also avoids - // the need for the Arena itself to keep track of destructors to call later, which may make it - // slightly more efficient. - - template - inline T& copy(T&& value) { return allocate>(kj::fwd(value)); } - // Allocate a copy of the given value in the arena. This is just a shortcut for calling the - // type's copy (or move) constructor. - - StringPtr copyString(StringPtr content); - // Make a copy of the given string inside the arena, and return a pointer to the copy. - -private: - struct ChunkHeader { - ChunkHeader* next; - byte* pos; // first unallocated byte in this chunk - byte* end; // end of this chunk - }; - struct ObjectHeader { - void (*destructor)(void*); - ObjectHeader* next; - }; - - size_t nextChunkSize; - ChunkHeader* chunkList = nullptr; - ObjectHeader* objectList = nullptr; - - ChunkHeader* currentChunk = nullptr; - - void cleanup(); - // Run all destructors, leaving the above pointers null. If a destructor throws, the State is - // left in a consistent state, such that if cleanup() is called again, it will pick up where - // it left off. - - void* allocateBytes(size_t amount, uint alignment, bool hasDisposer); - // Allocate the given number of bytes. `hasDisposer` must be true if `setDisposer()` may be - // called on this pointer later. - - void* allocateBytesInternal(size_t amount, uint alignment); - // Try to allocate the given number of bytes without taking a lock. Fails if and only if there - // is no space left in the current chunk. - - void setDestructor(void* ptr, void (*destructor)(void*)); - // Schedule the given destructor to be executed when the Arena is destroyed. `ptr` must be a - // pointer previously returned by an `allocateBytes()` call for which `hasDisposer` was true. - - template - static void destroyArray(void* pointer) { - size_t elementCount = *reinterpret_cast(pointer); - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - DestructorOnlyArrayDisposer::instance.disposeImpl( - reinterpret_cast(pointer) + prefixSize, - sizeof(T), elementCount, elementCount, &destroyObject); - } - - template - static void destroyObject(void* pointer) { - dtor(*reinterpret_cast(pointer)); - } -}; - -// ======================================================================================= -// Inline implementation details - -template -T& Arena::allocate(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes( - sizeof(T), alignof(T), !__has_trivial_destructor(T))); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - if (!__has_trivial_destructor(T)) { - setDestructor(&result, &destroyObject); - } - return result; -} - -template -ArrayPtr Arena::allocateArray(size_t size) { - if (__has_trivial_destructor(T)) { - ArrayPtr result = - arrayPtr(reinterpret_cast(allocateBytes( - sizeof(T) * size, alignof(T), false)), size); - if (!__has_trivial_constructor(T)) { - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - } - } - return result; - } else { - // Allocate with a 64-bit prefix in which we store the array size. - constexpr size_t prefixSize = kj::max(alignof(T), sizeof(size_t)); - void* base = allocateBytes(sizeof(T) * size + prefixSize, alignof(T), true); - size_t& tag = *reinterpret_cast(base); - ArrayPtr result = - arrayPtr(reinterpret_cast(reinterpret_cast(base) + prefixSize), size); - setDestructor(base, &destroyArray); - - if (__has_trivial_constructor(T)) { - tag = size; - } else { - // In case of constructor exceptions, we need the tag to end up storing the number of objects - // that were successfully constructed, so that they'll be properly destroyed. - tag = 0; - for (size_t i = 0; i < size; i++) { - ctor(result[i]); - tag = i + 1; - } - } - return result; - } -} - -template -Own Arena::allocateOwn(Params&&... params) { - T& result = *reinterpret_cast(allocateBytes(sizeof(T), alignof(T), false)); - if (!__has_trivial_constructor(T) || sizeof...(Params) > 0) { - ctor(result, kj::fwd(params)...); - } - return Own(&result, DestructorOnlyDisposer::instance); -} - -template -Array Arena::allocateOwnArray(size_t size) { - ArrayBuilder result = allocateOwnArrayBuilder(size); - for (size_t i = 0; i < size; i++) { - result.add(); - } - return result.finish(); -} - -template -ArrayBuilder Arena::allocateOwnArrayBuilder(size_t capacity) { - return ArrayBuilder( - reinterpret_cast(allocateBytes(sizeof(T) * capacity, alignof(T), false)), - capacity, DestructorOnlyArrayDisposer::instance); -} - -} // namespace kj - -#endif // KJ_ARENA_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/array.h b/phonelibs/capnp-cpp/mac/include/kj/array.h deleted file mode 100644 index 51b5dcf319..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/array.h +++ /dev/null @@ -1,813 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ARRAY_H_ -#define KJ_ARRAY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include -#include - -namespace kj { - -// ======================================================================================= -// ArrayDisposer -- Implementation details. - -class ArrayDisposer { - // Much like Disposer from memory.h. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for - // HeapArrayDisposer::instance. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const = 0; - // Disposes of the array. `destroyElement` invokes the destructor of each element, or is nullptr - // if the elements have trivial destructors. `capacity` is the amount of space that was - // allocated while `elementCount` is the number of elements that were actually constructed; - // these are always the same number for Array but may be different when using ArrayBuilder. - -public: - - template - void dispose(T* firstElement, size_t elementCount, size_t capacity) const; - // Helper wrapper around disposeImpl(). - // - // Callers must not call dispose() on the same array twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -class ExceptionSafeArrayUtil { - // Utility class that assists in constructing or destroying elements of an array, where the - // constructor or destructor could throw exceptions. In case of an exception, - // ExceptionSafeArrayUtil's destructor will call destructors on all elements that have been - // constructed but not destroyed. Remember that destructors that throw exceptions are required - // to use UnwindDetector to detect unwind and avoid exceptions in this case. Therefore, no more - // than one exception will be thrown (and the program will not terminate). - -public: - inline ExceptionSafeArrayUtil(void* ptr, size_t elementSize, size_t constructedElementCount, - void (*destroyElement)(void*)) - : pos(reinterpret_cast(ptr) + elementSize * constructedElementCount), - elementSize(elementSize), constructedElementCount(constructedElementCount), - destroyElement(destroyElement) {} - KJ_DISALLOW_COPY(ExceptionSafeArrayUtil); - - inline ~ExceptionSafeArrayUtil() noexcept(false) { - if (constructedElementCount > 0) destroyAll(); - } - - void construct(size_t count, void (*constructElement)(void*)); - // Construct the given number of elements. - - void destroyAll(); - // Destroy all elements. Call this immediately before ExceptionSafeArrayUtil goes out-of-scope - // to ensure that one element throwing an exception does not prevent the others from being - // destroyed. - - void release() { constructedElementCount = 0; } - // Prevent ExceptionSafeArrayUtil's destructor from destroying the constructed elements. - // Call this after you've successfully finished constructing. - -private: - byte* pos; - size_t elementSize; - size_t constructedElementCount; - void (*destroyElement)(void*); -}; - -class DestructorOnlyArrayDisposer: public ArrayDisposer { -public: - static const DestructorOnlyArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -class NullArrayDisposer: public ArrayDisposer { - // An ArrayDisposer that does nothing. Can be used to construct a fake Arrays that doesn't - // actually own its content. - -public: - static const NullArrayDisposer instance; - - void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; -}; - -// ======================================================================================= -// Array - -template -class Array { - // An owned array which will automatically be disposed of (using an ArrayDisposer) in the - // destructor. Can be moved, but not copied. Much like Own, but for arrays rather than - // single objects. - -public: - inline Array(): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(decltype(nullptr)): ptr(nullptr), size_(0), disposer(nullptr) {} - inline Array(Array&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(Array>&& other) noexcept - : ptr(other.ptr), size_(other.size_), disposer(other.disposer) { - other.ptr = nullptr; - other.size_ = 0; - } - inline Array(T* firstElement, size_t size, const ArrayDisposer& disposer) - : ptr(firstElement), size_(size), disposer(&disposer) {} - - KJ_DISALLOW_COPY(Array); - inline ~Array() noexcept { dispose(); } - - inline operator ArrayPtr() { - return ArrayPtr(ptr, size_); - } - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asPtr() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr asBytes() const { return asPtr().asBytes(); } - inline ArrayPtr> asBytes() { return asPtr().asBytes(); } - inline ArrayPtr asChars() const { return asPtr().asChars(); } - inline ArrayPtr> asChars() { return asPtr().asChars(); } - - inline Array> releaseAsBytes() { - // Like asBytes() but transfers ownership. - static_assert(sizeof(T) == sizeof(byte), - "releaseAsBytes() only possible on arrays with byte-size elements (e.g. chars)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - inline Array> releaseAsChars() { - // Like asChars() but transfers ownership. - static_assert(sizeof(T) == sizeof(PropagateConst), - "releaseAsChars() only possible on arrays with char-size elements (e.g. bytes)."); - Array> result( - reinterpret_cast*>(ptr), size_, *disposer); - ptr = nullptr; - size_ = 0; - return result; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline Array& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - inline Array& operator=(Array&& other) { - dispose(); - ptr = other.ptr; - size_ = other.size_; - disposer = other.disposer; - other.ptr = nullptr; - other.size_ = 0; - return *this; - } - -private: - T* ptr; - size_t size_; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - size_t sizeCopy = size_; - if (ptrCopy != nullptr) { - ptr = nullptr; - size_ = 0; - disposer->dispose(ptrCopy, sizeCopy, sizeCopy); - } - } - - template - friend class Array; -}; - -static_assert(!canMemcpy>(), "canMemcpy<>() is broken"); - -namespace _ { // private - -class HeapArrayDisposer final: public ArrayDisposer { -public: - template - static T* allocate(size_t count); - template - static T* allocateUninitialized(size_t count); - - static const HeapArrayDisposer instance; - -private: - static void* allocateImpl(size_t elementSize, size_t elementCount, size_t capacity, - void (*constructElement)(void*), void (*destroyElement)(void*)); - // Allocates and constructs the array. Both function pointers are null if the constructor is - // trivial, otherwise destroyElement is null if the constructor doesn't throw. - - virtual void disposeImpl(void* firstElement, size_t elementSize, size_t elementCount, - size_t capacity, void (*destroyElement)(void*)) const override; - - template - struct Allocate_; -}; - -} // namespace _ (private) - -template -inline Array heapArray(size_t size) { - // Much like `heap()` from memory.h, allocates a new array on the heap. - - return Array(_::HeapArrayDisposer::allocate(size), size, - _::HeapArrayDisposer::instance); -} - -template Array heapArray(const T* content, size_t size); -template Array heapArray(ArrayPtr content); -template Array heapArray(ArrayPtr content); -template Array heapArray(Iterator begin, Iterator end); -template Array heapArray(std::initializer_list init); -// Allocate a heap array containing a copy of the given content. - -template -Array heapArrayFromIterable(Container&& a) { return heapArray(a.begin(), a.end()); } -template -Array heapArrayFromIterable(Array&& a) { return mv(a); } - -// ======================================================================================= -// ArrayBuilder - -template -class ArrayBuilder { - // Class which lets you build an Array specifying the exact constructor arguments for each - // element, rather than starting by default-constructing them. - -public: - ArrayBuilder(): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - ArrayBuilder(decltype(nullptr)): ptr(nullptr), pos(nullptr), endPtr(nullptr) {} - explicit ArrayBuilder(RemoveConst* firstElement, size_t capacity, - const ArrayDisposer& disposer) - : ptr(firstElement), pos(firstElement), endPtr(firstElement + capacity), - disposer(&disposer) {} - ArrayBuilder(ArrayBuilder&& other) - : ptr(other.ptr), pos(other.pos), endPtr(other.endPtr), disposer(other.disposer) { - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - } - KJ_DISALLOW_COPY(ArrayBuilder); - inline ~ArrayBuilder() noexcept(false) { dispose(); } - - inline operator ArrayPtr() { - return arrayPtr(ptr, pos); - } - inline operator ArrayPtr() const { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() { - return arrayPtr(ptr, pos); - } - inline ArrayPtr asPtr() const { - return arrayPtr(ptr, pos); - } - - inline size_t size() const { return pos - ptr; } - inline size_t capacity() const { return endPtr - ptr; } - inline T& operator[](size_t index) const { - KJ_IREQUIRE(index < implicitCast(pos - ptr), "Out-of-bounds Array access."); - return ptr[index]; - } - - inline const T* begin() const { return ptr; } - inline const T* end() const { return pos; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(pos - 1); } - inline T* begin() { return ptr; } - inline T* end() { return pos; } - inline T& front() { return *ptr; } - inline T& back() { return *(pos - 1); } - - ArrayBuilder& operator=(ArrayBuilder&& other) { - dispose(); - ptr = other.ptr; - pos = other.pos; - endPtr = other.endPtr; - disposer = other.disposer; - other.ptr = nullptr; - other.pos = nullptr; - other.endPtr = nullptr; - return *this; - } - ArrayBuilder& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - T& add(Params&&... params) { - KJ_IREQUIRE(pos < endPtr, "Added too many elements to ArrayBuilder."); - ctor(*pos, kj::fwd(params)...); - return *pos++; - } - - template - void addAll(Container&& container) { - addAll()>( - container.begin(), container.end()); - } - - template - void addAll(Iterator start, Iterator end); - - void removeLast() { - KJ_IREQUIRE(pos > ptr, "No elements present to remove."); - kj::dtor(*--pos); - } - - void truncate(size_t size) { - KJ_IREQUIRE(size <= this->size(), "can't use truncate() to expand"); - - T* target = ptr + size; - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - - void resize(size_t size) { - KJ_IREQUIRE(size <= capacity(), "can't resize past capacity"); - - T* target = ptr + size; - if (target > pos) { - // expand - if (__has_trivial_constructor(T)) { - pos = target; - } else { - while (pos < target) { - kj::ctor(*pos++); - } - } - } else { - // truncate - if (__has_trivial_destructor(T)) { - pos = target; - } else { - while (pos > target) { - kj::dtor(*--pos); - } - } - } - } - - Array finish() { - // We could safely remove this check if we assume that the disposer implementation doesn't - // need to know the original capacity, as is thes case with HeapArrayDisposer since it uses - // operator new() or if we created a custom disposer for ArrayBuilder which stores the capacity - // in a prefix. But that would make it hard to write cleverer heap allocators, and anyway this - // check might catch bugs. Probably people should use Vector if they want to build arrays - // without knowing the final size in advance. - KJ_IREQUIRE(pos == endPtr, "ArrayBuilder::finish() called prematurely."); - Array result(reinterpret_cast(ptr), pos - ptr, *disposer); - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - return result; - } - - inline bool isFull() const { - return pos == endPtr; - } - -private: - T* ptr; - RemoveConst* pos; - T* endPtr; - const ArrayDisposer* disposer; - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - T* posCopy = pos; - T* endCopy = endPtr; - if (ptrCopy != nullptr) { - ptr = nullptr; - pos = nullptr; - endPtr = nullptr; - disposer->dispose(ptrCopy, posCopy - ptrCopy, endCopy - ptrCopy); - } - } -}; - -template -inline ArrayBuilder heapArrayBuilder(size_t size) { - // Like `heapArray()` but does not default-construct the elements. You must construct them - // manually by calling `add()`. - - return ArrayBuilder(_::HeapArrayDisposer::allocateUninitialized>(size), - size, _::HeapArrayDisposer::instance); -} - -// ======================================================================================= -// Inline Arrays - -template -class FixedArray { - // A fixed-width array whose storage is allocated inline rather than on the heap. - -public: - inline size_t size() const { return fixedSize; } - inline T* begin() { return content; } - inline T* end() { return content + fixedSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + fixedSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, fixedSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, fixedSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - T content[fixedSize]; -}; - -template -class CappedArray { - // Like `FixedArray` but can be dynamically resized as long as the size does not exceed the limit - // specified by the template parameter. - // - // TODO(someday): Don't construct elements past currentSize? - -public: - inline KJ_CONSTEXPR() CappedArray(): currentSize(fixedSize) {} - inline explicit constexpr CappedArray(size_t s): currentSize(s) {} - - inline size_t size() const { return currentSize; } - inline void setSize(size_t s) { KJ_IREQUIRE(s <= fixedSize); currentSize = s; } - inline T* begin() { return content; } - inline T* end() { return content + currentSize; } - inline const T* begin() const { return content; } - inline const T* end() const { return content + currentSize; } - - inline operator ArrayPtr() { - return arrayPtr(content, currentSize); - } - inline operator ArrayPtr() const { - return arrayPtr(content, currentSize); - } - - inline T& operator[](size_t index) { return content[index]; } - inline const T& operator[](size_t index) const { return content[index]; } - -private: - size_t currentSize; - T content[fixedSize]; -}; - -// ======================================================================================= -// KJ_MAP - -#define KJ_MAP(elementName, array) \ - ::kj::_::Mapper(array) * \ - [&](typename ::kj::_::Mapper::Element elementName) -// Applies some function to every element of an array, returning an Array of the results, with -// nice syntax. Example: -// -// StringPtr foo = "abcd"; -// Array bar = KJ_MAP(c, foo) -> char { return c + 1; }; -// KJ_ASSERT(str(bar) == "bcde"); - -namespace _ { // private - -template -struct Mapper { - T array; - Mapper(T&& array): array(kj::fwd(array)) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(array.size()); - for (auto iter = array.begin(); iter != array.end(); ++iter) { - builder.add(func(*iter)); - } - return builder.finish(); - } - typedef decltype(*kj::instance().begin()) Element; -}; - -template -struct Mapper { - T* array; - Mapper(T* array): array(array) {} - template - auto operator*(Func&& func) -> Array { - auto builder = heapArrayBuilder(s); - for (size_t i = 0; i < s; i++) { - builder.add(func(array[i])); - } - return builder.finish(); - } - typedef decltype(*array)& Element; -}; - -} // namespace _ (private) - -// ======================================================================================= -// Inline implementation details - -template -struct ArrayDisposer::Dispose_ { - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(const_cast*>(firstElement), - sizeof(T), elementCount, capacity, nullptr); - } -}; -template -struct ArrayDisposer::Dispose_ { - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - - static void dispose(T* firstElement, size_t elementCount, size_t capacity, - const ArrayDisposer& disposer) { - disposer.disposeImpl(firstElement, sizeof(T), elementCount, capacity, &destruct); - } -}; - -template -void ArrayDisposer::dispose(T* firstElement, size_t elementCount, size_t capacity) const { - Dispose_::dispose(firstElement, elementCount, capacity, *this); -} - -namespace _ { // private - -template -struct HeapArrayDisposer::Allocate_ { - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, nullptr, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, nullptr)); - } -}; -template -struct HeapArrayDisposer::Allocate_ { - static void construct(void* ptr) { - kj::ctor(*reinterpret_cast(ptr)); - } - static void destruct(void* ptr) { - kj::dtor(*reinterpret_cast(ptr)); - } - static T* allocate(size_t elementCount, size_t capacity) { - return reinterpret_cast(allocateImpl( - sizeof(T), elementCount, capacity, &construct, &destruct)); - } -}; - -template -T* HeapArrayDisposer::allocate(size_t count) { - return Allocate_::allocate(count, count); -} - -template -T* HeapArrayDisposer::allocateUninitialized(size_t count) { - return Allocate_::allocate(0, count); -} - -template ()> -struct CopyConstructArray_; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, T* start, T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, const T* start, const T* end) { - memcpy(pos, start, reinterpret_cast(end) - reinterpret_cast(start)); - return pos + (end - start); - } -}; - -template -struct CopyConstructArray_ { - static inline T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Since both the copy constructor and assignment operator are trivial, we know that assignment - // is equivalent to copy-constructing. So we can make this case somewhat easier for the - // compiler to optimize. - while (start != end) { - *pos++ = *start++; - } - return pos; - } -}; - -template -struct CopyConstructArray_ { - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(*start); - - if (noexcept(T(*start))) { - while (start != end) { - ctor(*pos++, *start++); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, *start++); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -template -struct CopyConstructArray_ { - // Actually move-construct. - - struct ExceptionGuard { - T* start; - T* pos; - inline explicit ExceptionGuard(T* pos): start(pos), pos(pos) {} - ~ExceptionGuard() noexcept(false) { - while (pos > start) { - dtor(*--pos); - } - } - }; - - static T* apply(T* __restrict__ pos, Iterator start, Iterator end) { - // Verify that T can be *implicitly* constructed from the source values. - if (false) implicitCast(kj::mv(*start)); - - if (noexcept(T(kj::mv(*start)))) { - while (start != end) { - ctor(*pos++, kj::mv(*start++)); - } - return pos; - } else { - // Crap. This is complicated. - ExceptionGuard guard(pos); - while (start != end) { - ctor(*guard.pos, kj::mv(*start++)); - ++guard.pos; - } - guard.start = guard.pos; - return guard.pos; - } - } -}; - -} // namespace _ (private) - -template -template -void ArrayBuilder::addAll(Iterator start, Iterator end) { - pos = _::CopyConstructArray_, Decay, move>::apply(pos, start, end); -} - -template -Array heapArray(const T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(T* content, size_t size) { - ArrayBuilder builder = heapArrayBuilder(size); - builder.addAll(content, content + size); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template -Array heapArray(ArrayPtr content) { - ArrayBuilder builder = heapArrayBuilder(content.size()); - builder.addAll(content); - return builder.finish(); -} - -template Array -heapArray(Iterator begin, Iterator end) { - ArrayBuilder builder = heapArrayBuilder(end - begin); - builder.addAll(begin, end); - return builder.finish(); -} - -template -inline Array heapArray(std::initializer_list init) { - return heapArray(init.begin(), init.end()); -} - -} // namespace kj - -#endif // KJ_ARRAY_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async-inl.h b/phonelibs/capnp-cpp/mac/include/kj/async-inl.h deleted file mode 100644 index f11e4fcd5b..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async-inl.h +++ /dev/null @@ -1,1112 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains extended inline implementation details that are required along with async.h. -// We move this all into a separate file to make async.h more readable. -// -// Non-inline declarations here are defined in async.c++. - -#ifndef KJ_ASYNC_H_ -#error "Do not include this directly; include kj/async.h." -#include "async.h" // help IDE parse this file -#endif - -#ifndef KJ_ASYNC_INL_H_ -#define KJ_ASYNC_INL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { -namespace _ { // private - -template -class ExceptionOr; - -class ExceptionOrValue { -public: - ExceptionOrValue(bool, Exception&& exception): exception(kj::mv(exception)) {} - KJ_DISALLOW_COPY(ExceptionOrValue); - - void addException(Exception&& exception) { - if (this->exception == nullptr) { - this->exception = kj::mv(exception); - } - } - - template - ExceptionOr& as() { return *static_cast*>(this); } - template - const ExceptionOr& as() const { return *static_cast*>(this); } - - Maybe exception; - -protected: - // Allow subclasses to have move constructor / assignment. - ExceptionOrValue() = default; - ExceptionOrValue(ExceptionOrValue&& other) = default; - ExceptionOrValue& operator=(ExceptionOrValue&& other) = default; -}; - -template -class ExceptionOr: public ExceptionOrValue { -public: - ExceptionOr() = default; - ExceptionOr(T&& value): value(kj::mv(value)) {} - ExceptionOr(bool, Exception&& exception): ExceptionOrValue(false, kj::mv(exception)) {} - ExceptionOr(ExceptionOr&&) = default; - ExceptionOr& operator=(ExceptionOr&&) = default; - - Maybe value; -}; - -class Event { - // An event waiting to be executed. Not for direct use by applications -- promises use this - // internally. - -public: - Event(); - ~Event() noexcept(false); - KJ_DISALLOW_COPY(Event); - - void armDepthFirst(); - // Enqueue this event so that `fire()` will be called from the event loop soon. - // - // Events scheduled in this way are executed in depth-first order: if an event callback arms - // more events, those events are placed at the front of the queue (in the order in which they - // were armed), so that they run immediately after the first event's callback returns. - // - // Depth-first event scheduling is appropriate for events that represent simple continuations - // of a previous event that should be globbed together for performance. Depth-first scheduling - // can lead to starvation, so any long-running task must occasionally yield with - // `armBreadthFirst()`. (Promise::then() uses depth-first whereas evalLater() uses - // breadth-first.) - // - // To use breadth-first scheduling instead, use `armBreadthFirst()`. - - void armBreadthFirst(); - // Like `armDepthFirst()` except that the event is placed at the end of the queue. - - kj::String trace(); - // Dump debug info about this event. - - virtual _::PromiseNode* getInnerForTrace(); - // If this event wraps a PromiseNode, get that node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - virtual Maybe> fire() = 0; - // Fire the event. Possibly returns a pointer to itself, which will be discarded by the - // caller. This is the only way that an event can delete itself as a result of firing, as - // doing so from within fire() will throw an exception. - -private: - friend class kj::EventLoop; - EventLoop& loop; - Event* next; - Event** prev; - bool firing = false; -}; - -class PromiseNode { - // A Promise contains a chain of PromiseNodes tracking the pending transformations. - // - // To reduce generated code bloat, PromiseNode is not a template. Instead, it makes very hacky - // use of pointers to ExceptionOrValue which actually point to ExceptionOr, but are only - // so down-cast in the few places that really need to be templated. Luckily this is all - // internal implementation details. - -public: - virtual void onReady(Event& event) noexcept = 0; - // Arms the given event when ready. - - virtual void setSelfPointer(Own* selfPtr) noexcept; - // Tells the node that `selfPtr` is the pointer that owns this node, and will continue to own - // this node until it is destroyed or setSelfPointer() is called again. ChainPromiseNode uses - // this to shorten redundant chains. The default implementation does nothing; only - // ChainPromiseNode should implement this. - - virtual void get(ExceptionOrValue& output) noexcept = 0; - // Get the result. `output` points to an ExceptionOr into which the result will be written. - // Can only be called once, and only after the node is ready. Must be called directly from the - // event loop, with no application code on the stack. - - virtual PromiseNode* getInnerForTrace(); - // If this node wraps some other PromiseNode, get the wrapped node. Used for debug tracing. - // Default implementation returns nullptr. - -protected: - class OnReadyEvent { - // Helper class for implementing onReady(). - - public: - void init(Event& newEvent); - // Returns true if arm() was already called. - - void arm(); - // Arms the event if init() has already been called and makes future calls to init() return - // true. - - private: - Event* event = nullptr; - }; -}; - -// ------------------------------------------------------------------- - -class ImmediatePromiseNodeBase: public PromiseNode { -public: - ImmediatePromiseNodeBase(); - ~ImmediatePromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override; -}; - -template -class ImmediatePromiseNode final: public ImmediatePromiseNodeBase { - // A promise that has already been resolved to an immediate value or exception. - -public: - ImmediatePromiseNode(ExceptionOr&& result): result(kj::mv(result)) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -class ImmediateBrokenPromiseNode final: public ImmediatePromiseNodeBase { -public: - ImmediateBrokenPromiseNode(Exception&& exception); - - void get(ExceptionOrValue& output) noexcept override; - -private: - Exception exception; -}; - -// ------------------------------------------------------------------- - -class AttachmentPromiseNodeBase: public PromiseNode { -public: - AttachmentPromiseNodeBase(Own&& dependency); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - - void dropDependency(); - - template - friend class AttachmentPromiseNode; -}; - -template -class AttachmentPromiseNode final: public AttachmentPromiseNodeBase { - // A PromiseNode that holds on to some object (usually, an Own, but could be any movable - // object) until the promise resolves. - -public: - AttachmentPromiseNode(Own&& dependency, Attachment&& attachment) - : AttachmentPromiseNodeBase(kj::mv(dependency)), - attachment(kj::mv(attachment)) {} - - ~AttachmentPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the attachment because the - // dependency may be using the attachment. - dropDependency(); - } - -private: - Attachment attachment; -}; - -// ------------------------------------------------------------------- - -class PtmfHelper { - // This class is a private helper for GetFunctorStartAddress. The class represents the internal - // representation of a pointer-to-member-function. - - template - friend struct GetFunctorStartAddress; - -#if __GNUG__ - - void* ptr; - ptrdiff_t adj; - // Layout of a pointer-to-member-function used by GCC and compatible compilers. - - void* apply(void* obj) { -#if defined(__arm__) || defined(__mips__) || defined(__aarch64__) - if (adj & 1) { - ptrdiff_t voff = (ptrdiff_t)ptr; -#else - ptrdiff_t voff = (ptrdiff_t)ptr; - if (voff & 1) { - voff &= ~1; -#endif - return *(void**)(*(char**)obj + voff); - } else { - return ptr; - } - } - -#define BODY \ - PtmfHelper result; \ - static_assert(sizeof(p) == sizeof(result), "unknown ptmf layout"); \ - memcpy(&result, &p, sizeof(result)); \ - return result - -#else // __GNUG__ - - void* apply(void* obj) { return nullptr; } - // TODO(port): PTMF instruction address extraction - -#define BODY return PtmfHelper{} - -#endif // __GNUG__, else - - template - static PtmfHelper from(F p) { BODY; } - // Create a PtmfHelper from some arbitrary pointer-to-member-function which is not - // overloaded nor a template. In this case the compiler is able to deduce the full function - // signature directly given the name since there is only one function with that name. - - template - static PtmfHelper from(R (C::*p)(NoInfer

...)) { BODY; } - template - static PtmfHelper from(R (C::*p)(NoInfer

...) const) { BODY; } - // Create a PtmfHelper from some poniter-to-member-function which is a template. In this case - // the function must match exactly the containing type C, return type R, and parameter types P... - // GetFunctorStartAddress normally specifies exactly the correct C and R, but can only make a - // guess at P. Luckily, if the function parameters are template parameters then it's not - // necessary to be precise about P. -#undef BODY -}; - -template -struct GetFunctorStartAddress { - // Given a functor (any object defining operator()), return the start address of the function, - // suitable for passing to addr2line to obtain a source file/line for debugging purposes. - // - // This turns out to be incredibly hard to implement in the presence of overloaded or templated - // functors. Therefore, we impose these specific restrictions, specific to our use case: - // - Overloading is not allowed, but templating is. (Generally we only intend to support lambdas - // anyway.) - // - The template parameters to GetFunctorStartAddress specify a hint as to the expected - // parameter types. If the functor is templated, its parameters must match exactly these types. - // (If it's not templated, ParamTypes are ignored.) - - template - static void* apply(Func&& func) { - typedef decltype(func(instance()...)) ReturnType; - return PtmfHelper::from, ParamTypes...>( - &Decay::operator()).apply(&func); - } -}; - -template <> -struct GetFunctorStartAddress: public GetFunctorStartAddress<> {}; -// Hack for TransformPromiseNode use case: an input type of `Void` indicates that the function -// actually has no parameters. - -class TransformPromiseNodeBase: public PromiseNode { -public: - TransformPromiseNodeBase(Own&& dependency, void* continuationTracePtr); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - void* continuationTracePtr; - - void dropDependency(); - void getDepResult(ExceptionOrValue& output); - - virtual void getImpl(ExceptionOrValue& output) = 0; - - template - friend class TransformPromiseNode; -}; - -template -class TransformPromiseNode final: public TransformPromiseNodeBase { - // A PromiseNode that transforms the result of another PromiseNode through an application-provided - // function (implements `then()`). - -public: - TransformPromiseNode(Own&& dependency, Func&& func, ErrorFunc&& errorHandler) - : TransformPromiseNodeBase(kj::mv(dependency), - GetFunctorStartAddress::apply(func)), - func(kj::fwd(func)), errorHandler(kj::fwd(errorHandler)) {} - - ~TransformPromiseNode() noexcept(false) { - // We need to make sure the dependency is deleted before we delete the continuations because it - // is a common pattern for the continuations to hold ownership of objects that might be in-use - // by the dependency. - dropDependency(); - } - -private: - Func func; - ErrorFunc errorHandler; - - void getImpl(ExceptionOrValue& output) override { - ExceptionOr depResult; - getDepResult(depResult); - KJ_IF_MAYBE(depException, depResult.exception) { - output.as() = handle( - MaybeVoidCaller>>::apply( - errorHandler, kj::mv(*depException))); - } else KJ_IF_MAYBE(depValue, depResult.value) { - output.as() = handle(MaybeVoidCaller::apply(func, kj::mv(*depValue))); - } - } - - ExceptionOr handle(T&& value) { - return kj::mv(value); - } - ExceptionOr handle(PropagateException::Bottom&& value) { - return ExceptionOr(false, value.asException()); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase; - -class ForkBranchBase: public PromiseNode { -public: - ForkBranchBase(Own&& hub); - ~ForkBranchBase() noexcept(false); - - void hubReady() noexcept; - // Called by the hub to indicate that it is ready. - - // implements PromiseNode ------------------------------------------ - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -protected: - inline ExceptionOrValue& getHubResultRef(); - - void releaseHub(ExceptionOrValue& output); - // Release the hub. If an exception is thrown, add it to `output`. - -private: - OnReadyEvent onReadyEvent; - - Own hub; - ForkBranchBase* next = nullptr; - ForkBranchBase** prevPtr = nullptr; - - friend class ForkHubBase; -}; - -template T copyOrAddRef(T& t) { return t; } -template Own copyOrAddRef(Own& t) { return t->addRef(); } - -template -class ForkBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - ForkBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = copyOrAddRef(*value); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -template -class SplitBranch final: public ForkBranchBase { - // A PromiseNode that implements one branch of a fork -- i.e. one of the branches that receives - // a const reference. - -public: - SplitBranch(Own&& hub): ForkBranchBase(kj::mv(hub)) {} - - typedef kj::Decay(kj::instance()))> Element; - - void get(ExceptionOrValue& output) noexcept override { - ExceptionOr& hubResult = getHubResultRef().template as(); - KJ_IF_MAYBE(value, hubResult.value) { - output.as().value = kj::mv(kj::get(*value)); - } else { - output.as().value = nullptr; - } - output.exception = hubResult.exception; - releaseHub(output); - } -}; - -// ------------------------------------------------------------------- - -class ForkHubBase: public Refcounted, protected Event { -public: - ForkHubBase(Own&& inner, ExceptionOrValue& resultRef); - - inline ExceptionOrValue& getResultRef() { return resultRef; } - -private: - Own inner; - ExceptionOrValue& resultRef; - - ForkBranchBase* headBranch = nullptr; - ForkBranchBase** tailBranch = &headBranch; - // Tail becomes null once the inner promise is ready and all branches have been notified. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - friend class ForkBranchBase; -}; - -template -class ForkHub final: public ForkHubBase { - // A PromiseNode that implements the hub of a fork. The first call to Promise::fork() replaces - // the promise's outer node with a ForkHub, and subsequent calls add branches to that hub (if - // possible). - -public: - ForkHub(Own&& inner): ForkHubBase(kj::mv(inner), result) {} - - Promise<_::UnfixVoid> addBranch() { - return Promise<_::UnfixVoid>(false, kj::heap>(addRef(*this))); - } - - _::SplitTuplePromise split() { - return splitImpl(MakeIndexes()>()); - } - -private: - ExceptionOr result; - - template - _::SplitTuplePromise splitImpl(Indexes) { - return kj::tuple(addSplit()...); - } - - template - Promise::Element>> addSplit() { - return Promise::Element>>( - false, maybeChain(kj::heap>(addRef(*this)), - implicitCast::Element*>(nullptr))); - } -}; - -inline ExceptionOrValue& ForkBranchBase::getHubResultRef() { - return hub->getResultRef(); -} - -// ------------------------------------------------------------------- - -class ChainPromiseNode final: public PromiseNode, public Event { - // Promise node which reduces Promise> to Promise. - // - // `Event` is only a public base class because otherwise we can't cast Own to - // Own. Ugh, templates and private... - -public: - explicit ChainPromiseNode(Own inner); - ~ChainPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void setSelfPointer(Own* selfPtr) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - enum State { - STEP1, - STEP2 - }; - - State state; - - Own inner; - // In STEP1, a PromiseNode for a Promise. - // In STEP2, a PromiseNode for a T. - - Event* onReadyEvent = nullptr; - Own* selfPtr = nullptr; - - Maybe> fire() override; -}; - -template -Own maybeChain(Own&& node, Promise*) { - return heap(kj::mv(node)); -} - -template -Own&& maybeChain(Own&& node, T*) { - return kj::mv(node); -} - -// ------------------------------------------------------------------- - -class ExclusiveJoinPromiseNode final: public PromiseNode { -public: - ExclusiveJoinPromiseNode(Own left, Own right); - ~ExclusiveJoinPromiseNode() noexcept(false); - - void onReady(Event& event) noexcept override; - void get(ExceptionOrValue& output) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - class Branch: public Event { - public: - Branch(ExclusiveJoinPromiseNode& joinNode, Own dependency); - ~Branch() noexcept(false); - - bool get(ExceptionOrValue& output); - // Returns true if this is the side that finished. - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - private: - ExclusiveJoinPromiseNode& joinNode; - Own dependency; - }; - - Branch left; - Branch right; - OnReadyEvent onReadyEvent; -}; - -// ------------------------------------------------------------------- - -class ArrayJoinPromiseNodeBase: public PromiseNode { -public: - ArrayJoinPromiseNodeBase(Array> promises, - ExceptionOrValue* resultParts, size_t partSize); - ~ArrayJoinPromiseNodeBase() noexcept(false); - - void onReady(Event& event) noexcept override final; - void get(ExceptionOrValue& output) noexcept override final; - PromiseNode* getInnerForTrace() override final; - -protected: - virtual void getNoError(ExceptionOrValue& output) noexcept = 0; - // Called to compile the result only in the case where there were no errors. - -private: - uint countLeft; - OnReadyEvent onReadyEvent; - - class Branch final: public Event { - public: - Branch(ArrayJoinPromiseNodeBase& joinNode, Own dependency, - ExceptionOrValue& output); - ~Branch() noexcept(false); - - Maybe> fire() override; - _::PromiseNode* getInnerForTrace() override; - - Maybe getPart(); - // Calls dependency->get(output). If there was an exception, return it. - - private: - ArrayJoinPromiseNodeBase& joinNode; - Own dependency; - ExceptionOrValue& output; - }; - - Array branches; -}; - -template -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts) - : ArrayJoinPromiseNodeBase(kj::mv(promises), resultParts.begin(), sizeof(ExceptionOr)), - resultParts(kj::mv(resultParts)) {} - -protected: - void getNoError(ExceptionOrValue& output) noexcept override { - auto builder = heapArrayBuilder(resultParts.size()); - for (auto& part: resultParts) { - KJ_IASSERT(part.value != nullptr, - "Bug in KJ promise framework: Promise result had neither value no exception."); - builder.add(kj::mv(*_::readMaybe(part.value))); - } - output.as>() = builder.finish(); - } - -private: - Array> resultParts; -}; - -template <> -class ArrayJoinPromiseNode final: public ArrayJoinPromiseNodeBase { -public: - ArrayJoinPromiseNode(Array> promises, - Array> resultParts); - ~ArrayJoinPromiseNode(); - -protected: - void getNoError(ExceptionOrValue& output) noexcept override; - -private: - Array> resultParts; -}; - -// ------------------------------------------------------------------- - -class EagerPromiseNodeBase: public PromiseNode, protected Event { - // A PromiseNode that eagerly evaluates its dependency even if its dependent does not eagerly - // evaluate it. - -public: - EagerPromiseNodeBase(Own&& dependency, ExceptionOrValue& resultRef); - - void onReady(Event& event) noexcept override; - PromiseNode* getInnerForTrace() override; - -private: - Own dependency; - OnReadyEvent onReadyEvent; - - ExceptionOrValue& resultRef; - - Maybe> fire() override; -}; - -template -class EagerPromiseNode final: public EagerPromiseNodeBase { -public: - EagerPromiseNode(Own&& dependency) - : EagerPromiseNodeBase(kj::mv(dependency), result) {} - - void get(ExceptionOrValue& output) noexcept override { - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; -}; - -template -Own spark(Own&& node) { - // Forces evaluation of the given node to begin as soon as possible, even if no one is waiting - // on it. - return heap>(kj::mv(node)); -} - -// ------------------------------------------------------------------- - -class AdapterPromiseNodeBase: public PromiseNode { -public: - void onReady(Event& event) noexcept override; - -protected: - inline void setReady() { - onReadyEvent.arm(); - } - -private: - OnReadyEvent onReadyEvent; -}; - -template -class AdapterPromiseNode final: public AdapterPromiseNodeBase, - private PromiseFulfiller> { - // A PromiseNode that wraps a PromiseAdapter. - -public: - template - AdapterPromiseNode(Params&&... params) - : adapter(static_cast>&>(*this), kj::fwd(params)...) {} - - void get(ExceptionOrValue& output) noexcept override { - KJ_IREQUIRE(!isWaiting()); - output.as() = kj::mv(result); - } - -private: - ExceptionOr result; - bool waiting = true; - Adapter adapter; - - void fulfill(T&& value) override { - if (waiting) { - waiting = false; - result = ExceptionOr(kj::mv(value)); - setReady(); - } - } - - void reject(Exception&& exception) override { - if (waiting) { - waiting = false; - result = ExceptionOr(false, kj::mv(exception)); - setReady(); - } - } - - bool isWaiting() override { - return waiting; - } -}; - -} // namespace _ (private) - -// ======================================================================================= - -template -Promise::Promise(_::FixVoid value) - : PromiseBase(heap<_::ImmediatePromiseNode<_::FixVoid>>(kj::mv(value))) {} - -template -Promise::Promise(kj::Exception&& exception) - : PromiseBase(heap<_::ImmediateBrokenPromiseNode>(kj::mv(exception))) {} - -template -template -PromiseForResult Promise::then(Func&& func, ErrorFunc&& errorHandler) { - typedef _::FixVoid<_::ReturnType> ResultT; - - Own<_::PromiseNode> intermediate = - heap<_::TransformPromiseNode, Func, ErrorFunc>>( - kj::mv(node), kj::fwd(func), kj::fwd(errorHandler)); - return PromiseForResult(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); -} - -namespace _ { // private - -template -struct IdentityFunc { - inline T operator()(T&& value) const { - return kj::mv(value); - } -}; -template -struct IdentityFunc> { - inline Promise operator()(T&& value) const { - return kj::mv(value); - } -}; -template <> -struct IdentityFunc { - inline void operator()() const {} -}; -template <> -struct IdentityFunc> { - Promise operator()() const; - // This can't be inline because it will make the translation unit depend on kj-async. Awkwardly, - // Cap'n Proto relies on being able to include this header without creating such a link-time - // dependency. -}; - -} // namespace _ (private) - -template -template -Promise Promise::catch_(ErrorFunc&& errorHandler) { - // then()'s ErrorFunc can only return a Promise if Func also returns a Promise. In this case, - // Func is being filled in automatically. We want to make sure ErrorFunc can return a Promise, - // but we don't want the extra overhead of promise chaining if ErrorFunc doesn't actually - // return a promise. So we make our Func return match ErrorFunc. - return then(_::IdentityFunc()))>(), - kj::fwd(errorHandler)); -} - -template -T Promise::wait(WaitScope& waitScope) { - _::ExceptionOr<_::FixVoid> result; - - waitImpl(kj::mv(node), result, waitScope); - - KJ_IF_MAYBE(value, result.value) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - return _::returnMaybeVoid(kj::mv(*value)); - } else KJ_IF_MAYBE(exception, result.exception) { - throwFatalException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template <> -inline void Promise::wait(WaitScope& waitScope) { - // Override case to use throwRecoverableException(). - - _::ExceptionOr<_::Void> result; - - waitImpl(kj::mv(node), result, waitScope); - - if (result.value != nullptr) { - KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } - } else KJ_IF_MAYBE(exception, result.exception) { - throwRecoverableException(kj::mv(*exception)); - } else { - // Result contained neither a value nor an exception? - KJ_UNREACHABLE; - } -} - -template -ForkedPromise Promise::fork() { - return ForkedPromise(false, refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))); -} - -template -Promise ForkedPromise::addBranch() { - return hub->addBranch(); -} - -template -_::SplitTuplePromise Promise::split() { - return refcounted<_::ForkHub<_::FixVoid>>(kj::mv(node))->split(); -} - -template -Promise Promise::exclusiveJoin(Promise&& other) { - return Promise(false, heap<_::ExclusiveJoinPromiseNode>(kj::mv(node), kj::mv(other.node))); -} - -template -template -Promise Promise::attach(Attachments&&... attachments) { - return Promise(false, kj::heap<_::AttachmentPromiseNode>>( - kj::mv(node), kj::tuple(kj::fwd(attachments)...))); -} - -template -template -Promise Promise::eagerlyEvaluate(ErrorFunc&& errorHandler) { - // See catch_() for commentary. - return Promise(false, _::spark<_::FixVoid>(then( - _::IdentityFunc()))>(), - kj::fwd(errorHandler)).node)); -} - -template -Promise Promise::eagerlyEvaluate(decltype(nullptr)) { - return Promise(false, _::spark<_::FixVoid>(kj::mv(node))); -} - -template -kj::String Promise::trace() { - return PromiseBase::trace(); -} - -template -inline PromiseForResult evalLater(Func&& func) { - return _::yield().then(kj::fwd(func), _::PropagateException()); -} - -template -inline PromiseForResult evalNow(Func&& func) { - PromiseForResult result = nullptr; - KJ_IF_MAYBE(e, kj::runCatchingExceptions([&]() { - result = func(); - })) { - result = kj::mv(*e); - } - return result; -} - -template -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([](T&&) {}, kj::fwd(errorHandler))); -} - -template <> -template -void Promise::detach(ErrorFunc&& errorHandler) { - return _::detach(then([]() {}, kj::fwd(errorHandler))); -} - -template -Promise> joinPromises(Array>&& promises) { - return Promise>(false, kj::heap<_::ArrayJoinPromiseNode>( - KJ_MAP(p, promises) { return kj::mv(p.node); }, - heapArray<_::ExceptionOr>(promises.size()))); -} - -// ======================================================================================= - -namespace _ { // private - -template -class WeakFulfiller final: public PromiseFulfiller, private kj::Disposer { - // A wrapper around PromiseFulfiller which can be detached. - // - // There are a couple non-trivialities here: - // - If the WeakFulfiller is discarded, we want the promise it fulfills to be implicitly - // rejected. - // - We cannot destroy the WeakFulfiller until the application has discarded it *and* it has been - // detached from the underlying fulfiller, because otherwise the later detach() call will go - // to a dangling pointer. Essentially, WeakFulfiller is reference counted, although the - // refcount never goes over 2 and we manually implement the refcounting because we need to do - // other special things when each side detaches anyway. To this end, WeakFulfiller is its own - // Disposer -- dispose() is called when the application discards its owned pointer to the - // fulfiller and detach() is called when the promise is destroyed. - -public: - KJ_DISALLOW_COPY(WeakFulfiller); - - static kj::Own make() { - WeakFulfiller* ptr = new WeakFulfiller; - return Own(ptr, *ptr); - } - - void fulfill(FixVoid&& value) override { - if (inner != nullptr) { - inner->fulfill(kj::mv(value)); - } - } - - void reject(Exception&& exception) override { - if (inner != nullptr) { - inner->reject(kj::mv(exception)); - } - } - - bool isWaiting() override { - return inner != nullptr && inner->isWaiting(); - } - - void attach(PromiseFulfiller& newInner) { - inner = &newInner; - } - - void detach(PromiseFulfiller& from) { - if (inner == nullptr) { - // Already disposed. - delete this; - } else { - KJ_IREQUIRE(inner == &from); - inner = nullptr; - } - } - -private: - mutable PromiseFulfiller* inner; - - WeakFulfiller(): inner(nullptr) {} - - void disposeImpl(void* pointer) const override { - // TODO(perf): Factor some of this out so it isn't regenerated for every fulfiller type? - - if (inner == nullptr) { - // Already detached. - delete this; - } else { - if (inner->isWaiting()) { - inner->reject(kj::Exception(kj::Exception::Type::FAILED, __FILE__, __LINE__, - kj::heapString("PromiseFulfiller was destroyed without fulfilling the promise."))); - } - inner = nullptr; - } - } -}; - -template -class PromiseAndFulfillerAdapter { -public: - PromiseAndFulfillerAdapter(PromiseFulfiller& fulfiller, - WeakFulfiller& wrapper) - : fulfiller(fulfiller), wrapper(wrapper) { - wrapper.attach(fulfiller); - } - - ~PromiseAndFulfillerAdapter() noexcept(false) { - wrapper.detach(fulfiller); - } - -private: - PromiseFulfiller& fulfiller; - WeakFulfiller& wrapper; -}; - -} // namespace _ (private) - -template -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -bool PromiseFulfiller::rejectIfThrows(Func&& func) { - KJ_IF_MAYBE(exception, kj::runCatchingExceptions(kj::mv(func))) { - reject(kj::mv(*exception)); - return false; - } else { - return true; - } -} - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams) { - return Promise(false, heap<_::AdapterPromiseNode<_::FixVoid, Adapter>>( - kj::fwd(adapterConstructorParams)...)); -} - -template -PromiseFulfillerPair newPromiseAndFulfiller() { - auto wrapper = _::WeakFulfiller::make(); - - Own<_::PromiseNode> intermediate( - heap<_::AdapterPromiseNode<_::FixVoid, _::PromiseAndFulfillerAdapter>>(*wrapper)); - Promise<_::JoinPromises> promise(false, - _::maybeChain(kj::mv(intermediate), implicitCast(nullptr))); - - return PromiseFulfillerPair { kj::mv(promise), kj::mv(wrapper) }; -} - -} // namespace kj - -#endif // KJ_ASYNC_INL_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async-io.h b/phonelibs/capnp-cpp/mac/include/kj/async-io.h deleted file mode 100644 index 2804ed7289..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async-io.h +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_IO_H_ -#define KJ_ASYNC_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "function.h" -#include "thread.h" -#include "time.h" - -struct sockaddr; - -namespace kj { - -#if _WIN32 -class Win32EventPort; -#else -class UnixEventPort; -#endif - -class NetworkAddress; -class AsyncOutputStream; - -// ======================================================================================= -// Streaming I/O - -class AsyncInputStream { - // Asynchronous equivalent of InputStream (from io.h). - -public: - virtual Promise read(void* buffer, size_t minBytes, size_t maxBytes); - virtual Promise tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - - Promise read(void* buffer, size_t bytes); - - virtual Maybe tryGetLength(); - // Get the remaining number of bytes that will be produced by this stream, if known. - // - // This is used e.g. to fill in the Content-Length header of an HTTP message. If unknown, the - // HTTP implementation may need to fall back to Transfer-Encoding: chunked. - // - // The default implementation always returns null. - - virtual Promise pumpTo( - AsyncOutputStream& output, uint64_t amount = kj::maxValue); - // Read `amount` bytes from this stream (or to EOF) and write them to `output`, returning the - // total bytes actually pumped (which is only less than `amount` if EOF was reached). - // - // Override this if your stream type knows how to pump itself to certain kinds of output - // streams more efficiently than via the naive approach. You can use - // kj::dynamicDowncastIfAvailable() to test for stream types you recognize, and if none match, - // delegate to the default implementation. - // - // The default implementation first tries calling output.tryPumpFrom(), but if that fails, it - // performs a naive pump by allocating a buffer and reading to it / writing from it in a loop. - - Promise> readAllBytes(); - Promise readAllText(); - // Read until EOF and return as one big byte array or string. -}; - -class AsyncOutputStream { - // Asynchronous equivalent of OutputStream (from io.h). - -public: - virtual Promise write(const void* buffer, size_t size) KJ_WARN_UNUSED_RESULT = 0; - virtual Promise write(ArrayPtr> pieces) - KJ_WARN_UNUSED_RESULT = 0; - - virtual Maybe> tryPumpFrom( - AsyncInputStream& input, uint64_t amount = kj::maxValue); - // Implements double-dispatch for AsyncInputStream::pumpTo(). - // - // This method should only be called from within an implementation of pumpTo(). - // - // This method examines the type of `input` to find optimized ways to pump data from it to this - // output stream. If it finds one, it performs the pump. Otherwise, it returns null. - // - // The default implementation always returns null. -}; - -class AsyncIoStream: public AsyncInputStream, public AsyncOutputStream { - // A combination input and output stream. - -public: - virtual void shutdownWrite() = 0; - // Cleanly shut down just the write end of the stream, while keeping the read end open. - - virtual void abortRead() {} - // Similar to shutdownWrite, but this will shut down the read end of the stream, and should only - // be called when an error has occurred. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception - // if the stream is not a socket or the option is not appropriate for the socket type. The - // default implementations always throw "unimplemented". - - virtual void getsockname(struct sockaddr* addr, uint* length); - virtual void getpeername(struct sockaddr* addr, uint* length); - // Corresponds to getsockname() and getpeername() syscalls. Will throw an "unimplemented" - // exception if the stream is not a socket. The default implementations always throw - // "unimplemented". - // - // Note that we don't provide methods that return NetworkAddress because it usually wouldn't - // be useful. You can't connect() to or listen() on these addresses, obviously, because they are - // ephemeral addresses for a single connection. -}; - -struct OneWayPipe { - // A data pipe with an input end and an output end. (Typically backed by pipe() system call.) - - Own in; - Own out; -}; - -struct TwoWayPipe { - // A data pipe that supports sending in both directions. Each end's output sends data to the - // other end's input. (Typically backed by socketpair() system call.) - - Own ends[2]; -}; - -class ConnectionReceiver { - // Represents a server socket listening on a port. - -public: - virtual Promise> accept() = 0; - // Accept the next incoming connection. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Datagram I/O - -class AncillaryMessage { - // Represents an ancillary message (aka control message) received using the recvmsg() system - // call (or equivalent). Most apps will not use this. - -public: - inline AncillaryMessage(int level, int type, ArrayPtr data); - AncillaryMessage() = default; - - inline int getLevel() const; - // Originating protocol / socket level. - - inline int getType() const; - // Protocol-specific message type. - - template - inline Maybe as(); - // Interpret the ancillary message as the given struct type. Most ancillary messages are some - // sort of struct, so this is a convenient way to access it. Returns nullptr if the message - // is smaller than the struct -- this can happen if the message was truncated due to - // insufficient ancillary buffer space. - - template - inline ArrayPtr asArray(); - // Interpret the ancillary message as an array of items. If the message size does not evenly - // divide into elements of type T, the remainder is discarded -- this can happen if the message - // was truncated due to insufficient ancillary buffer space. - -private: - int level; - int type; - ArrayPtr data; - // Message data. In most cases you should use `as()` or `asArray()`. -}; - -class DatagramReceiver { - // Class encapsulating the recvmsg() system call. You must specify the DatagramReceiver's - // capacity in advance; if a received packet is larger than the capacity, it will be truncated. - -public: - virtual Promise receive() = 0; - // Receive a new message, overwriting this object's content. - // - // receive() may reuse the same buffers for content and ancillary data with each call. - - template - struct MaybeTruncated { - T value; - - bool isTruncated; - // True if the Receiver's capacity was insufficient to receive the value and therefore the - // value is truncated. - }; - - virtual MaybeTruncated> getContent() = 0; - // Get the content of the datagram. - - virtual MaybeTruncated> getAncillary() = 0; - // Ancilarry messages received with the datagram. See the recvmsg() system call and the cmsghdr - // struct. Most apps don't need this. - // - // If the returned value is truncated, then the last message in the array may itself be - // truncated, meaning its as() method will return nullptr or its asArray() method will - // return fewer elements than expected. Truncation can also mean that additional messages were - // available but discarded. - - virtual NetworkAddress& getSource() = 0; - // Get the datagram sender's address. - - struct Capacity { - size_t content = 8192; - // How much space to allocate for the datagram content. If a datagram is received that is - // larger than this, it will be truncated, with no way to recover the tail. - - size_t ancillary = 0; - // How much space to allocate for ancillary messages. As with content, if the ancillary data - // is larger than this, it will be truncated. - }; -}; - -class DatagramPort { -public: - virtual Promise send(const void* buffer, size_t size, NetworkAddress& destination) = 0; - virtual Promise send(ArrayPtr> pieces, - NetworkAddress& destination) = 0; - - virtual Own makeReceiver( - DatagramReceiver::Capacity capacity = DatagramReceiver::Capacity()) = 0; - // Create a new `Receiver` that can be used to receive datagrams. `capacity` specifies how much - // space to allocate for the received message. The `DatagramPort` must outlive the `Receiver`. - - virtual uint getPort() = 0; - // Gets the port number, if applicable (i.e. if listening on IP). This is useful if you didn't - // specify a port when constructing the NetworkAddress -- one will have been assigned - // automatically. - - virtual void getsockopt(int level, int option, void* value, uint* length); - virtual void setsockopt(int level, int option, const void* value, uint length); - // Same as the methods of AsyncIoStream. -}; - -// ======================================================================================= -// Networks - -class NetworkAddress { - // Represents a remote address to which the application can connect. - -public: - virtual Promise> connect() = 0; - // Make a new connection to this address. - // - // The address must not be a wildcard ("*"). If it is an IP address, it must have a port number. - - virtual Own listen() = 0; - // Listen for incoming connections on this address. - // - // The address must be local. - - virtual Own bindDatagramPort(); - // Open this address as a datagram (e.g. UDP) port. - // - // The address must be local. - - virtual Own clone() = 0; - // Returns an equivalent copy of this NetworkAddress. - - virtual String toString() = 0; - // Produce a human-readable string which hopefully can be passed to Network::parseAddress() - // to reproduce this address, although whether or not that works of course depends on the Network - // implementation. This should be called only to display the address to human users, who will - // hopefully know what they are able to do with it. -}; - -class Network { - // Factory for NetworkAddress instances, representing the network services offered by the - // operating system. - // - // This interface typically represents broad authority, and well-designed code should limit its - // use to high-level startup code and user interaction. Low-level APIs should accept - // NetworkAddress instances directly and work from there, if at all possible. - -public: - virtual Promise> parseAddress(StringPtr addr, uint portHint = 0) = 0; - // Construct a network address from a user-provided string. The format of the address - // strings is not specified at the API level, and application code should make no assumptions - // about them. These strings should always be provided by humans, and said humans will know - // what format to use in their particular context. - // - // `portHint`, if provided, specifies the "standard" IP port number for the application-level - // service in play. If the address turns out to be an IP address (v4 or v6), and it lacks a - // port number, this port will be used. If `addr` lacks a port number *and* `portHint` is - // omitted, then the returned address will only support listen() and bindDatagramPort() - // (not connect()), and an unused port will be chosen each time one of those methods is called. - - virtual Own getSockaddr(const void* sockaddr, uint len) = 0; - // Construct a network address from a legacy struct sockaddr. -}; - -// ======================================================================================= -// I/O Provider - -class AsyncIoProvider { - // Class which constructs asynchronous wrappers around the operating system's I/O facilities. - // - // Generally, the implementation of this interface must integrate closely with a particular - // `EventLoop` implementation. Typically, the EventLoop implementation itself will provide - // an AsyncIoProvider. - -public: - virtual OneWayPipe newOneWayPipe() = 0; - // Creates an input/output stream pair representing the ends of a one-way pipe (e.g. created with - // the pipe(2) system call). - - virtual TwoWayPipe newTwoWayPipe() = 0; - // Creates two AsyncIoStreams representing the two ends of a two-way pipe (e.g. created with - // socketpair(2) system call). Data written to one end can be read from the other. - - virtual Network& getNetwork() = 0; - // Creates a new `Network` instance representing the networks exposed by the operating system. - // - // DO NOT CALL THIS except at the highest levels of your code, ideally in the main() function. If - // you call this from low-level code, then you are preventing higher-level code from injecting an - // alternative implementation. Instead, if your code needs to use network functionality, it - // should ask for a `Network` as a constructor or method parameter, so that higher-level code can - // chose what implementation to use. The system network is essentially a singleton. See: - // http://www.object-oriented-security.org/lets-argue/singletons - // - // Code that uses the system network should not make any assumptions about what kinds of - // addresses it will parse, as this could differ across platforms. String addresses should come - // strictly from the user, who will know how to write them correctly for their system. - // - // With that said, KJ currently supports the following string address formats: - // - IPv4: "1.2.3.4", "1.2.3.4:80" - // - IPv6: "1234:5678::abcd", "[1234:5678::abcd]:80" - // - Local IP wildcard (covers both v4 and v6): "*", "*:80" - // - Symbolic names: "example.com", "example.com:80", "example.com:http", "1.2.3.4:http" - // - Unix domain: "unix:/path/to/socket" - - struct PipeThread { - // A combination of a thread and a two-way pipe that communicates with that thread. - // - // The fields are intentionally ordered so that the pipe will be destroyed (and therefore - // disconnected) before the thread is destroyed (and therefore joined). Thus if the thread - // arranges to exit when it detects disconnect, destruction should be clean. - - Own thread; - Own pipe; - }; - - virtual PipeThread newPipeThread( - Function startFunc) = 0; - // Create a new thread and set up a two-way pipe (socketpair) which can be used to communicate - // with it. One end of the pipe is passed to the thread's start function and the other end of - // the pipe is returned. The new thread also gets its own `AsyncIoProvider` instance and will - // already have an active `EventLoop` when `startFunc` is called. - // - // TODO(someday): I'm not entirely comfortable with this interface. It seems to be doing too - // much at once but I'm not sure how to cleanly break it down. - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -class LowLevelAsyncIoProvider { - // Similar to `AsyncIoProvider`, but represents a lower-level interface that may differ on - // different operating systems. You should prefer to use `AsyncIoProvider` over this interface - // whenever possible, as `AsyncIoProvider` is portable and friendlier to dependency-injection. - // - // On Unix, this interface can be used to import native file descriptors into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as poll vs. epoll vs. kqueue vs. some higher-level event library. - // - // On Windows, this interface can be used to import native HANDLEs into the async framework. - // Different implementations of this interface might work on top of different event handling - // primitives, such as I/O completion ports vs. completion routines. - // - // TODO(port): Actually implement Windows support. - -public: - // --------------------------------------------------------------------------- - // Unix-specific stuff - - enum Flags { - // Flags controlling how to wrap a file descriptor. - - TAKE_OWNERSHIP = 1 << 0, - // The returned object should own the file descriptor, automatically closing it when destroyed. - // The close-on-exec flag will be set on the descriptor if it is not already. - // - // If this flag is not used, then the file descriptor is not automatically closed and the - // close-on-exec flag is not modified. - -#if !_WIN32 - ALREADY_CLOEXEC = 1 << 1, - // Indicates that the close-on-exec flag is known already to be set, so need not be set again. - // Only relevant when combined with TAKE_OWNERSHIP. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // set the close-on-exec flag immediately. Unfortunately, other OS's do not. - - ALREADY_NONBLOCK = 1 << 2 - // Indicates that the file descriptor is known already to be in non-blocking mode, so the flag - // need not be set again. Otherwise, all wrap*Fd() methods will enable non-blocking mode - // automatically. - // - // On Linux, all system calls which yield new file descriptors have flags or variants which - // enable non-blocking mode immediately. Unfortunately, other OS's do not. -#endif - }; - -#if _WIN32 - typedef uintptr_t Fd; - // On Windows, the `fd` parameter to each of these methods must be a SOCKET, and must have the - // flag WSA_FLAG_OVERLAPPED (which socket() uses by default, but WSASocket() wants you to specify - // explicitly). -#else - typedef int Fd; - // On Unix, any arbitrary file descriptor is supported. -#endif - - virtual Own wrapInputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncInputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapOutputFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncOutputStream wrapping a file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket file descriptor. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Promise> wrapConnectingSocketFd( - Fd fd, const struct sockaddr* addr, uint addrlen, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a socket and initiate a connection to the given address. - // The returned promise does not resolve until connection has completed. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapListenSocketFd(Fd fd, uint flags = 0) = 0; - // Create an AsyncIoStream wrapping a listen socket file descriptor. This socket should already - // have had `bind()` and `listen()` called on it, so it's ready for `accept()`. - // - // `flags` is a bitwise-OR of the values of the `Flags` enum. - - virtual Own wrapDatagramSocketFd(Fd fd, uint flags = 0); - - virtual Timer& getTimer() = 0; - // Returns a `Timer` based on real time. Time does not pass while event handlers are running -- - // it only updates when the event loop polls for system events. This means that calling `now()` - // on this timer does not require a system call. - // - // This timer is not affected by changes to the system date. It is unspecified whether the timer - // continues to count while the system is suspended. -}; - -Own newAsyncIoProvider(LowLevelAsyncIoProvider& lowLevel); -// Make a new AsyncIoProvider wrapping a `LowLevelAsyncIoProvider`. - -struct AsyncIoContext { - Own lowLevelProvider; - Own provider; - WaitScope& waitScope; - -#if _WIN32 - Win32EventPort& win32EventPort; -#else - UnixEventPort& unixEventPort; - // TEMPORARY: Direct access to underlying UnixEventPort, mainly for waiting on signals. This - // field will go away at some point when we have a chance to improve these interfaces. -#endif -}; - -AsyncIoContext setupAsyncIo(); -// Convenience method which sets up the current thread with everything it needs to do async I/O. -// The returned objects contain an `EventLoop` which is wrapping an appropriate `EventPort` for -// doing I/O on the host system, so everything is ready for the thread to start making async calls -// and waiting on promises. -// -// You would typically call this in your main() loop or in the start function of a thread. -// Example: -// -// int main() { -// auto ioContext = kj::setupAsyncIo(); -// -// // Now we can call an async function. -// Promise textPromise = getHttp(*ioContext.provider, "http://example.com"); -// -// // And we can wait for the promise to complete. Note that you can only use `wait()` -// // from the top level, not from inside a promise callback. -// String text = textPromise.wait(ioContext.waitScope); -// print(text); -// return 0; -// } -// -// WARNING: An AsyncIoContext can only be used in the thread and process that created it. In -// particular, note that after a fork(), an AsyncIoContext created in the parent process will -// not work correctly in the child, even if the parent ceases to use its copy. In particular -// note that this means that server processes which daemonize themselves at startup must wait -// until after daemonization to create an AsyncIoContext. - -// ======================================================================================= -// inline implementation details - -inline AncillaryMessage::AncillaryMessage( - int level, int type, ArrayPtr data) - : level(level), type(type), data(data) {} - -inline int AncillaryMessage::getLevel() const { return level; } -inline int AncillaryMessage::getType() const { return type; } - -template -inline Maybe AncillaryMessage::as() { - if (data.size() >= sizeof(T)) { - return *reinterpret_cast(data.begin()); - } else { - return nullptr; - } -} - -template -inline ArrayPtr AncillaryMessage::asArray() { - return arrayPtr(reinterpret_cast(data.begin()), data.size() / sizeof(T)); -} - -} // namespace kj - -#endif // KJ_ASYNC_IO_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async-prelude.h b/phonelibs/capnp-cpp/mac/include/kj/async-prelude.h deleted file mode 100644 index 0a5843f88a..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async-prelude.h +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains a bunch of internal declarations that must appear before async.h can start. -// We don't define these directly in async.h because it makes the file hard to read. - -#ifndef KJ_ASYNC_PRELUDE_H_ -#define KJ_ASYNC_PRELUDE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "exception.h" -#include "tuple.h" - -namespace kj { - -class EventLoop; -template -class Promise; -class WaitScope; - -template -Promise> joinPromises(Array>&& promises); -Promise joinPromises(Array>&& promises); - -namespace _ { // private - -template struct JoinPromises_ { typedef T Type; }; -template struct JoinPromises_> { typedef T Type; }; - -template -using JoinPromises = typename JoinPromises_::Type; -// If T is Promise, resolves to U, otherwise resolves to T. -// -// TODO(cleanup): Rename to avoid confusion with joinPromises() call which is completely -// unrelated. - -class PropagateException { - // A functor which accepts a kj::Exception as a parameter and returns a broken promise of - // arbitrary type which simply propagates the exception. -public: - class Bottom { - public: - Bottom(Exception&& exception): exception(kj::mv(exception)) {} - - Exception asException() { return kj::mv(exception); } - - private: - Exception exception; - }; - - Bottom operator()(Exception&& e) { - return Bottom(kj::mv(e)); - } - Bottom operator()(const Exception& e) { - return Bottom(kj::cp(e)); - } -}; - -template -struct ReturnType_ { typedef decltype(instance()(instance())) Type; }; -template -struct ReturnType_ { typedef decltype(instance()()) Type; }; - -template -using ReturnType = typename ReturnType_::Type; -// The return type of functor Func given a parameter of type T, with the special exception that if -// T is void, this is the return type of Func called with no arguments. - -template struct SplitTuplePromise_ { typedef Promise Type; }; -template -struct SplitTuplePromise_> { - typedef kj::Tuple>...> Type; -}; - -template -using SplitTuplePromise = typename SplitTuplePromise_::Type; -// T -> Promise -// Tuple -> Tuple> - -struct Void {}; -// Application code should NOT refer to this! See `kj::READY_NOW` instead. - -template struct FixVoid_ { typedef T Type; }; -template <> struct FixVoid_ { typedef Void Type; }; -template using FixVoid = typename FixVoid_::Type; -// FixVoid is just T unless T is void in which case it is _::Void (an empty struct). - -template struct UnfixVoid_ { typedef T Type; }; -template <> struct UnfixVoid_ { typedef void Type; }; -template using UnfixVoid = typename UnfixVoid_::Type; -// UnfixVoid is the opposite of FixVoid. - -template -struct MaybeVoidCaller { - // Calls the function converting a Void input to an empty parameter list and a void return - // value to a Void output. - - template - static inline Out apply(Func& func, In&& in) { - return func(kj::mv(in)); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, In& in) { - return func(in); - } -}; -template -struct MaybeVoidCaller { - template - static inline Out apply(Func& func, Void&& in) { - return func(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In&& in) { - func(kj::mv(in)); - return Void(); - } -}; -template -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, In& in) { - func(in); - return Void(); - } -}; -template <> -struct MaybeVoidCaller { - template - static inline Void apply(Func& func, Void&& in) { - func(); - return Void(); - } -}; - -template -inline T&& returnMaybeVoid(T&& t) { - return kj::fwd(t); -} -inline void returnMaybeVoid(Void&& v) {} - -class ExceptionOrValue; -class PromiseNode; -class ChainPromiseNode; -template -class ForkHub; - -class TaskSetImpl; - -class Event; - -class PromiseBase { -public: - kj::String trace(); - // Dump debug info about this promise. - -private: - Own node; - - PromiseBase() = default; - PromiseBase(Own&& node): node(kj::mv(node)) {} - - friend class kj::EventLoop; - friend class ChainPromiseNode; - template - friend class kj::Promise; - friend class TaskSetImpl; - template - friend Promise> kj::joinPromises(Array>&& promises); - friend Promise kj::joinPromises(Array>&& promises); -}; - -void detach(kj::Promise&& promise); -void waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, WaitScope& waitScope); -Promise yield(); -Own neverDone(); - -class NeverDone { -public: - template - operator Promise() const { - return Promise(false, neverDone()); - } - - KJ_NORETURN(void wait(WaitScope& waitScope) const); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_ASYNC_PRELUDE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async-unix.h b/phonelibs/capnp-cpp/mac/include/kj/async-unix.h deleted file mode 100644 index 06f128a50e..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async-unix.h +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_UNIX_H_ -#define KJ_ASYNC_UNIX_H_ - -#if _WIN32 -#error "This file is Unix-specific. On Windows, include async-win32.h instead." -#endif - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "time.h" -#include "vector.h" -#include "io.h" -#include - -#if __linux__ && !__BIONIC__ && !defined(KJ_USE_EPOLL) -// Default to epoll on Linux, except on Bionic (Android) which doesn't have signalfd.h. -#define KJ_USE_EPOLL 1 -#endif - -namespace kj { - -class UnixEventPort: public EventPort { - // An EventPort implementation which can wait for events on file descriptors as well as signals. - // This API only makes sense on Unix. - // - // The implementation uses `poll()` or possibly a platform-specific API (e.g. epoll, kqueue). - // To also wait on signals without race conditions, the implementation may block signals until - // just before `poll()` while using a signal handler which `siglongjmp()`s back to just before - // the signal was unblocked, or it may use a nicer platform-specific API like signalfd. - // - // The implementation reserves a signal for internal use. By default, it uses SIGUSR1. If you - // need to use SIGUSR1 for something else, you must offer a different signal by calling - // setReservedSignal() at startup. - // - // WARNING: A UnixEventPort can only be used in the thread and process that created it. In - // particular, note that after a fork(), a UnixEventPort created in the parent process will - // not work correctly in the child, even if the parent ceases to use its copy. In particular - // note that this means that server processes which daemonize themselves at startup must wait - // until after daemonization to create a UnixEventPort. - -public: - UnixEventPort(); - ~UnixEventPort() noexcept(false); - - class FdObserver; - // Class that watches an fd for readability or writability. See definition below. - - Promise onSignal(int signum); - // When the given signal is delivered to this thread, return the corresponding siginfo_t. - // The signal must have been captured using `captureSignal()`. - // - // If `onSignal()` has not been called, the signal will remain blocked in this thread. - // Therefore, a signal which arrives before `onSignal()` was called will not be "missed" -- the - // next call to 'onSignal()' will receive it. Also, you can control which thread receives a - // process-wide signal by only calling `onSignal()` on that thread's event loop. - // - // The result of waiting on the same signal twice at once is undefined. - - static void captureSignal(int signum); - // Arranges for the given signal to be captured and handled via UnixEventPort, so that you may - // then pass it to `onSignal()`. This method is static because it registers a signal handler - // which applies process-wide. If any other threads exist in the process when `captureSignal()` - // is called, you *must* set the signal mask in those threads to block this signal, otherwise - // terrible things will happen if the signal happens to be delivered to those threads. If at - // all possible, call `captureSignal()` *before* creating threads, so that threads you create in - // the future will inherit the proper signal mask. - // - // To un-capture a signal, simply install a different signal handler and then un-block it from - // the signal mask. - - static void setReservedSignal(int signum); - // Sets the signal number which `UnixEventPort` reserves for internal use. If your application - // needs to use SIGUSR1, call this at startup (before any calls to `captureSignal()` and before - // constructing an `UnixEventPort`) to offer a different signal. - - Timer& getTimer() { return timerImpl; } - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - -private: - struct TimerSet; // Defined in source file to avoid STL include. - class TimerPromiseAdapter; - class SignalPromiseAdapter; - - TimerImpl timerImpl; - - SignalPromiseAdapter* signalHead = nullptr; - SignalPromiseAdapter** signalTail = &signalHead; - - TimePoint readClock(); - void gotSignal(const siginfo_t& siginfo); - - friend class TimerPromiseAdapter; - -#if KJ_USE_EPOLL - AutoCloseFd epollFd; - AutoCloseFd signalFd; - AutoCloseFd eventFd; // Used for cross-thread wakeups. - - sigset_t signalFdSigset; - // Signal mask as currently set on the signalFd. Tracked so we can detect whether or not it - // needs updating. - - bool doEpollWait(int timeout); - -#else - class PollContext; - - FdObserver* observersHead = nullptr; - FdObserver** observersTail = &observersHead; - - unsigned long long threadId; // actually pthread_t -#endif -}; - -class UnixEventPort::FdObserver { - // Object which watches a file descriptor to determine when it is readable or writable. - // - // For listen sockets, "readable" means that there is a connection to accept(). For everything - // else, it means that read() (or recv()) will return data. - // - // The presence of out-of-band data should NOT fire this event. However, the event may - // occasionally fire spuriously (when there is actually no data to read), and one thing that can - // cause such spurious events is the arrival of OOB data on certain platforms whose event - // interfaces fail to distinguish between regular and OOB data (e.g. Mac OSX). - // - // WARNING: The exact behavior of this class differs across systems, since event interfaces - // vary wildly. Be sure to read the documentation carefully and avoid depending on unspecified - // behavior. If at all possible, use the higher-level AsyncInputStream interface instead. - -public: - enum Flags { - OBSERVE_READ = 1, - OBSERVE_WRITE = 2, - OBSERVE_URGENT = 4, - OBSERVE_READ_WRITE = OBSERVE_READ | OBSERVE_WRITE - }; - - FdObserver(UnixEventPort& eventPort, int fd, uint flags); - // Begin watching the given file descriptor for readability. Only one ReadObserver may exist - // for a given file descriptor at a time. - - ~FdObserver() noexcept(false); - - KJ_DISALLOW_COPY(FdObserver); - - Promise whenBecomesReadable(); - // Resolves the next time the file descriptor transitions from having no data to read to having - // some data to read. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already data in the read buffer which has been there since - // prior to the last turn of the event loop or prior to creation FdWatcher. In this case, it is - // unspecified whether the promise will ever resolve -- it depends on the underlying event - // mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesReadable()` - // only at times when you know the buffer is empty. You know this for sure when one of the - // following happens: - // * read() or recv() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * The file descriptor is a regular byte-oriented object (like a socket or pipe), - // read() or recv() returns fewer than the number of bytes requested, and `atEndHint()` - // returns false. This can only happen if the buffer is empty but EOF is not reached. (Note, - // though, that for record-oriented file descriptors like Linux's inotify interface, this - // rule does not hold, because it could simply be that the next record did not fit into the - // space available.) - // - // It is an error to call `whenBecomesReadable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - inline Maybe atEndHint() { return atEnd; } - // Returns true if the event system has indicated that EOF has been received. There may still - // be data in the read buffer, but once that is gone, there's nothing left. - // - // Returns false if the event system has indicated that EOF had NOT been received as of the - // last turn of the event loop. - // - // Returns nullptr if the event system does not know whether EOF has been reached. In this - // case, the only way to know for sure is to call read() or recv() and check if it returns - // zero. - // - // This hint may be useful as an optimization to avoid an unnecessary system call. - - Promise whenBecomesWritable(); - // Resolves the next time the file descriptor transitions from having no space available in the - // write buffer to having some space available. - // - // KJ uses "edge-triggered" event notification whenever possible. As a result, it is an error - // to call this method when there is already space in the write buffer which has been there - // since prior to the last turn of the event loop or prior to creation FdWatcher. In this case, - // it is unspecified whether the promise will ever resolve -- it depends on the underlying - // event mechanism being used. - // - // In order to avoid this problem, make sure that you only call `whenBecomesWritable()` - // only at times when you know the buffer is full. You know this for sure when one of the - // following happens: - // * write() or send() fails with EAGAIN or EWOULDBLOCK. (You MUST have non-blocking mode - // enabled on the fd!) - // * write() or send() succeeds but accepts fewer than the number of bytes provided. This can - // only happen if the buffer is full. - // - // It is an error to call `whenBecomesWritable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - - Promise whenUrgentDataAvailable(); - // Resolves the next time the file descriptor's read buffer contains "urgent" data. - // - // The conditions for availability of urgent data are specific to the file descriptor's - // underlying implementation. - // - // It is an error to call `whenUrgentDataAvailable()` again when the promise returned previously - // has not yet resolved. If you do this, the previous promise may throw an exception. - // - // WARNING: This has some known weird behavior on macOS. See - // https://github.com/sandstorm-io/capnproto/issues/374. - -private: - UnixEventPort& eventPort; - int fd; - uint flags; - - kj::Maybe>> readFulfiller; - kj::Maybe>> writeFulfiller; - kj::Maybe>> urgentFulfiller; - // Replaced each time `whenBecomesReadable()` or `whenBecomesWritable()` is called. Reverted to - // null every time an event is fired. - - Maybe atEnd; - - void fire(short events); - -#if !KJ_USE_EPOLL - FdObserver* next; - FdObserver** prev; - // Linked list of observers which currently have a non-null readFulfiller or writeFulfiller. - // If `prev` is null then the observer is not currently in the list. - - short getEventMask(); -#endif - - friend class UnixEventPort; -}; - -} // namespace kj - -#endif // KJ_ASYNC_UNIX_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async-win32.h b/phonelibs/capnp-cpp/mac/include/kj/async-win32.h deleted file mode 100644 index b70c42e016..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async-win32.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_WIN32_H_ -#define KJ_ASYNC_WIN32_H_ - -#if !_WIN32 -#error "This file is Windows-specific. On Unix, include async-unix.h instead." -#endif - -#include "async.h" -#include "time.h" -#include "io.h" -#include -#include - -// Include windows.h as lean as possible. (If you need more of the Windows API for your app, -// #include windows.h yourself before including this header.) -#define WIN32_LEAN_AND_MEAN 1 -#define NOSERVICE 1 -#define NOMCX 1 -#define NOIME 1 -#include -#include "windows-sanity.h" - -namespace kj { - -class Win32EventPort: public EventPort { - // Abstract base interface for EventPorts that can listen on Win32 event types. Due to the - // absurd complexity of the Win32 API, it's not possible to standardize on a single - // implementation of EventPort. In particular, there is no way for a single thread to use I/O - // completion ports (the most efficient way of handling I/O) while at the same time waiting for - // signalable handles or UI messages. - // - // Note that UI messages are not supported at all by this interface because the message queue - // is implemented by user32.dll and we want libkj to depend only on kernel32.dll. A separate - // compat library could provide a Win32EventPort implementation that works with the UI message - // queue. - -public: - // --------------------------------------------------------------------------- - // overlapped I/O - - struct IoResult { - DWORD errorCode; - DWORD bytesTransferred; - }; - - class IoOperation { - public: - virtual LPOVERLAPPED getOverlapped() = 0; - // Gets the OVERLAPPED structure to pass to the Win32 I/O call. Do NOT modify it; just pass it - // on. - - virtual Promise onComplete() = 0; - // After making the Win32 call, if the return value indicates that the operation was - // successfully queued (i.e. the completion event will definitely occur), call this to wait - // for completion. - // - // You MUST call this if the operation was successfully queued, and you MUST NOT call this - // otherwise. If the Win32 call failed (without queuing any operation or event) then you should - // simply drop the IoOperation object. - // - // Dropping the returned Promise cancels the operation via Win32's CancelIoEx(). The destructor - // will wait for the cancellation to complete, such that after dropping the proimse it is safe - // to free the buffer that the operation was reading from / writing to. - // - // You may safely drop the `IoOperation` while still waiting for this promise. You may not, - // however, drop the `IoObserver`. - }; - - class IoObserver { - public: - virtual Own newOperation(uint64_t offset) = 0; - // Begin an I/O operation. For file operations, `offset` is the offset within the file at - // which the operation will start. For stream operations, `offset` is ignored. - }; - - virtual Own observeIo(HANDLE handle) = 0; - // Given a handle which supports overlapped I/O, arrange to receive I/O completion events via - // this EventPort. - // - // Different Win32EventPort implementations may handle this in different ways, such as by using - // completion routines (APCs) or by using I/O completion ports. The caller should not assume - // any particular technique. - // - // WARNING: It is only safe to call observeIo() on a particular handle once during its lifetime. - // You cannot observe the same handle from multiple Win32EventPorts, even if not at the same - // time. This is because the Win32 API provides no way to disassociate a handle from an I/O - // completion port once it is associated. - - // --------------------------------------------------------------------------- - // signalable handles - // - // Warning: Due to limitations in the Win32 API, implementations of EventPort may be forced to - // spawn additional threads to wait for signaled objects. This is necessary if the EventPort - // implementation is based on I/O completion ports, or if you need to wait on more than 64 - // handles at once. - - class SignalObserver { - public: - virtual Promise onSignaled() = 0; - // Returns a promise that completes the next time the handle enters the signaled state. - // - // Depending on the type of handle, the handle may automatically be reset to a non-signaled - // state before the promise resolves. The underlying implementaiton uses WaitForSingleObject() - // or an equivalent wait call, so check the documentation for that to understand the semantics. - // - // If the handle is a mutex and it is abandoned without being unlocked, the promise breaks with - // an exception. - - virtual Promise onSignaledOrAbandoned() = 0; - // Like onSingaled(), but instead of throwing when a mutex is abandoned, resolves to `true`. - // Resolves to `false` for non-abandoned signals. - }; - - virtual Own observeSignalState(HANDLE handle) = 0; - // Given a handle that supports waiting for it to become "signaled" via WaitForSingleObject(), - // return an object that can wait for this state using the EventPort. - - // --------------------------------------------------------------------------- - // APCs - - virtual void allowApc() = 0; - // If this is ever called, the Win32EventPort will switch modes so that APCs can be scheduled - // on the thread, e.g. through the Win32 QueueUserAPC() call. In the future, this may be enabled - // by default. However, as of this writing, Wine does not support the necessary - // GetQueuedCompletionStatusEx() call, thus allowApc() breaks Wine support. (Tested on Wine - // 1.8.7.) - // - // If the event port implementation can't support APCs for some reason, this throws. - - // --------------------------------------------------------------------------- - // time - - virtual Timer& getTimer() = 0; -}; - -class Win32WaitObjectThreadPool { - // Helper class that implements Win32EventPort::observeSignalState() by spawning additional - // threads as needed to perform the actual waiting. - // - // This class is intended to be used to assist in building Win32EventPort implementations. - -public: - Win32WaitObjectThreadPool(uint mainThreadCount = 0); - // `mainThreadCount` indicates the number of objects the main thread is able to listen on - // directly. Typically this would be zero (e.g. if the main thread watches an I/O completion - // port) or MAXIMUM_WAIT_OBJECTS (e.g. if the main thread is a UI thread but can use - // MsgWaitForMultipleObjectsEx() to wait on some handles at the same time as messages). - - Own observeSignalState(HANDLE handle); - // Implemetns Win32EventPort::observeSignalState(). - - uint prepareMainThreadWait(HANDLE* handles[]); - // Call immediately before invoking WaitForMultipleObjects() or similar in the main thread. - // Fills in `handles` with the handle pointers to wait on, and returns the number of handles - // in this array. (The array should be allocated to be at least the size passed to the - // constructor). - // - // There's no need to call this if `mainThreadCount` as passed to the constructor was zero. - - bool finishedMainThreadWait(DWORD returnCode); - // Call immediately after invoking WaitForMultipleObjects() or similar in the main thread, - // passing the value returend by that call. Returns true if the event indicated by `returnCode` - // has been handled (i.e. it was WAIT_OBJECT_n or WAIT_ABANDONED_n where n is in-range for the - // last call to prepareMainThreadWait()). -}; - -class Win32IocpEventPort final: public Win32EventPort { - // An EventPort implementation which uses Windows I/O completion ports to listen for events. - // - // With this implementation, observeSignalState() requires spawning a separate thread. - -public: - Win32IocpEventPort(); - ~Win32IocpEventPort() noexcept(false); - - // implements EventPort ------------------------------------------------------ - bool wait() override; - bool poll() override; - void wake() const override; - - // implements Win32IocpEventPort --------------------------------------------- - Own observeIo(HANDLE handle) override; - Own observeSignalState(HANDLE handle) override; - Timer& getTimer() override { return timerImpl; } - void allowApc() override { isAllowApc = true; } - -private: - class IoPromiseAdapter; - class IoOperationImpl; - class IoObserverImpl; - - AutoCloseHandle iocp; - AutoCloseHandle thread; - Win32WaitObjectThreadPool waitThreads; - TimerImpl timerImpl; - mutable std::atomic sentWake {false}; - bool isAllowApc = false; - - static TimePoint readClock(); - - void waitIocp(DWORD timeoutMs); - // Wait on the I/O completion port for up to timeoutMs and pump events. Does not advance the - // timer; caller must do that. - - bool receivedWake(); - - static AutoCloseHandle newIocpHandle(); - static AutoCloseHandle openCurrentThread(); -}; - -} // namespace kj - -#endif // KJ_ASYNC_WIN32_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/async.h b/phonelibs/capnp-cpp/mac/include/kj/async.h deleted file mode 100644 index 5a9d9bdae7..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/async.h +++ /dev/null @@ -1,682 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ASYNC_H_ -#define KJ_ASYNC_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async-prelude.h" -#include "exception.h" -#include "refcount.h" - -namespace kj { - -class EventLoop; -class WaitScope; - -template -class Promise; -template -class ForkedPromise; -template -class PromiseFulfiller; -template -struct PromiseFulfillerPair; - -template -using PromiseForResult = Promise<_::JoinPromises<_::ReturnType>>; -// Evaluates to the type of Promise for the result of calling functor type Func with parameter type -// T. If T is void, then the promise is for the result of calling Func with no arguments. If -// Func itself returns a promise, the promises are joined, so you never get Promise>. - -// ======================================================================================= -// Promises - -template -class Promise: protected _::PromiseBase { - // The basic primitive of asynchronous computation in KJ. Similar to "futures", but designed - // specifically for event loop concurrency. Similar to E promises and JavaScript Promises/A. - // - // A Promise represents a promise to produce a value of type T some time in the future. Once - // that value has been produced, the promise is "fulfilled". Alternatively, a promise can be - // "broken", with an Exception describing what went wrong. You may implicitly convert a value of - // type T to an already-fulfilled Promise. You may implicitly convert the constant - // `kj::READY_NOW` to an already-fulfilled Promise. You may also implicitly convert a - // `kj::Exception` to an already-broken promise of any type. - // - // Promises are linear types -- they are moveable but not copyable. If a Promise is destroyed - // or goes out of scope (without being moved elsewhere), any ongoing asynchronous operations - // meant to fulfill the promise will be canceled if possible. All methods of `Promise` (unless - // otherwise noted) actually consume the promise in the sense of move semantics. (Arguably they - // should be rvalue-qualified, but at the time this interface was created compilers didn't widely - // support that yet and anyway it would be pretty ugly typing kj::mv(promise).whatever().) If - // you want to use one Promise in two different places, you must fork it with `fork()`. - // - // To use the result of a Promise, you must call `then()` and supply a callback function to - // call with the result. `then()` returns another promise, for the result of the callback. - // Any time that this would result in Promise>, the promises are collapsed into a - // simple Promise that first waits for the outer promise, then the inner. Example: - // - // // Open a remote file, read the content, and then count the - // // number of lines of text. - // // Note that none of the calls here block. `file`, `content` - // // and `lineCount` are all initialized immediately before any - // // asynchronous operations occur. The lambda callbacks are - // // called later. - // Promise> file = openFtp("ftp://host/foo/bar"); - // Promise content = file.then( - // [](Own file) -> Promise { - // return file.readAll(); - // }); - // Promise lineCount = content.then( - // [](String text) -> int { - // uint count = 0; - // for (char c: text) count += (c == '\n'); - // return count; - // }); - // - // For `then()` to work, the current thread must have an active `EventLoop`. Each callback - // is scheduled to execute in that loop. Since `then()` schedules callbacks only on the current - // thread's event loop, you do not need to worry about two callbacks running at the same time. - // You will need to set up at least one `EventLoop` at the top level of your program before you - // can use promises. - // - // To adapt a non-Promise-based asynchronous API to promises, use `newAdaptedPromise()`. - // - // Systems using promises should consider supporting the concept of "pipelining". Pipelining - // means allowing a caller to start issuing method calls against a promised object before the - // promise has actually been fulfilled. This is particularly useful if the promise is for a - // remote object living across a network, as this can avoid round trips when chaining a series - // of calls. It is suggested that any class T which supports pipelining implement a subclass of - // Promise which adds "eventual send" methods -- methods which, when called, say "please - // invoke the corresponding method on the promised value once it is available". These methods - // should in turn return promises for the eventual results of said invocations. Cap'n Proto, - // for example, implements the type `RemotePromise` which supports pipelining RPC requests -- see - // `capnp/capability.h`. - // - // KJ Promises are based on E promises: - // http://wiki.erights.org/wiki/Walnut/Distributed_Computing#Promises - // - // KJ Promises are also inspired in part by the evolving standards for JavaScript/ECMAScript - // promises, which are themselves influenced by E promises: - // http://promisesaplus.com/ - // https://github.com/domenic/promises-unwrapping - -public: - Promise(_::FixVoid value); - // Construct an already-fulfilled Promise from a value of type T. For non-void promises, the - // parameter type is simply T. So, e.g., in a function that returns `Promise`, you can - // say `return 123;` to return a promise that is already fulfilled to 123. - // - // For void promises, use `kj::READY_NOW` as the value, e.g. `return kj::READY_NOW`. - - Promise(kj::Exception&& e); - // Construct an already-broken Promise. - - inline Promise(decltype(nullptr)) {} - - template - PromiseForResult then(Func&& func, ErrorFunc&& errorHandler = _::PropagateException()) - KJ_WARN_UNUSED_RESULT; - // Register a continuation function to be executed when the promise completes. The continuation - // (`func`) takes the promised value (an rvalue of type `T`) as its parameter. The continuation - // may return a new value; `then()` itself returns a promise for the continuation's eventual - // result. If the continuation itself returns a `Promise`, then `then()` shall also return - // a `Promise` which first waits for the original promise, then executes the continuation, - // then waits for the inner promise (i.e. it automatically "unwraps" the promise). - // - // In all cases, `then()` returns immediately. The continuation is executed later. The - // continuation is always executed on the same EventLoop (and, therefore, the same thread) which - // called `then()`, therefore no synchronization is necessary on state shared by the continuation - // and the surrounding scope. If no EventLoop is running on the current thread, `then()` throws - // an exception. - // - // You may also specify an error handler continuation as the second parameter. `errorHandler` - // must be a functor taking a parameter of type `kj::Exception&&`. It must return the same - // type as `func` returns (except when `func` returns `Promise`, in which case `errorHandler` - // may return either `Promise` or just `U`). The default error handler simply propagates the - // exception to the returned promise. - // - // Either `func` or `errorHandler` may, of course, throw an exception, in which case the promise - // is broken. When compiled with -fno-exceptions, the framework will still detect when a - // recoverable exception was thrown inside of a continuation and will consider the promise - // broken even though a (presumably garbage) result was returned. - // - // If the returned promise is destroyed before the callback runs, the callback will be canceled - // (it will never run). - // - // Note that `then()` -- like all other Promise methods -- consumes the promise on which it is - // called, in the sense of move semantics. After returning, the original promise is no longer - // valid, but `then()` returns a new promise. - // - // *Advanced implementation tips:* Most users will never need to worry about the below, but - // it is good to be aware of. - // - // As an optimization, if the callback function `func` does _not_ return another promise, then - // execution of `func` itself may be delayed until its result is known to be needed. The - // expectation here is that `func` is just doing some transformation on the results, not - // scheduling any other actions, therefore the system doesn't need to be proactive about - // evaluating it. This way, a chain of trivial then() transformations can be executed all at - // once without repeatedly re-scheduling through the event loop. Use the `eagerlyEvaluate()` - // method to suppress this behavior. - // - // On the other hand, if `func` _does_ return another promise, then the system evaluates `func` - // as soon as possible, because the promise it returns might be for a newly-scheduled - // long-running asynchronous task. - // - // As another optimization, when a callback function registered with `then()` is actually - // scheduled, it is scheduled to occur immediately, preempting other work in the event queue. - // This allows a long chain of `then`s to execute all at once, improving cache locality by - // clustering operations on the same data. However, this implies that starvation can occur - // if a chain of `then()`s takes a very long time to execute without ever stopping to wait for - // actual I/O. To solve this, use `kj::evalLater()` to yield control; this way, all other events - // in the queue will get a chance to run before your callback is executed. - - Promise ignoreResult() KJ_WARN_UNUSED_RESULT { return then([](T&&) {}); } - // Convenience method to convert the promise to a void promise by ignoring the return value. - // - // You must still wait on the returned promise if you want the task to execute. - - template - Promise catch_(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - // Equivalent to `.then(identityFunc, errorHandler)`, where `identifyFunc` is a function that - // just returns its input. - - T wait(WaitScope& waitScope); - // Run the event loop until the promise is fulfilled, then return its result. If the promise - // is rejected, throw an exception. - // - // wait() is primarily useful at the top level of a program -- typically, within the function - // that allocated the EventLoop. For example, a program that performs one or two RPCs and then - // exits would likely use wait() in its main() function to wait on each RPC. On the other hand, - // server-side code generally cannot use wait(), because it has to be able to accept multiple - // requests at once. - // - // If the promise is rejected, `wait()` throws an exception. If the program was compiled without - // exceptions (-fno-exceptions), this will usually abort. In this case you really should first - // use `then()` to set an appropriate handler for the exception case, so that the promise you - // actually wait on never throws. - // - // `waitScope` is an object proving that the caller is in a scope where wait() is allowed. By - // convention, any function which might call wait(), or which might call another function which - // might call wait(), must take `WaitScope&` as one of its parameters. This is needed for two - // reasons: - // * `wait()` is not allowed during an event callback, because event callbacks are themselves - // called during some other `wait()`, and such recursive `wait()`s would only be able to - // complete in LIFO order, which might mean that the outer `wait()` ends up waiting longer - // than it is supposed to. To prevent this, a `WaitScope` cannot be constructed or used during - // an event callback. - // * Since `wait()` runs the event loop, unrelated event callbacks may execute before `wait()` - // returns. This means that anyone calling `wait()` must be reentrant -- state may change - // around them in arbitrary ways. Therefore, callers really need to know if a function they - // are calling might wait(), and the `WaitScope&` parameter makes this clear. - // - // TODO(someday): Implement fibers, and let them call wait() even when they are handling an - // event. - - ForkedPromise fork() KJ_WARN_UNUSED_RESULT; - // Forks the promise, so that multiple different clients can independently wait on the result. - // `T` must be copy-constructable for this to work. Or, in the special case where `T` is - // `Own`, `U` must have a method `Own addRef()` which returns a new reference to the same - // (or an equivalent) object (probably implemented via reference counting). - - _::SplitTuplePromise split(); - // Split a promise for a tuple into a tuple of promises. - // - // E.g. if you have `Promise>`, `split()` returns - // `kj::Tuple, Promise>`. - - Promise exclusiveJoin(Promise&& other) KJ_WARN_UNUSED_RESULT; - // Return a new promise that resolves when either the original promise resolves or `other` - // resolves (whichever comes first). The promise that didn't resolve first is canceled. - - // TODO(someday): inclusiveJoin(), or perhaps just join(), which waits for both completions - // and produces a tuple? - - template - Promise attach(Attachments&&... attachments) KJ_WARN_UNUSED_RESULT; - // "Attaches" one or more movable objects (often, Owns) to the promise, such that they will - // be destroyed when the promise resolves. This is useful when a promise's callback contains - // pointers into some object and you want to make sure the object still exists when the callback - // runs -- after calling then(), use attach() to add necessary objects to the result. - - template - Promise eagerlyEvaluate(ErrorFunc&& errorHandler) KJ_WARN_UNUSED_RESULT; - Promise eagerlyEvaluate(decltype(nullptr)) KJ_WARN_UNUSED_RESULT; - // Force eager evaluation of this promise. Use this if you are going to hold on to the promise - // for awhile without consuming the result, but you want to make sure that the system actually - // processes it. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. We make you specify this because otherwise it's - // easy to forget to handle errors in a promise that you never use. You may specify nullptr for - // the error handler if you are sure that ignoring errors is fine, or if you know that you'll - // eventually wait on the promise somewhere. - - template - void detach(ErrorFunc&& errorHandler); - // Allows the promise to continue running in the background until it completes or the - // `EventLoop` is destroyed. Be careful when using this: since you can no longer cancel this - // promise, you need to make sure that the promise owns all the objects it touches or make sure - // those objects outlive the EventLoop. - // - // `errorHandler` is a function that takes `kj::Exception&&`, like the second parameter to - // `then()`, except that it must return void. - // - // This function exists mainly to implement the Cap'n Proto requirement that RPC calls cannot be - // canceled unless the callee explicitly permits it. - - kj::String trace(); - // Returns a dump of debug info about this promise. Not for production use. Requires RTTI. - // This method does NOT consume the promise as other methods do. - -private: - Promise(bool, Own<_::PromiseNode>&& node): PromiseBase(kj::mv(node)) {} - // Second parameter prevent ambiguity with immediate-value constructor. - - template - friend class Promise; - friend class EventLoop; - template - friend Promise newAdaptedPromise(Params&&... adapterConstructorParams); - template - friend PromiseFulfillerPair newPromiseAndFulfiller(); - template - friend class _::ForkHub; - friend class _::TaskSetImpl; - friend Promise _::yield(); - friend class _::NeverDone; - template - friend Promise> joinPromises(Array>&& promises); - friend Promise joinPromises(Array>&& promises); -}; - -template -class ForkedPromise { - // The result of `Promise::fork()` and `EventLoop::fork()`. Allows branches to be created. - // Like `Promise`, this is a pass-by-move type. - -public: - inline ForkedPromise(decltype(nullptr)) {} - - Promise addBranch(); - // Add a new branch to the fork. The branch is equivalent to the original promise. - -private: - Own<_::ForkHub<_::FixVoid>> hub; - - inline ForkedPromise(bool, Own<_::ForkHub<_::FixVoid>>&& hub): hub(kj::mv(hub)) {} - - friend class Promise; - friend class EventLoop; -}; - -constexpr _::Void READY_NOW = _::Void(); -// Use this when you need a Promise that is already fulfilled -- this value can be implicitly -// cast to `Promise`. - -constexpr _::NeverDone NEVER_DONE = _::NeverDone(); -// The opposite of `READY_NOW`, return this when the promise should never resolve. This can be -// implicitly converted to any promise type. You may also call `NEVER_DONE.wait()` to wait -// forever (useful for servers). - -template -PromiseForResult evalLater(Func&& func) KJ_WARN_UNUSED_RESULT; -// Schedule for the given zero-parameter function to be executed in the event loop at some -// point in the near future. Returns a Promise for its result -- or, if `func()` itself returns -// a promise, `evalLater()` returns a Promise for the result of resolving that promise. -// -// Example usage: -// Promise x = evalLater([]() { return 123; }); -// -// The above is exactly equivalent to: -// Promise x = Promise(READY_NOW).then([]() { return 123; }); -// -// If the returned promise is destroyed before the callback runs, the callback will be canceled -// (never called). -// -// If you schedule several evaluations with `evalLater` during the same callback, they are -// guaranteed to be executed in order. - -template -PromiseForResult evalNow(Func&& func) KJ_WARN_UNUSED_RESULT; -// Run `func()` and return a promise for its result. `func()` executes before `evalNow()` returns. -// If `func()` throws an exception, the exception is caught and wrapped in a promise -- this is the -// main reason why `evalNow()` is useful. - -template -Promise> joinPromises(Array>&& promises); -// Join an array of promises into a promise for an array. - -// ======================================================================================= -// Hack for creating a lambda that holds an owned pointer. - -template -class CaptureByMove { -public: - inline CaptureByMove(Func&& func, MovedParam&& param) - : func(kj::mv(func)), param(kj::mv(param)) {} - - template - inline auto operator()(Params&&... params) - -> decltype(kj::instance()(kj::instance(), kj::fwd(params)...)) { - return func(kj::mv(param), kj::fwd(params)...); - } - -private: - Func func; - MovedParam param; -}; - -template -inline CaptureByMove> mvCapture(MovedParam&& param, Func&& func) { - // Hack to create a "lambda" which captures a variable by moving it rather than copying or - // referencing. C++14 generalized captures should make this obsolete, but for now in C++11 this - // is commonly needed for Promise continuations that own their state. Example usage: - // - // Own ptr = makeFoo(); - // Promise promise = callRpc(); - // promise.then(mvCapture(ptr, [](Own&& ptr, int result) { - // return ptr->finish(result); - // })); - - return CaptureByMove>(kj::fwd(func), kj::mv(param)); -} - -// ======================================================================================= -// Advanced promise construction - -template -class PromiseFulfiller { - // A callback which can be used to fulfill a promise. Only the first call to fulfill() or - // reject() matters; subsequent calls are ignored. - -public: - virtual void fulfill(T&& value) = 0; - // Fulfill the promise with the given value. - - virtual void reject(Exception&& exception) = 0; - // Reject the promise with an error. - - virtual bool isWaiting() = 0; - // Returns true if the promise is still unfulfilled and someone is potentially waiting for it. - // Returns false if fulfill()/reject() has already been called *or* if the promise to be - // fulfilled has been discarded and therefore the result will never be used anyway. - - template - bool rejectIfThrows(Func&& func); - // Call the function (with no arguments) and return true. If an exception is thrown, call - // `fulfiller.reject()` and then return false. When compiled with exceptions disabled, - // non-fatal exceptions are still detected and handled correctly. -}; - -template <> -class PromiseFulfiller { - // Specialization of PromiseFulfiller for void promises. See PromiseFulfiller. - -public: - virtual void fulfill(_::Void&& value = _::Void()) = 0; - // Call with zero parameters. The parameter is a dummy that only exists so that subclasses don't - // have to specialize for . - - virtual void reject(Exception&& exception) = 0; - virtual bool isWaiting() = 0; - - template - bool rejectIfThrows(Func&& func); -}; - -template -Promise newAdaptedPromise(Params&&... adapterConstructorParams); -// Creates a new promise which owns an instance of `Adapter` which encapsulates the operation -// that will eventually fulfill the promise. This is primarily useful for adapting non-KJ -// asynchronous APIs to use promises. -// -// An instance of `Adapter` will be allocated and owned by the returned `Promise`. A -// `PromiseFulfiller&` will be passed as the first parameter to the adapter's constructor, -// and `adapterConstructorParams` will be forwarded as the subsequent parameters. The adapter -// is expected to perform some asynchronous operation and call the `PromiseFulfiller` once -// it is finished. -// -// The adapter is destroyed when its owning Promise is destroyed. This may occur before the -// Promise has been fulfilled. In this case, the adapter's destructor should cancel the -// asynchronous operation. Once the adapter is destroyed, the fulfillment callback cannot be -// called. -// -// An adapter implementation should be carefully written to ensure that it cannot accidentally -// be left unfulfilled permanently because of an exception. Consider making liberal use of -// `PromiseFulfiller::rejectIfThrows()`. - -template -struct PromiseFulfillerPair { - Promise<_::JoinPromises> promise; - Own> fulfiller; -}; - -template -PromiseFulfillerPair newPromiseAndFulfiller(); -// Construct a Promise and a separate PromiseFulfiller which can be used to fulfill the promise. -// If the PromiseFulfiller is destroyed before either of its methods are called, the Promise is -// implicitly rejected. -// -// Although this function is easier to use than `newAdaptedPromise()`, it has the serious drawback -// that there is no way to handle cancellation (i.e. detect when the Promise is discarded). -// -// You can arrange to fulfill a promise with another promise by using a promise type for T. E.g. -// `newPromiseAndFulfiller>()` will produce a promise of type `Promise` but the -// fulfiller will be of type `PromiseFulfiller>`. Thus you pass a `Promise` to the -// `fulfill()` callback, and the promises are chained. - -// ======================================================================================= -// TaskSet - -class TaskSet { - // Holds a collection of Promises and ensures that each executes to completion. Memory - // associated with each promise is automatically freed when the promise completes. Destroying - // the TaskSet itself automatically cancels all unfinished promises. - // - // This is useful for "daemon" objects that perform background tasks which aren't intended to - // fulfill any particular external promise, but which may need to be canceled (and thus can't - // use `Promise::detach()`). The daemon object holds a TaskSet to collect these tasks it is - // working on. This way, if the daemon itself is destroyed, the TaskSet is detroyed as well, - // and everything the daemon is doing is canceled. - -public: - class ErrorHandler { - public: - virtual void taskFailed(kj::Exception&& exception) = 0; - }; - - TaskSet(ErrorHandler& errorHandler); - // `loop` will be used to wait on promises. `errorHandler` will be executed any time a task - // throws an exception, and will execute within the given EventLoop. - - ~TaskSet() noexcept(false); - - void add(Promise&& promise); - - kj::String trace(); - // Return debug info about all promises currently in the TaskSet. - -private: - Own<_::TaskSetImpl> impl; -}; - -// ======================================================================================= -// The EventLoop class - -class EventPort { - // Interfaces between an `EventLoop` and events originating from outside of the loop's thread. - // All such events come in through the `EventPort` implementation. - // - // An `EventPort` implementation may interface with low-level operating system APIs and/or other - // threads. You can also write an `EventPort` which wraps some other (non-KJ) event loop - // framework, allowing the two to coexist in a single thread. - -public: - virtual bool wait() = 0; - // Wait for an external event to arrive, sleeping if necessary. Once at least one event has - // arrived, queue it to the event loop (e.g. by fulfilling a promise) and return. - // - // This is called during `Promise::wait()` whenever the event queue becomes empty, in order to - // wait for new events to populate the queue. - // - // It is safe to return even if nothing has actually been queued, so long as calling `wait()` in - // a loop will eventually sleep. (That is to say, false positives are fine.) - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual bool poll() = 0; - // Check if any external events have arrived, but do not sleep. If any events have arrived, - // add them to the event queue (e.g. by fulfilling promises) before returning. - // - // This may be called during `Promise::wait()` when the EventLoop has been executing for a while - // without a break but is still non-empty. - // - // Returns true if wake() has been called from another thread. (Precisely, returns true if - // no previous call to wait `wait()` nor `poll()` has returned true since `wake()` was last - // called.) - - virtual void setRunnable(bool runnable); - // Called to notify the `EventPort` when the `EventLoop` has work to do; specifically when it - // transitions from empty -> runnable or runnable -> empty. This is typically useful when - // integrating with an external event loop; if the loop is currently runnable then you should - // arrange to call run() on it soon. The default implementation does nothing. - - virtual void wake() const; - // Wake up the EventPort's thread from another thread. - // - // Unlike all other methods on this interface, `wake()` may be called from another thread, hence - // it is `const`. - // - // Technically speaking, `wake()` causes the target thread to cease sleeping and not to sleep - // again until `wait()` or `poll()` has returned true at least once. - // - // The default implementation throws an UNIMPLEMENTED exception. -}; - -class EventLoop { - // Represents a queue of events being executed in a loop. Most code won't interact with - // EventLoop directly, but instead use `Promise`s to interact with it indirectly. See the - // documentation for `Promise`. - // - // Each thread can have at most one current EventLoop. To make an `EventLoop` current for - // the thread, create a `WaitScope`. Async APIs require that the thread has a current EventLoop, - // or they will throw exceptions. APIs that use `Promise::wait()` additionally must explicitly - // be passed a reference to the `WaitScope` to make the caller aware that they might block. - // - // Generally, you will want to construct an `EventLoop` at the top level of your program, e.g. - // in the main() function, or in the start function of a thread. You can then use it to - // construct some promises and wait on the result. Example: - // - // int main() { - // // `loop` becomes the official EventLoop for the thread. - // MyEventPort eventPort; - // EventLoop loop(eventPort); - // - // // Now we can call an async function. - // Promise textPromise = getHttp("http://example.com"); - // - // // And we can wait for the promise to complete. Note that you can only use `wait()` - // // from the top level, not from inside a promise callback. - // String text = textPromise.wait(); - // print(text); - // return 0; - // } - // - // Most applications that do I/O will prefer to use `setupAsyncIo()` from `async-io.h` rather - // than allocate an `EventLoop` directly. - -public: - EventLoop(); - // Construct an `EventLoop` which does not receive external events at all. - - explicit EventLoop(EventPort& port); - // Construct an `EventLoop` which receives external events through the given `EventPort`. - - ~EventLoop() noexcept(false); - - void run(uint maxTurnCount = maxValue); - // Run the event loop for `maxTurnCount` turns or until there is nothing left to be done, - // whichever comes first. This never calls the `EventPort`'s `sleep()` or `poll()`. It will - // call the `EventPort`'s `setRunnable(false)` if the queue becomes empty. - - bool isRunnable(); - // Returns true if run() would currently do anything, or false if the queue is empty. - -private: - EventPort& port; - - bool running = false; - // True while looping -- wait() is then not allowed. - - bool lastRunnableState = false; - // What did we last pass to port.setRunnable()? - - _::Event* head = nullptr; - _::Event** tail = &head; - _::Event** depthFirstInsertPoint = &head; - - Own<_::TaskSetImpl> daemons; - - bool turn(); - void setRunnable(bool runnable); - void enterScope(); - void leaveScope(); - - friend void _::detach(kj::Promise&& promise); - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); - friend class _::Event; - friend class WaitScope; -}; - -class WaitScope { - // Represents a scope in which asynchronous programming can occur. A `WaitScope` should usually - // be allocated on the stack and serves two purposes: - // * While the `WaitScope` exists, its `EventLoop` is registered as the current loop for the - // thread. Most operations dealing with `Promise` (including all of its methods) do not work - // unless the thread has a current `EventLoop`. - // * `WaitScope` may be passed to `Promise::wait()` to synchronously wait for a particular - // promise to complete. See `Promise::wait()` for an extended discussion. - -public: - inline explicit WaitScope(EventLoop& loop): loop(loop) { loop.enterScope(); } - inline ~WaitScope() { loop.leaveScope(); } - KJ_DISALLOW_COPY(WaitScope); - -private: - EventLoop& loop; - friend class EventLoop; - friend void _::waitImpl(Own<_::PromiseNode>&& node, _::ExceptionOrValue& result, - WaitScope& waitScope); -}; - -} // namespace kj - -#include "async-inl.h" - -#endif // KJ_ASYNC_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/common.h b/phonelibs/capnp-cpp/mac/include/kj/common.h deleted file mode 100644 index 4a908ae000..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/common.h +++ /dev/null @@ -1,1400 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Header that should be #included by everyone. -// -// This defines very simple utilities that are widely applicable. - -#ifndef KJ_COMMON_H_ -#define KJ_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef KJ_NO_COMPILER_CHECK -#if __cplusplus < 201103L && !__CDT_PARSER__ && !_MSC_VER - #error "This code requires C++11. Either your compiler does not support it or it is not enabled." - #ifdef __GNUC__ - // Compiler claims compatibility with GCC, so presumably supports -std. - #error "Pass -std=c++11 on the compiler command line to enable C++11." - #endif -#endif - -#ifdef __GNUC__ - #if __clang__ - #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 2) - #warning "This library requires at least Clang 3.2." - #elif defined(__apple_build_version__) && __apple_build_version__ <= 4250028 - #warning "This library requires at least Clang 3.2. XCode 4.6's Clang, which claims to be "\ - "version 4.2 (wat?), is actually built from some random SVN revision between 3.1 "\ - "and 3.2. Unfortunately, it is insufficient for compiling this library. You can "\ - "download the real Clang 3.2 (or newer) from the Clang web site. Step-by-step "\ - "instructions can be found in Cap'n Proto's documentation: "\ - "http://kentonv.github.io/capnproto/install.html#clang_32_on_mac_osx" - #elif __cplusplus >= 201103L && !__has_include() - #warning "Your compiler supports C++11 but your C++ standard library does not. If your "\ - "system has libc++ installed (as should be the case on e.g. Mac OSX), try adding "\ - "-stdlib=libc++ to your CXXFLAGS." - #endif - #else - #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) - #warning "This library requires at least GCC 4.7." - #endif - #endif -#elif defined(_MSC_VER) - #if _MSC_VER < 1900 - #error "You need Visual Studio 2015 or better to compile this code." - #endif -#else - #warning "I don't recognize your compiler. As of this writing, Clang and GCC are the only "\ - "known compilers with enough C++11 support for this library. "\ - "#define KJ_NO_COMPILER_CHECK to make this warning go away." -#endif -#endif - -#include -#include - -#if __linux__ && __cplusplus > 201200L -// Hack around stdlib bug with C++14 that exists on some Linux systems. -// Apparently in this mode the C library decides not to define gets() but the C++ library still -// tries to import it into the std namespace. This bug has been fixed at the source but is still -// widely present in the wild e.g. on Ubuntu 14.04. -#undef _GLIBCXX_HAVE_GETS -#endif - -#if defined(_MSC_VER) -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif -#include // __popcnt -#endif - -// ======================================================================================= - -namespace kj { - -typedef unsigned int uint; -typedef unsigned char byte; - -// ======================================================================================= -// Common macros, especially for common yet compiler-specific features. - -// Detect whether RTTI and exceptions are enabled, assuming they are unless we have specific -// evidence to the contrary. Clients can always define KJ_NO_RTTI or KJ_NO_EXCEPTIONS explicitly -// to override these checks. -#ifdef __GNUC__ - #if !defined(KJ_NO_RTTI) && !__GXX_RTTI - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !__EXCEPTIONS - #define KJ_NO_EXCEPTIONS 1 - #endif -#elif defined(_MSC_VER) - #if !defined(KJ_NO_RTTI) && !defined(_CPPRTTI) - #define KJ_NO_RTTI 1 - #endif - #if !defined(KJ_NO_EXCEPTIONS) && !defined(_CPPUNWIND) - #define KJ_NO_EXCEPTIONS 1 - #endif -#endif - -#if !defined(KJ_DEBUG) && !defined(KJ_NDEBUG) -// Heuristically decide whether to enable debug mode. If DEBUG or NDEBUG is defined, use that. -// Otherwise, fall back to checking whether optimization is enabled. -#if defined(DEBUG) || defined(_DEBUG) -#define KJ_DEBUG -#elif defined(NDEBUG) -#define KJ_NDEBUG -#elif __OPTIMIZE__ -#define KJ_NDEBUG -#else -#define KJ_DEBUG -#endif -#endif - -#define KJ_DISALLOW_COPY(classname) \ - classname(const classname&) = delete; \ - classname& operator=(const classname&) = delete -// Deletes the implicit copy constructor and assignment operator. - -#ifdef __GNUC__ -#define KJ_LIKELY(condition) __builtin_expect(condition, true) -#define KJ_UNLIKELY(condition) __builtin_expect(condition, false) -// Branch prediction macros. Evaluates to the condition given, but also tells the compiler that we -// expect the condition to be true/false enough of the time that it's worth hard-coding branch -// prediction. -#else -#define KJ_LIKELY(condition) (condition) -#define KJ_UNLIKELY(condition) (condition) -#endif - -#if defined(KJ_DEBUG) || __NO_INLINE__ -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ -// Don't force inline in debug mode. -#else -#if defined(_MSC_VER) -#define KJ_ALWAYS_INLINE(...) __forceinline __VA_ARGS__ -#else -#define KJ_ALWAYS_INLINE(...) inline __VA_ARGS__ __attribute__((always_inline)) -#endif -// Force a function to always be inlined. Apply only to the prototype, not to the definition. -#endif - -#if defined(_MSC_VER) -#define KJ_NOINLINE __declspec(noinline) -#else -#define KJ_NOINLINE __attribute__((noinline)) -#endif - -#if defined(_MSC_VER) -#define KJ_NORETURN(prototype) __declspec(noreturn) prototype -#define KJ_UNUSED -#define KJ_WARN_UNUSED_RESULT -// TODO(msvc): KJ_WARN_UNUSED_RESULT can use _Check_return_ on MSVC, but it's a prefix, so -// wrapping the whole prototype is needed. http://msdn.microsoft.com/en-us/library/jj159529.aspx -// Similarly, KJ_UNUSED could use __pragma(warning(suppress:...)), but again that's a prefix. -#else -#define KJ_NORETURN(prototype) prototype __attribute__((noreturn)) -#define KJ_UNUSED __attribute__((unused)) -#define KJ_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#endif - -#if __clang__ -#define KJ_UNUSED_MEMBER __attribute__((unused)) -// Inhibits "unused" warning for member variables. Only Clang produces such a warning, while GCC -// complains if the attribute is set on members. -#else -#define KJ_UNUSED_MEMBER -#endif - -#if __clang__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated(reason))) -#define KJ_UNAVAILABLE(reason) \ - __attribute__((unavailable(reason))) -#elif __GNUC__ -#define KJ_DEPRECATED(reason) \ - __attribute__((deprecated)) -#define KJ_UNAVAILABLE(reason) -#else -#define KJ_DEPRECATED(reason) -#define KJ_UNAVAILABLE(reason) -// TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated). -#endif - -namespace _ { // private - -KJ_NORETURN(void inlineRequireFailure( - const char* file, int line, const char* expectation, const char* macroArgs, - const char* message = nullptr)); - -KJ_NORETURN(void unreachable()); - -} // namespace _ (private) - -#ifdef KJ_DEBUG -#if _MSC_VER -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, "" #__VA_ARGS__, __VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#else -#define KJ_IREQUIRE(condition, ...) \ - if (KJ_LIKELY(condition)); else ::kj::_::inlineRequireFailure( \ - __FILE__, __LINE__, #condition, #__VA_ARGS__, ##__VA_ARGS__) -// Version of KJ_DREQUIRE() which is safe to use in headers that are #included by users. Used to -// check preconditions inside inline methods. KJ_IREQUIRE is particularly useful in that -// it will be enabled depending on whether the application is compiled in debug mode rather than -// whether libkj is. -#endif -#else -#define KJ_IREQUIRE(condition, ...) -#endif - -#define KJ_IASSERT KJ_IREQUIRE - -#define KJ_UNREACHABLE ::kj::_::unreachable(); -// Put this on code paths that cannot be reached to suppress compiler warnings about missing -// returns. - -#if __clang__ -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT -#else -#define KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT KJ_UNREACHABLE -#endif - -// #define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) -// -// Allocate an array, preferably on the stack, unless it is too big. On GCC this will use -// variable-sized arrays. For other compilers we could just use a fixed-size array. `minStack` -// is the stack array size to use if variable-width arrays are not supported. `maxStack` is the -// maximum stack array size if variable-width arrays *are* supported. -#if __GNUC__ && !__clang__ -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (maxStack); \ - type name##_stack[name##_isOnStack ? size : 0]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#else -#define KJ_STACK_ARRAY(type, name, size, minStack, maxStack) \ - size_t name##_size = (size); \ - bool name##_isOnStack = name##_size <= (minStack); \ - type name##_stack[minStack]; \ - ::kj::Array name##_heap = name##_isOnStack ? \ - nullptr : kj::heapArray(name##_size); \ - ::kj::ArrayPtr name = name##_isOnStack ? \ - kj::arrayPtr(name##_stack, name##_size) : name##_heap -#endif - -#define KJ_CONCAT_(x, y) x##y -#define KJ_CONCAT(x, y) KJ_CONCAT_(x, y) -#define KJ_UNIQUE_NAME(prefix) KJ_CONCAT(prefix, __LINE__) -// Create a unique identifier name. We use concatenate __LINE__ rather than __COUNTER__ so that -// the name can be used multiple times in the same macro. - -#if _MSC_VER - -#define KJ_CONSTEXPR(...) __VA_ARGS__ -// Use in cases where MSVC barfs on constexpr. A replacement keyword (e.g. "const") can be -// provided, or just leave blank to remove the keyword entirely. -// -// TODO(msvc): Remove this hack once MSVC fully supports constexpr. - -#ifndef __restrict__ -#define __restrict__ __restrict -// TODO(msvc): Would it be better to define a KJ_RESTRICT macro? -#endif - -#pragma warning(disable: 4521 4522) -// This warning complains when there are two copy constructors, one for a const reference and -// one for a non-const reference. It is often quite necessary to do this in wrapper templates, -// therefore this warning is dumb and we disable it. - -#pragma warning(disable: 4458) -// Warns when a parameter name shadows a class member. Unfortunately my code does this a lot, -// since I don't use a special name format for members. - -#else // _MSC_VER -#define KJ_CONSTEXPR(...) constexpr -#endif - -// ======================================================================================= -// Template metaprogramming helpers. - -template struct NoInfer_ { typedef T Type; }; -template using NoInfer = typename NoInfer_::Type; -// Use NoInfer::Type in place of T for a template function parameter to prevent inference of -// the type based on the parameter value. - -template struct RemoveConst_ { typedef T Type; }; -template struct RemoveConst_ { typedef T Type; }; -template using RemoveConst = typename RemoveConst_::Type; - -template struct IsLvalueReference_ { static constexpr bool value = false; }; -template struct IsLvalueReference_ { static constexpr bool value = true; }; -template -inline constexpr bool isLvalueReference() { return IsLvalueReference_::value; } - -template struct Decay_ { typedef T Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template struct Decay_ { typedef typename Decay_::Type Type; }; -template using Decay = typename Decay_::Type; - -template struct EnableIf_; -template <> struct EnableIf_ { typedef void Type; }; -template using EnableIf = typename EnableIf_::Type; -// Use like: -// -// template ()> -// void func(T&& t); - -template struct VoidSfinae_ { using Type = void; }; -template using VoidSfinae = typename VoidSfinae_::Type; -// Note: VoidSfinae is std::void_t from C++17. - -template -T instance() noexcept; -// Like std::declval, but doesn't transform T into an rvalue reference. If you want that, specify -// instance(). - -struct DisallowConstCopy { - // Inherit from this, or declare a member variable of this type, to prevent the class from being - // copyable from a const reference -- instead, it will only be copyable from non-const references. - // This is useful for enforcing transitive constness of contained pointers. - // - // For example, say you have a type T which contains a pointer. T has non-const methods which - // modify the value at that pointer, but T's const methods are designed to allow reading only. - // Unfortunately, if T has a regular copy constructor, someone can simply make a copy of T and - // then use it to modify the pointed-to value. However, if T inherits DisallowConstCopy, then - // callers will only be able to copy non-const instances of T. Ideally, there is some - // parallel type ImmutableT which is like a version of T that only has const methods, and can - // be copied from a const T. - // - // Note that due to C++ rules about implicit copy constructors and assignment operators, any - // type that contains or inherits from a type that disallows const copies will also automatically - // disallow const copies. Hey, cool, that's exactly what we want. - -#if CAPNP_DEBUG_TYPES - // Alas! Declaring a defaulted non-const copy constructor tickles a bug which causes GCC and - // Clang to disagree on ABI, using different calling conventions to pass this type, leading to - // immediate segfaults. See: - // https://bugs.llvm.org/show_bug.cgi?id=23764 - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58074 - // - // Because of this, we can't use this technique. We guard it by CAPNP_DEBUG_TYPES so that it - // still applies to the Cap'n Proto developers during internal testing. - - DisallowConstCopy() = default; - DisallowConstCopy(DisallowConstCopy&) = default; - DisallowConstCopy(DisallowConstCopy&&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&) = default; - DisallowConstCopy& operator=(DisallowConstCopy&&) = default; -#endif -}; - -#if _MSC_VER - -#define KJ_CPCAP(obj) obj=::kj::cp(obj) -// TODO(msvc): MSVC refuses to invoke non-const versions of copy constructors in by-value lambda -// captures. Wrap your captured object in this macro to force the compiler to perform a copy. -// Example: -// -// struct Foo: DisallowConstCopy {}; -// Foo foo; -// auto lambda = [KJ_CPCAP(foo)] {}; - -#else - -#define KJ_CPCAP(obj) obj -// Clang and gcc both already perform copy capturing correctly with non-const copy constructors. - -#endif - -template -struct DisallowConstCopyIfNotConst: public DisallowConstCopy { - // Inherit from this when implementing a template that contains a pointer to T and which should - // enforce transitive constness. If T is a const type, this has no effect. Otherwise, it is - // an alias for DisallowConstCopy. -}; - -template -struct DisallowConstCopyIfNotConst {}; - -template struct IsConst_ { static constexpr bool value = false; }; -template struct IsConst_ { static constexpr bool value = true; }; -template constexpr bool isConst() { return IsConst_::value; } - -template struct EnableIfNotConst_ { typedef T Type; }; -template struct EnableIfNotConst_; -template using EnableIfNotConst = typename EnableIfNotConst_::Type; - -template struct EnableIfConst_; -template struct EnableIfConst_ { typedef T Type; }; -template using EnableIfConst = typename EnableIfConst_::Type; - -template struct RemoveConstOrDisable_ { struct Type; }; -template struct RemoveConstOrDisable_ { typedef T Type; }; -template using RemoveConstOrDisable = typename RemoveConstOrDisable_::Type; - -template struct IsReference_ { static constexpr bool value = false; }; -template struct IsReference_ { static constexpr bool value = true; }; -template constexpr bool isReference() { return IsReference_::value; } - -template -struct PropagateConst_ { typedef To Type; }; -template -struct PropagateConst_ { typedef const To Type; }; -template -using PropagateConst = typename PropagateConst_::Type; - -namespace _ { // private - -template -T refIfLvalue(T&&); - -} // namespace _ (private) - -#define KJ_DECLTYPE_REF(exp) decltype(::kj::_::refIfLvalue(exp)) -// Like decltype(exp), but if exp is an lvalue, produces a reference type. -// -// int i; -// decltype(i) i1(i); // i1 has type int. -// KJ_DECLTYPE_REF(i + 1) i2(i + 1); // i2 has type int. -// KJ_DECLTYPE_REF(i) i3(i); // i3 has type int&. -// KJ_DECLTYPE_REF(kj::mv(i)) i4(kj::mv(i)); // i4 has type int. - -template -struct CanConvert_ { - static int sfinae(T); - static bool sfinae(...); -}; - -template -constexpr bool canConvert() { - return sizeof(CanConvert_::sfinae(instance())) == sizeof(int); -} - -#if __GNUC__ && !__clang__ && __GNUC__ < 5 -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - // GCC 4 does not have __is_trivially_constructible and friends, and there doesn't seem to be - // any reliable alternative. __has_trivial_copy() and __has_trivial_assign() return the right - // thing at one point but later on they changed such that a deleted copy constructor was - // considered "trivial" (apparently technically correct, though useless). So, on GCC 4 we give up - // and assume we can't memcpy() at all, and must explicitly copy-construct everything. - return false; -} -#define KJ_ASSERT_CAN_MEMCPY(T) -#else -template -constexpr bool canMemcpy() { - // Returns true if T can be copied using memcpy instead of using the copy constructor or - // assignment operator. - - return __is_trivially_constructible(T, const T&) && __is_trivially_assignable(T, const T&); -} -#define KJ_ASSERT_CAN_MEMCPY(T) \ - static_assert(kj::canMemcpy(), "this code expects this type to be memcpy()-able"); -#endif - -// ======================================================================================= -// Equivalents to std::move() and std::forward(), since these are very commonly needed and the -// std header pulls in lots of other stuff. -// -// We use abbreviated names mv and fwd because these helpers (especially mv) are so commonly used -// that the cost of typing more letters outweighs the cost of being slightly harder to understand -// when first encountered. - -template constexpr T&& mv(T& t) noexcept { return static_cast(t); } -template constexpr T&& fwd(NoInfer& t) noexcept { return static_cast(t); } - -template constexpr T cp(T& t) noexcept { return t; } -template constexpr T cp(const T& t) noexcept { return t; } -// Useful to force a copy, particularly to pass into a function that expects T&&. - -template struct ChooseType_; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef T Type; }; -template struct ChooseType_ { typedef U Type; }; - -template -using WiderType = typename ChooseType_= sizeof(U)>::Type; - -template -inline constexpr auto min(T&& a, U&& b) -> WiderType, Decay> { - return a < b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr auto max(T&& a, U&& b) -> WiderType, Decay> { - return a > b ? WiderType, Decay>(a) : WiderType, Decay>(b); -} - -template -inline constexpr size_t size(T (&arr)[s]) { return s; } -template -inline constexpr size_t size(T&& arr) { return arr.size(); } -// Returns the size of the parameter, whether the parameter is a regular C array or a container -// with a `.size()` method. - -class MaxValue_ { -private: - template - inline constexpr T maxSigned() const { - return (1ull << (sizeof(T) * 8 - 1)) - 1; - } - template - inline constexpr T maxUnsigned() const { - return ~static_cast(0u); - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MaxValue_::maxSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MaxValue_::maxUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MaxValue_::maxSigned() - : MaxValue_::maxUnsigned(); - } -}; - -class MinValue_ { -private: - template - inline constexpr T minSigned() const { - return 1ull << (sizeof(T) * 8 - 1); - } - template - inline constexpr T minUnsigned() const { - return 0u; - } - -public: -#define _kJ_HANDLE_TYPE(T) \ - inline constexpr operator signed T() const { return MinValue_::minSigned < signed T>(); } \ - inline constexpr operator unsigned T() const { return MinValue_::minUnsigned(); } - _kJ_HANDLE_TYPE(char) - _kJ_HANDLE_TYPE(short) - _kJ_HANDLE_TYPE(int) - _kJ_HANDLE_TYPE(long) - _kJ_HANDLE_TYPE(long long) -#undef _kJ_HANDLE_TYPE - - inline constexpr operator char() const { - // `char` is different from both `signed char` and `unsigned char`, and may be signed or - // unsigned on different platforms. Ugh. - return char(-1) < 0 ? MinValue_::minSigned() - : MinValue_::minUnsigned(); - } -}; - -static KJ_CONSTEXPR(const) MaxValue_ maxValue = MaxValue_(); -// A special constant which, when cast to an integer type, takes on the maximum possible value of -// that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -static KJ_CONSTEXPR(const) MinValue_ minValue = MinValue_(); -// A special constant which, when cast to an integer type, takes on the minimum possible value -// of that type. This is useful to use as e.g. a parameter to a function because it will be robust -// in the face of changes to the parameter's type. -// -// `char` is not supported, but `signed char` and `unsigned char` are. - -template -inline bool operator==(T t, MaxValue_) { return t == Decay(maxValue); } -template -inline bool operator==(T t, MinValue_) { return t == Decay(minValue); } - -template -inline constexpr unsigned long long maxValueForBits() { - // Get the maximum integer representable in the given number of bits. - - // 1ull << 64 is unfortunately undefined. - return (bits == 64 ? 0 : (1ull << bits)) - 1; -} - -struct ThrowOverflow { - // Functor which throws an exception complaining about integer overflow. Usually this is used - // with the interfaces in units.h, but is defined here because Cap'n Proto wants to avoid - // including units.h when not using CAPNP_DEBUG_TYPES. - void operator()() const; -}; - -#if __GNUC__ -inline constexpr float inf() { return __builtin_huge_valf(); } -inline constexpr float nan() { return __builtin_nanf(""); } - -#elif _MSC_VER - -// Do what MSVC math.h does -#pragma warning(push) -#pragma warning(disable: 4756) // "overflow in constant arithmetic" -inline constexpr float inf() { return (float)(1e300 * 1e300); } -#pragma warning(pop) - -float nan(); -// Unfortunatley, inf() * 0.0f produces a NaN with the sign bit set, whereas our preferred -// canonical NaN should not have the sign bit set. std::numeric_limits::quiet_NaN() -// returns the correct NaN, but we don't want to #include that here. So, we give up and make -// this out-of-line on MSVC. -// -// TODO(msvc): Can we do better? - -#else -#error "Not sure how to support your compiler." -#endif - -inline constexpr bool isNaN(float f) { return f != f; } -inline constexpr bool isNaN(double f) { return f != f; } - -inline int popCount(unsigned int x) { -#if defined(_MSC_VER) - return __popcnt(x); - // Note: __popcnt returns unsigned int, but the value is clearly guaranteed to fit into an int -#else - return __builtin_popcount(x); -#endif -} - -// ======================================================================================= -// Useful fake containers - -template -class Range { -public: - inline constexpr Range(const T& begin, const T& end): begin_(begin), end_(end) {} - inline explicit constexpr Range(const T& end): begin_(0), end_(end) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value): value(value) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](size_t index) const { return value + index; } - inline Iterator& operator++() { ++value; return *this; } - inline Iterator operator++(int) { return Iterator(value++); } - inline Iterator& operator--() { --value; return *this; } - inline Iterator operator--(int) { return Iterator(value--); } - inline Iterator& operator+=(ptrdiff_t amount) { value += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { value -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return value - other.value; } - - inline bool operator==(const Iterator& other) const { return value == other.value; } - inline bool operator!=(const Iterator& other) const { return value != other.value; } - inline bool operator<=(const Iterator& other) const { return value <= other.value; } - inline bool operator>=(const Iterator& other) const { return value >= other.value; } - inline bool operator< (const Iterator& other) const { return value < other.value; } - inline bool operator> (const Iterator& other) const { return value > other.value; } - - private: - T value; - }; - - inline Iterator begin() const { return Iterator(begin_); } - inline Iterator end() const { return Iterator(end_); } - - inline auto size() const -> decltype(instance() - instance()) { return end_ - begin_; } - -private: - T begin_; - T end_; -}; - -template -inline constexpr Range, Decay>> range(T begin, U end) { - return Range, Decay>>(begin, end); -} - -template -inline constexpr Range> range(T begin, T end) { return Range>(begin, end); } -// Returns a fake iterable container containing all values of T from `begin` (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::range(1, 10)) { print(i); } - -template -inline constexpr Range> zeroTo(T end) { return Range>(end); } -// Returns a fake iterable container containing all values of T from zero (inclusive) to `end` -// (exclusive). Example: -// -// // Prints 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. -// for (int i: kj::zeroTo(10)) { print(i); } - -template -inline constexpr Range indices(T&& container) { - // Shortcut for iterating over the indices of a container: - // - // for (size_t i: kj::indices(myArray)) { handle(myArray[i]); } - - return range(0, kj::size(container)); -} - -template -class Repeat { -public: - inline constexpr Repeat(const T& value, size_t count): value(value), count(count) {} - - class Iterator { - public: - Iterator() = default; - inline Iterator(const T& value, size_t index): value(value), index(index) {} - - inline const T& operator* () const { return value; } - inline const T& operator[](ptrdiff_t index) const { return value; } - inline Iterator& operator++() { ++index; return *this; } - inline Iterator operator++(int) { return Iterator(value, index++); } - inline Iterator& operator--() { --index; return *this; } - inline Iterator operator--(int) { return Iterator(value, index--); } - inline Iterator& operator+=(ptrdiff_t amount) { index += amount; return *this; } - inline Iterator& operator-=(ptrdiff_t amount) { index -= amount; return *this; } - inline Iterator operator+ (ptrdiff_t amount) const { return Iterator(value, index + amount); } - inline Iterator operator- (ptrdiff_t amount) const { return Iterator(value, index - amount); } - inline ptrdiff_t operator- (const Iterator& other) const { return index - other.index; } - - inline bool operator==(const Iterator& other) const { return index == other.index; } - inline bool operator!=(const Iterator& other) const { return index != other.index; } - inline bool operator<=(const Iterator& other) const { return index <= other.index; } - inline bool operator>=(const Iterator& other) const { return index >= other.index; } - inline bool operator< (const Iterator& other) const { return index < other.index; } - inline bool operator> (const Iterator& other) const { return index > other.index; } - - private: - T value; - size_t index; - }; - - inline Iterator begin() const { return Iterator(value, 0); } - inline Iterator end() const { return Iterator(value, count); } - - inline size_t size() const { return count; } - inline const T& operator[](ptrdiff_t) const { return value; } - -private: - T value; - size_t count; -}; - -template -inline constexpr Repeat> repeat(T&& value, size_t count) { - // Returns a fake iterable which contains `count` repeats of `value`. Useful for e.g. creating - // a bunch of spaces: `kj::repeat(' ', indent * 2)` - - return Repeat>(value, count); -} - -// ======================================================================================= -// Manually invoking constructors and destructors -// -// ctor(x, ...) and dtor(x) invoke x's constructor or destructor, respectively. - -// We want placement new, but we don't want to #include . operator new cannot be defined in -// a namespace, and defining it globally conflicts with the definition in . So we have to -// define a dummy type and an operator new that uses it. - -namespace _ { // private -struct PlacementNew {}; -} // namespace _ (private) -} // namespace kj - -inline void* operator new(size_t, kj::_::PlacementNew, void* __p) noexcept { - return __p; -} - -inline void operator delete(void*, kj::_::PlacementNew, void* __p) noexcept {} - -namespace kj { - -template -inline void ctor(T& location, Params&&... params) { - new (_::PlacementNew(), &location) T(kj::fwd(params)...); -} - -template -inline void dtor(T& location) { - location.~T(); -} - -// ======================================================================================= -// Maybe -// -// Use in cases where you want to indicate that a value may be null. Using Maybe instead of T* -// forces the caller to handle the null case in order to satisfy the compiler, thus reliably -// preventing null pointer dereferences at runtime. -// -// Maybe can be implicitly constructed from T and from nullptr. Additionally, it can be -// implicitly constructed from T*, in which case the pointer is checked for nullness at runtime. -// To read the value of a Maybe, do: -// -// KJ_IF_MAYBE(value, someFuncReturningMaybe()) { -// doSomething(*value); -// } else { -// maybeWasNull(); -// } -// -// KJ_IF_MAYBE's first parameter is a variable name which will be defined within the following -// block. The variable will behave like a (guaranteed non-null) pointer to the Maybe's value, -// though it may or may not actually be a pointer. -// -// Note that Maybe actually just wraps a pointer, whereas Maybe wraps a T and a boolean -// indicating nullness. - -template -class Maybe; - -namespace _ { // private - -template -class NullableValue { - // Class whose interface behaves much like T*, but actually contains an instance of T and a - // boolean flag indicating nullness. - -public: - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline NullableValue(NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - inline ~NullableValue() -#if _MSC_VER - // TODO(msvc): MSVC has a hard time with noexcept specifier expressions that are more complex - // than `true` or `false`. We had a workaround for VS2015, but VS2017 regressed. - noexcept(false) -#else - noexcept(noexcept(instance().~T())) -#endif - { - if (isSet) { - dtor(value); - } - } - - inline T& operator*() & { return value; } - inline const T& operator*() const & { return value; } - inline T&& operator*() && { return kj::mv(value); } - inline const T&& operator*() const && { return kj::mv(value); } - inline T* operator->() { return &value; } - inline const T* operator->() const { return &value; } - inline operator T*() { return isSet ? &value : nullptr; } - inline operator const T*() const { return isSet ? &value : nullptr; } - - template - inline T& emplace(Params&&... params) { - if (isSet) { - isSet = false; - dtor(value); - } - ctor(value, kj::fwd(params)...); - isSet = true; - return value; - } - -private: // internal interface used by friends only - inline NullableValue() noexcept: isSet(false) {} - inline NullableValue(T&& t) noexcept(noexcept(T(instance()))) - : isSet(true) { - ctor(value, kj::mv(t)); - } - inline NullableValue(T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T& t) - : isSet(true) { - ctor(value, t); - } - inline NullableValue(const T* t) - : isSet(t != nullptr) { - if (isSet) ctor(value, *t); - } - template - inline NullableValue(NullableValue&& other) noexcept(noexcept(T(instance()))) - : isSet(other.isSet) { - if (isSet) { - ctor(value, kj::mv(other.value)); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, other.value); - } - } - template - inline NullableValue(const NullableValue& other) - : isSet(other.isSet) { - if (isSet) { - ctor(value, *other.ptr); - } - } - inline NullableValue(decltype(nullptr)): isSet(false) {} - - inline NullableValue& operator=(NullableValue&& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, kj::mv(other.value)); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline NullableValue& operator=(const NullableValue& other) { - if (&other != this) { - // Careful about throwing destructors/constructors here. - if (isSet) { - isSet = false; - dtor(value); - } - if (other.isSet) { - ctor(value, other.value); - isSet = true; - } - } - return *this; - } - - inline bool operator==(decltype(nullptr)) const { return !isSet; } - inline bool operator!=(decltype(nullptr)) const { return isSet; } - -private: - bool isSet; - -#if _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4624) -// Warns that the anonymous union has a deleted destructor when T is non-trivial. This warning -// seems broken. -#endif - - union { - T value; - }; - -#if _MSC_VER -#pragma warning(pop) -#endif - - friend class kj::Maybe; - template - friend NullableValue&& readMaybe(Maybe&& maybe); -}; - -template -inline NullableValue&& readMaybe(Maybe&& maybe) { return kj::mv(maybe.ptr); } -template -inline T* readMaybe(Maybe& maybe) { return maybe.ptr; } -template -inline const T* readMaybe(const Maybe& maybe) { return maybe.ptr; } -template -inline T* readMaybe(Maybe&& maybe) { return maybe.ptr; } -template -inline T* readMaybe(const Maybe& maybe) { return maybe.ptr; } - -template -inline T* readMaybe(T* ptr) { return ptr; } -// Allow KJ_IF_MAYBE to work on regular pointers. - -} // namespace _ (private) - -#define KJ_IF_MAYBE(name, exp) if (auto name = ::kj::_::readMaybe(exp)) - -template -class Maybe { - // A T, or nullptr. - - // IF YOU CHANGE THIS CLASS: Note that there is a specialization of it in memory.h. - -public: - Maybe(): ptr(nullptr) {} - Maybe(T&& t) noexcept(noexcept(T(instance()))): ptr(kj::mv(t)) {} - Maybe(T& t): ptr(t) {} - Maybe(const T& t): ptr(t) {} - Maybe(const T* t) noexcept: ptr(t) {} - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))): ptr(kj::mv(other.ptr)) {} - Maybe(const Maybe& other): ptr(other.ptr) {} - Maybe(Maybe& other): ptr(other.ptr) {} - - template - Maybe(Maybe&& other) noexcept(noexcept(T(instance()))) { - KJ_IF_MAYBE(val, kj::mv(other)) { - ptr.emplace(kj::mv(*val)); - } - } - template - Maybe(const Maybe& other) { - KJ_IF_MAYBE(val, other) { - ptr.emplace(*val); - } - } - - Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - template - inline T& emplace(Params&&... params) { - // Replace this Maybe's content with a new value constructed by passing the given parametrs to - // T's constructor. This can be used to initialize a Maybe without copying or even moving a T. - // Returns a reference to the newly-constructed value. - - return ptr.emplace(kj::fwd(params)...); - } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - inline Maybe& operator=(Maybe& other) { ptr = other.ptr; return *this; } - inline Maybe& operator=(const Maybe& other) { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - - template - auto map(Func&& f) && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(*ptr)); - } - } - -private: - _::NullableValue ptr; - - template - friend class Maybe; - template - friend _::NullableValue&& _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(Maybe& maybe); - template - friend const U* _::readMaybe(const Maybe& maybe); -}; - -template -class Maybe: public DisallowConstCopyIfNotConst { -public: - Maybe() noexcept: ptr(nullptr) {} - Maybe(T& t) noexcept: ptr(&t) {} - Maybe(T* t) noexcept: ptr(t) {} - - template - inline Maybe(Maybe& other) noexcept: ptr(other.ptr) {} - template - inline Maybe(const Maybe& other) noexcept: ptr(other.ptr) {} - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline Maybe& operator=(T& other) noexcept { ptr = &other; return *this; } - inline Maybe& operator=(T* other) noexcept { ptr = other; return *this; } - template - inline Maybe& operator=(Maybe& other) noexcept { ptr = other.ptr; return *this; } - template - inline Maybe& operator=(const Maybe& other) noexcept { ptr = other.ptr; return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - T& orDefault(T& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - const T& orDefault(const T& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return *ptr; - } - } - - template - auto map(Func&& f) -> Maybe()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(*ptr); - } - } - -private: - T* ptr; - - template - friend class Maybe; - template - friend U* _::readMaybe(Maybe&& maybe); - template - friend U* _::readMaybe(const Maybe& maybe); -}; - -// ======================================================================================= -// ArrayPtr -// -// So common that we put it in common.h rather than array.h. - -template -class ArrayPtr: public DisallowConstCopyIfNotConst { - // A pointer to an array. Includes a size. Like any pointer, it doesn't own the target data, - // and passing by value only copies the pointer, not the target. - -public: - inline constexpr ArrayPtr(): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(decltype(nullptr)): ptr(nullptr), size_(0) {} - inline constexpr ArrayPtr(T* ptr, size_t size): ptr(ptr), size_(size) {} - inline constexpr ArrayPtr(T* begin, T* end): ptr(begin), size_(end - begin) {} - inline KJ_CONSTEXPR() ArrayPtr(::std::initializer_list> init) - : ptr(init.begin()), size_(init.size()) {} - - template - inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) {} - // Construct an ArrayPtr from a native C-style array. - - inline operator ArrayPtr() const { - return ArrayPtr(ptr, size_); - } - inline ArrayPtr asConst() const { - return ArrayPtr(ptr, size_); - } - - inline size_t size() const { return size_; } - inline const T& operator[](size_t index) const { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - inline T& operator[](size_t index) { - KJ_IREQUIRE(index < size_, "Out-of-bounds ArrayPtr access."); - return ptr[index]; - } - - inline T* begin() { return ptr; } - inline T* end() { return ptr + size_; } - inline T& front() { return *ptr; } - inline T& back() { return *(ptr + size_ - 1); } - inline const T* begin() const { return ptr; } - inline const T* end() const { return ptr + size_; } - inline const T& front() const { return *ptr; } - inline const T& back() const { return *(ptr + size_ - 1); } - - inline ArrayPtr slice(size_t start, size_t end) const { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - inline ArrayPtr slice(size_t start, size_t end) { - KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds ArrayPtr::slice()."); - return ArrayPtr(ptr + start, end - start); - } - - inline ArrayPtr> asBytes() const { - // Reinterpret the array as a byte array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - inline ArrayPtr> asChars() const { - // Reinterpret the array as a char array. This is explicitly legal under C++ aliasing - // rules. - return { reinterpret_cast*>(ptr), size_ * sizeof(T) }; - } - - inline bool operator==(decltype(nullptr)) const { return size_ == 0; } - inline bool operator!=(decltype(nullptr)) const { return size_ != 0; } - - inline bool operator==(const ArrayPtr& other) const { - if (size_ != other.size_) return false; - for (size_t i = 0; i < size_; i++) { - if (ptr[i] != other[i]) return false; - } - return true; - } - inline bool operator!=(const ArrayPtr& other) const { return !(*this == other); } - -private: - T* ptr; - size_t size_; -}; - -template -inline constexpr ArrayPtr arrayPtr(T* ptr, size_t size) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(ptr, size); -} - -template -inline constexpr ArrayPtr arrayPtr(T* begin, T* end) { - // Use this function to construct ArrayPtrs without writing out the type name. - return ArrayPtr(begin, end); -} - -// ======================================================================================= -// Casts - -template -To implicitCast(From&& from) { - // `implicitCast(value)` casts `value` to type `T` only if the conversion is implicit. Useful - // for e.g. resolving ambiguous overloads without sacrificing type-safety. - return kj::fwd(from); -} - -template -Maybe dynamicDowncastIfAvailable(From& from) { - // If RTTI is disabled, always returns nullptr. Otherwise, works like dynamic_cast. Useful - // in situations where dynamic_cast could allow an optimization, but isn't strictly necessary - // for correctness. It is highly recommended that you try to arrange all your dynamic_casts - // this way, as a dynamic_cast that is necessary for correctness implies a flaw in the interface - // design. - - // Force a compile error if To is not a subtype of From. Cross-casting is rare; if it is needed - // we should have a separate cast function like dynamicCrosscastIfAvailable(). - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if KJ_NO_RTTI - return nullptr; -#else - return dynamic_cast(&from); -#endif -} - -template -To& downcast(From& from) { - // Down-cast a value to a sub-type, asserting that the cast is valid. In opt mode this is a - // static_cast, but in debug mode (when RTTI is enabled) a dynamic_cast will be used to verify - // that the value really has the requested type. - - // Force a compile error if To is not a subtype of From. - if (false) { - kj::implicitCast(kj::implicitCast(nullptr)); - } - -#if !KJ_NO_RTTI - KJ_IREQUIRE(dynamic_cast(&from) != nullptr, "Value cannot be downcast() to requested type."); -#endif - - return static_cast(from); -} - -// ======================================================================================= -// Defer - -namespace _ { // private - -template -class Deferred { -public: - inline Deferred(Func&& func): func(kj::fwd(func)), canceled(false) {} - inline ~Deferred() noexcept(false) { if (!canceled) func(); } - KJ_DISALLOW_COPY(Deferred); - - // This move constructor is usually optimized away by the compiler. - inline Deferred(Deferred&& other): func(kj::mv(other.func)), canceled(false) { - other.canceled = true; - } -private: - Func func; - bool canceled; -}; - -} // namespace _ (private) - -template -_::Deferred defer(Func&& func) { - // Returns an object which will invoke the given functor in its destructor. The object is not - // copyable but is movable with the semantics you'd expect. Since the return type is private, - // you need to assign to an `auto` variable. - // - // The KJ_DEFER macro provides slightly more convenient syntax for the common case where you - // want some code to run at current scope exit. - - return _::Deferred(kj::fwd(func)); -} - -#define KJ_DEFER(code) auto KJ_UNIQUE_NAME(_kjDefer) = ::kj::defer([&](){code;}) -// Run the given code when the function exits, whether by return or exception. - -} // namespace kj - -#endif // KJ_COMMON_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/compat/gtest.h b/phonelibs/capnp-cpp/mac/include/kj/compat/gtest.h deleted file mode 100644 index 016dbdfac3..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/compat/gtest.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_GTEST_H_ -#define KJ_COMPAT_GTEST_H_ -// This file defines compatibility macros converting Google Test tests into KJ tests. -// -// This is only intended to cover the most common functionality. Many tests will likely need -// additional tweaks. For instance: -// - Using operator<< to print information on failure is not supported. Instead, switch to -// KJ_ASSERT/KJ_EXPECT and pass in stuff to print as additional parameters. -// - Test fixtures are not supported. Allocate your "test fixture" on the stack instead. Do setup -// in the constructor, teardown in the destructor. - -#include "../test.h" - -namespace kj { - -namespace _ { // private - -template -T abs(T value) { return value < 0 ? -value : value; } - -inline bool floatAlmostEqual(float a, float b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-5; -} - -inline bool doubleAlmostEqual(double a, double b) { - return a == b || abs(a - b) < (abs(a) + abs(b)) * 1e-12; -} - -} // namespace _ (private) - -#define EXPECT_FALSE(x) KJ_EXPECT(!(x)) -#define EXPECT_TRUE(x) KJ_EXPECT(x) -#define EXPECT_EQ(x, y) KJ_EXPECT((x) == (y), x, y) -#define EXPECT_NE(x, y) KJ_EXPECT((x) != (y), x, y) -#define EXPECT_LE(x, y) KJ_EXPECT((x) <= (y), x, y) -#define EXPECT_GE(x, y) KJ_EXPECT((x) >= (y), x, y) -#define EXPECT_LT(x, y) KJ_EXPECT((x) < (y), x, y) -#define EXPECT_GT(x, y) KJ_EXPECT((x) > (y), x, y) -#define EXPECT_STREQ(x, y) KJ_EXPECT(::strcmp(x, y) == 0, x, y) -#define EXPECT_FLOAT_EQ(x, y) KJ_EXPECT(::kj::_::floatAlmostEqual(y, x), y, x); -#define EXPECT_DOUBLE_EQ(x, y) KJ_EXPECT(::kj::_::doubleAlmostEqual(y, x), y, x); - -#define ASSERT_FALSE(x) KJ_ASSERT(!(x)) -#define ASSERT_TRUE(x) KJ_ASSERT(x) -#define ASSERT_EQ(x, y) KJ_ASSERT((x) == (y), x, y) -#define ASSERT_NE(x, y) KJ_ASSERT((x) != (y), x, y) -#define ASSERT_LE(x, y) KJ_ASSERT((x) <= (y), x, y) -#define ASSERT_GE(x, y) KJ_ASSERT((x) >= (y), x, y) -#define ASSERT_LT(x, y) KJ_ASSERT((x) < (y), x, y) -#define ASSERT_GT(x, y) KJ_ASSERT((x) > (y), x, y) -#define ASSERT_STREQ(x, y) KJ_ASSERT(::strcmp(x, y) == 0, x, y) -#define ASSERT_FLOAT_EQ(x, y) KJ_ASSERT(::kj::_::floatAlmostEqual(y, x), y, x); -#define ASSERT_DOUBLE_EQ(x, y) KJ_ASSERT(::kj::_::doubleAlmostEqual(y, x), y, x); - -class AddFailureAdapter { -public: - AddFailureAdapter(const char* file, int line): file(file), line(line) {} - - ~AddFailureAdapter() { - if (!handled) { - _::Debug::log(file, line, LogSeverity::ERROR, "expectation failed"); - } - } - - template - void operator<<(T&& info) { - handled = true; - _::Debug::log(file, line, LogSeverity::ERROR, "\"expectation failed\", info", - "expectation failed", kj::fwd(info)); - } - -private: - bool handled = false; - const char* file; - int line; -}; - -#define ADD_FAILURE() ::kj::AddFailureAdapter(__FILE__, __LINE__) - -#if KJ_NO_EXCEPTIONS -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, nullptr, [&]() { code; })) -#else -#define EXPECT_ANY_THROW(code) \ - KJ_EXPECT(::kj::runCatchingExceptions([&]() { code; }) != nullptr) -#endif - -#define EXPECT_NONFATAL_FAILURE(code) \ - EXPECT_TRUE(kj::runCatchingExceptions([&]() { code; }) != nullptr); - -#ifdef KJ_DEBUG -#define EXPECT_DEBUG_ANY_THROW EXPECT_ANY_THROW -#else -#define EXPECT_DEBUG_ANY_THROW(EXP) -#endif - -#define TEST(x, y) KJ_TEST("legacy test: " #x "/" #y) - -} // namespace kj - -#endif // KJ_COMPAT_GTEST_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/compat/http.h b/phonelibs/capnp-cpp/mac/include/kj/compat/http.h deleted file mode 100644 index 8d455cc258..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/compat/http.h +++ /dev/null @@ -1,636 +0,0 @@ -// Copyright (c) 2017 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_COMPAT_HTTP_H_ -#define KJ_COMPAT_HTTP_H_ -// The KJ HTTP client/server library. -// -// This is a simple library which can be used to implement an HTTP client or server. Properties -// of this library include: -// - Uses KJ async framework. -// - Agnostic to transport layer -- you can provide your own. -// - Header parsing is zero-copy -- it results in strings that point directly into the buffer -// received off the wire. -// - Application code which reads and writes headers refers to headers by symbolic names, not by -// string literals, with lookups being array-index-based, not map-based. To make this possible, -// the application announces what headers it cares about in advance, in order to assign numeric -// values to them. -// - Methods are identified by an enum. - -#include -#include -#include -#include -#include - -namespace kj { - -#define KJ_HTTP_FOR_EACH_METHOD(MACRO) \ - MACRO(GET) \ - MACRO(HEAD) \ - MACRO(POST) \ - MACRO(PUT) \ - MACRO(DELETE) \ - MACRO(PATCH) \ - MACRO(PURGE) \ - MACRO(OPTIONS) \ - MACRO(TRACE) \ - /* standard methods */ \ - /* */ \ - /* (CONNECT is intentionally omitted since it is handled specially in HttpHandler) */ \ - \ - MACRO(COPY) \ - MACRO(LOCK) \ - MACRO(MKCOL) \ - MACRO(MOVE) \ - MACRO(PROPFIND) \ - MACRO(PROPPATCH) \ - MACRO(SEARCH) \ - MACRO(UNLOCK) \ - /* WebDAV */ \ - \ - MACRO(REPORT) \ - MACRO(MKACTIVITY) \ - MACRO(CHECKOUT) \ - MACRO(MERGE) \ - /* Subversion */ \ - \ - MACRO(MSEARCH) \ - MACRO(NOTIFY) \ - MACRO(SUBSCRIBE) \ - MACRO(UNSUBSCRIBE) - /* UPnP */ - -#define KJ_HTTP_FOR_EACH_CONNECTION_HEADER(MACRO) \ - MACRO(connection, "Connection") \ - MACRO(contentLength, "Content-Length") \ - MACRO(keepAlive, "Keep-Alive") \ - MACRO(te, "TE") \ - MACRO(trailer, "Trailer") \ - MACRO(transferEncoding, "Transfer-Encoding") \ - MACRO(upgrade, "Upgrade") - -enum class HttpMethod { - // Enum of known HTTP methods. - // - // We use an enum rather than a string to allow for faster parsing and switching and to reduce - // ambiguity. - -#define DECLARE_METHOD(id) id, -KJ_HTTP_FOR_EACH_METHOD(DECLARE_METHOD) -#undef DECLARE_METHOD -}; - -kj::StringPtr KJ_STRINGIFY(HttpMethod method); -kj::Maybe tryParseHttpMethod(kj::StringPtr name); - -class HttpHeaderTable; - -class HttpHeaderId { - // Identifies an HTTP header by numeric ID that indexes into an HttpHeaderTable. - // - // The KJ HTTP API prefers that headers be identified by these IDs for a few reasons: - // - Integer lookups are much more efficient than string lookups. - // - Case-insensitivity is awkward to deal with when const strings are being passed to the lookup - // method. - // - Writing out strings less often means fewer typos. - // - // See HttpHeaderTable for usage hints. - -public: - HttpHeaderId() = default; - - inline bool operator==(const HttpHeaderId& other) const { return id == other.id; } - inline bool operator!=(const HttpHeaderId& other) const { return id != other.id; } - inline bool operator< (const HttpHeaderId& other) const { return id < other.id; } - inline bool operator> (const HttpHeaderId& other) const { return id > other.id; } - inline bool operator<=(const HttpHeaderId& other) const { return id <= other.id; } - inline bool operator>=(const HttpHeaderId& other) const { return id >= other.id; } - - inline size_t hashCode() const { return id; } - - kj::StringPtr toString() const; - - void requireFrom(HttpHeaderTable& table) const; - // In debug mode, throws an exception if the HttpHeaderId is not from the given table. - // - // In opt mode, no-op. - -#define KJ_HTTP_FOR_EACH_BUILTIN_HEADER(MACRO) \ - MACRO(HOST, "Host") \ - MACRO(DATE, "Date") \ - MACRO(LOCATION, "Location") \ - MACRO(CONTENT_TYPE, "Content-Type") - // For convenience, these very-common headers are valid for all HttpHeaderTables. You can refer - // to them like: - // - // HttpHeaderId::HOST - // - // TODO(0.7): Fill this out with more common headers. - -#define DECLARE_HEADER(id, name) \ - static const HttpHeaderId id; - // Declare a constant for each builtin header, e.g.: HttpHeaderId::CONNECTION - - KJ_HTTP_FOR_EACH_BUILTIN_HEADER(DECLARE_HEADER); -#undef DECLARE_HEADER - -private: - HttpHeaderTable* table; - uint id; - - inline explicit constexpr HttpHeaderId(HttpHeaderTable* table, uint id): table(table), id(id) {} - friend class HttpHeaderTable; - friend class HttpHeaders; -}; - -class HttpHeaderTable { - // Construct an HttpHeaderTable to declare which headers you'll be interested in later on, and - // to manufacture IDs for them. - // - // Example: - // - // // Build a header table with the headers we are interested in. - // kj::HttpHeaderTable::Builder builder; - // const HttpHeaderId accept = builder.add("Accept"); - // const HttpHeaderId contentType = builder.add("Content-Type"); - // kj::HttpHeaderTable table(kj::mv(builder)); - // - // // Create an HTTP client. - // auto client = kj::newHttpClient(table, network); - // - // // Get http://example.com. - // HttpHeaders headers(table); - // headers.set(accept, "text/html"); - // auto response = client->send(kj::HttpMethod::GET, "http://example.com", headers) - // .wait(waitScope); - // auto msg = kj::str("Response content type: ", response.headers.get(contentType)); - - struct IdsByNameMap; - -public: - HttpHeaderTable(); - // Constructs a table that only contains the builtin headers. - - class Builder { - public: - Builder(); - HttpHeaderId add(kj::StringPtr name); - Own build(); - - HttpHeaderTable& getFutureTable(); - // Get the still-unbuilt header table. You cannot actually use it until build() has been - // called. - // - // This method exists to help when building a shared header table -- the Builder may be passed - // to several components, each of which will register the headers they need and get a reference - // to the future table. - - private: - kj::Own table; - }; - - KJ_DISALLOW_COPY(HttpHeaderTable); // Can't copy because HttpHeaderId points to the table. - ~HttpHeaderTable() noexcept(false); - - uint idCount(); - // Return the number of IDs in the table. - - kj::Maybe stringToId(kj::StringPtr name); - // Try to find an ID for the given name. The matching is case-insensitive, per the HTTP spec. - // - // Note: if `name` contains characters that aren't allowed in HTTP header names, this may return - // a bogus value rather than null, due to optimizations used in case-insensitive matching. - - kj::StringPtr idToString(HttpHeaderId id); - // Get the canonical string name for the given ID. - -private: - kj::Vector namesById; - kj::Own idsByName; -}; - -class HttpHeaders { - // Represents a set of HTTP headers. - // - // This class guards against basic HTTP header injection attacks: Trying to set a header name or - // value containing a newline, carriage return, or other invalid character will throw an - // exception. - -public: - explicit HttpHeaders(HttpHeaderTable& table); - - KJ_DISALLOW_COPY(HttpHeaders); - HttpHeaders(HttpHeaders&&) = default; - HttpHeaders& operator=(HttpHeaders&&) = default; - - void clear(); - // Clears all contents, as if the object was freshly-allocated. However, calling this rather - // than actually re-allocating the object may avoid re-allocation of internal objects. - - HttpHeaders clone() const; - // Creates a deep clone of the HttpHeaders. The returned object owns all strings it references. - - HttpHeaders cloneShallow() const; - // Creates a shallow clone of the HttpHeaders. The returned object references the same strings - // as the original, owning none of them. - - kj::Maybe get(HttpHeaderId id) const; - // Read a header. - - template - void forEach(Func&& func) const; - // Calls `func(name, value)` for each header in the set -- including headers that aren't mapped - // to IDs in the header table. Both inputs are of type kj::StringPtr. - - void set(HttpHeaderId id, kj::StringPtr value); - void set(HttpHeaderId id, kj::String&& value); - // Sets a header value, overwriting the existing value. - // - // The String&& version is equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `value` remains valid until the - // HttpHeaders object is destroyed. This allows string literals to be passed without making a - // copy, but complicates the use of dynamic values. Hint: Consider using `takeOwnership()`. - - void add(kj::StringPtr name, kj::StringPtr value); - void add(kj::StringPtr name, kj::String&& value); - void add(kj::String&& name, kj::String&& value); - // Append a header. `name` will be looked up in the header table, but if it's not mapped, the - // header will be added to the list of unmapped headers. - // - // The String&& versions are equivalent to calling the other version followed by takeOwnership(). - // - // WARNING: It is the caller's responsibility to ensure that `name` and `value` remain valid - // until the HttpHeaders object is destroyed. This allows string literals to be passed without - // making a copy, but complicates the use of dynamic values. Hint: Consider using - // `takeOwnership()`. - - void unset(HttpHeaderId id); - // Removes a header. - // - // It's not possible to remove a header by string name because non-indexed headers would take - // O(n) time to remove. Instead, construct a new HttpHeaders object and copy contents. - - void takeOwnership(kj::String&& string); - void takeOwnership(kj::Array&& chars); - void takeOwnership(HttpHeaders&& otherHeaders); - // Takes overship of a string so that it lives until the HttpHeaders object is destroyed. Useful - // when you've passed a dynamic value to set() or add() or parse*(). - - struct ConnectionHeaders { - // These headers govern details of the specific HTTP connection or framing of the content. - // Hence, they are managed internally within the HTTP library, and never appear in an - // HttpHeaders structure. - -#define DECLARE_HEADER(id, name) \ - kj::StringPtr id; - KJ_HTTP_FOR_EACH_CONNECTION_HEADER(DECLARE_HEADER) -#undef DECLARE_HEADER - }; - - struct Request { - HttpMethod method; - kj::StringPtr url; - ConnectionHeaders connectionHeaders; - }; - struct Response { - uint statusCode; - kj::StringPtr statusText; - ConnectionHeaders connectionHeaders; - }; - - kj::Maybe tryParseRequest(kj::ArrayPtr content); - kj::Maybe tryParseResponse(kj::ArrayPtr content); - // Parse an HTTP header blob and add all the headers to this object. - // - // `content` should be all text from the start of the request to the first occurrance of two - // newlines in a row -- including the first of these two newlines, but excluding the second. - // - // The parse is performed with zero copies: The callee clobbers `content` with '\0' characters - // to split it into a bunch of shorter strings. The caller must keep `content` valid until the - // `HttpHeaders` is destroyed, or pass it to `takeOwnership()`. - - kj::String serializeRequest(HttpMethod method, kj::StringPtr url, - const ConnectionHeaders& connectionHeaders) const; - kj::String serializeResponse(uint statusCode, kj::StringPtr statusText, - const ConnectionHeaders& connectionHeaders) const; - // Serialize the headers as a complete request or response blob. The blob uses '\r\n' newlines - // and includes the double-newline to indicate the end of the headers. - - kj::String toString() const; - -private: - HttpHeaderTable* table; - - kj::Array indexedHeaders; - // Size is always table->idCount(). - - struct Header { - kj::StringPtr name; - kj::StringPtr value; - }; - kj::Vector

unindexedHeaders; - - kj::Vector> ownedStrings; - - kj::Maybe addNoCheck(kj::StringPtr name, kj::StringPtr value); - - kj::StringPtr cloneToOwn(kj::StringPtr str); - - kj::String serialize(kj::ArrayPtr word1, - kj::ArrayPtr word2, - kj::ArrayPtr word3, - const ConnectionHeaders& connectionHeaders) const; - - bool parseHeaders(char* ptr, char* end, ConnectionHeaders& connectionHeaders); - - // TODO(perf): Arguably we should store a map, but header sets are never very long - // TODO(perf): We could optimize for common headers by storing them directly as fields. We could - // also add direct accessors for those headers. -}; - -class WebSocket { -public: - WebSocket(kj::Own stream); - // Create a WebSocket wrapping the given I/O stream. - - kj::Promise send(kj::ArrayPtr message); - kj::Promise send(kj::ArrayPtr message); -}; - -class HttpClient { - // Interface to the client end of an HTTP connection. - // - // There are two kinds of clients: - // * Host clients are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests.) - // * Proxy clients are used when the target could be any arbitrary host on the internet. - // The `url` specified in a request is a full URL including protocol and hostname. - -public: - struct Response { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::Own body; - // `statusText` and `headers` remain valid until `body` is dropped. - }; - - struct Request { - kj::Own body; - // Write the request entity body to this stream, then drop it when done. - // - // May be null for GET and HEAD requests (which have no body) and requests that have - // Content-Length: 0. - - kj::Promise response; - // Promise for the eventual respnose. - }; - - virtual Request request(HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the client is a proxy client or a host client. - // - // `url` and `headers` need only remain valid until `request()` returns (they can be - // stack-allocated). - // - // `expectedBodySize`, if provided, must be exactly the number of bytes that will be written to - // the body. This will trigger use of the `Content-Length` connection header. Otherwise, - // `Transfer-Encoding: chunked` will be used. - - struct WebSocketResponse { - uint statusCode; - kj::StringPtr statusText; - const HttpHeaders* headers; - kj::OneOf, kj::Own> upstreamOrBody; - // `statusText` and `headers` remain valid until `upstreamOrBody` is dropped. - }; - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, kj::Own downstream); - // Tries to open a WebSocket. Default implementation calls send() and never returns a WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy clients. Default implementation throws - // UNIMPLEMENTED. -}; - -class HttpService { - // Interface which HTTP services should implement. - // - // This interface is functionally equivalent to HttpClient, but is intended for applications to - // implement rather than call. The ergonomics and performance of the method signatures are - // optimized for the serving end. - // - // As with clients, there are two kinds of services: - // * Host services are used when talking to a specific host. The `url` specified in a request - // is actually just a path. (A `Host` header is still required in all requests, and the service - // may in fact serve multiple origins via this header.) - // * Proxy services are used when the target could be any arbitrary host on the internet, i.e. to - // implement an HTTP proxy. The `url` specified in a request is a full URL including protocol - // and hostname. - -public: - class Response { - public: - virtual kj::Own send( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - kj::Maybe expectedBodySize = nullptr) = 0; - // Begin the response. - // - // `statusText` and `headers` need only remain valid until send() returns (they can be - // stack-allocated). - }; - - virtual kj::Promise request( - HttpMethod method, kj::StringPtr url, const HttpHeaders& headers, - kj::AsyncInputStream& requestBody, Response& response) = 0; - // Perform an HTTP request. - // - // `url` may be a full URL (with protocol and host) or it may be only the path part of the URL, - // depending on whether the service is a proxy service or a host service. - // - // `url` and `headers` are invalidated on the first read from `requestBody` or when the returned - // promise resolves, whichever comes first. - - class WebSocketResponse: public Response { - public: - kj::Own startWebSocket( - uint statusCode, kj::StringPtr statusText, const HttpHeaders& headers, - WebSocket& upstream); - // Begin the response. - // - // `statusText` and `headers` need only remain valid until startWebSocket() returns (they can - // be stack-allocated). - }; - - virtual kj::Promise openWebSocket( - kj::StringPtr url, const HttpHeaders& headers, WebSocketResponse& response); - // Tries to open a WebSocket. Default implementation calls request() and never returns a - // WebSocket. - // - // `url` and `headers` are invalidated when the returned promise resolves. - - virtual kj::Promise> connect(kj::String host); - // Handles CONNECT requests. Only relevant for proxy services. Default implementation throws - // UNIMPLEMENTED. -}; - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::Network& network, - kj::Maybe tlsNetwork = nullptr); -// Creates a proxy HttpClient that connects to hosts over the given network. -// -// `responseHeaderTable` is used when parsing HTTP responses. Requests can use any header table. -// -// `tlsNetwork` is required to support HTTPS destination URLs. Otherwise, only HTTP URLs can be -// fetched. - -kj::Own newHttpClient(HttpHeaderTable& responseHeaderTable, kj::AsyncIoStream& stream); -// Creates an HttpClient that speaks over the given pre-established connection. The client may -// be used as a proxy client or a host client depending on whether the peer is operating as -// a proxy. -// -// Note that since this client has only one stream to work with, it will try to pipeline all -// requests on this stream. If one request or response has an I/O failure, all subsequent requests -// fail as well. If the destination server chooses to close the connection after a response, -// subsequent requests will fail. If a response takes a long time, it blocks subsequent responses. -// If a WebSocket is opened successfully, all subsequent requests fail. - -kj::Own newHttpClient(HttpService& service); -kj::Own newHttpService(HttpClient& client); -// Adapts an HttpClient to an HttpService and vice versa. - -struct HttpServerSettings { - kj::Duration headerTimeout = 15 * kj::SECONDS; - // After initial connection open, or after receiving the first byte of a pipelined request, - // the client must send the complete request within this time. - - kj::Duration pipelineTimeout = 5 * kj::SECONDS; - // After one request/response completes, we'll wait up to this long for a pipelined request to - // arrive. -}; - -class HttpServer: private kj::TaskSet::ErrorHandler { - // Class which listens for requests on ports or connections and sends them to an HttpService. - -public: - typedef HttpServerSettings Settings; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings = Settings()); - // Set up an HttpServer that directs incoming connections to the given service. The service - // may be a host service or a proxy service depending on whether you are intending to implement - // an HTTP server or an HTTP proxy. - - kj::Promise drain(); - // Stop accepting new connections or new requests on existing connections. Finish any requests - // that are already executing, then close the connections. Returns once no more requests are - // in-flight. - - kj::Promise listenHttp(kj::ConnectionReceiver& port); - // Accepts HTTP connections on the given port and directs them to the handler. - // - // The returned promise never completes normally. It may throw if port.accept() throws. Dropping - // the returned promise will cause the server to stop listening on the port, but already-open - // connections will continue to be served. Destroy the whole HttpServer to cancel all I/O. - - kj::Promise listenHttp(kj::Own connection); - // Reads HTTP requests from the given connection and directs them to the handler. A successful - // completion of the promise indicates that all requests received on the connection resulted in - // a complete response, and the client closed the connection gracefully or drain() was called. - // The promise throws if an unparseable request is received or if some I/O error occurs. Dropping - // the returned promise will cancel all I/O on the connection and cancel any in-flight requests. - -private: - class Connection; - - kj::Timer& timer; - HttpHeaderTable& requestHeaderTable; - HttpService& service; - Settings settings; - - bool draining = false; - kj::ForkedPromise onDrain; - kj::Own> drainFulfiller; - - uint connectionCount = 0; - kj::Maybe>> zeroConnectionsFulfiller; - - kj::TaskSet tasks; - - HttpServer(kj::Timer& timer, HttpHeaderTable& requestHeaderTable, HttpService& service, - Settings settings, kj::PromiseFulfillerPair paf); - - kj::Promise listenLoop(kj::ConnectionReceiver& port); - - void taskFailed(kj::Exception&& exception) override; -}; - -// ======================================================================================= -// inline implementation - -inline void HttpHeaderId::requireFrom(HttpHeaderTable& table) const { - KJ_IREQUIRE(this->table == nullptr || this->table == &table, - "the provided HttpHeaderId is from the wrong HttpHeaderTable"); -} - -inline kj::Own HttpHeaderTable::Builder::build() { return kj::mv(table); } -inline HttpHeaderTable& HttpHeaderTable::Builder::getFutureTable() { return *table; } - -inline uint HttpHeaderTable::idCount() { return namesById.size(); } - -inline kj::StringPtr HttpHeaderTable::idToString(HttpHeaderId id) { - id.requireFrom(*this); - return namesById[id.id]; -} - -inline kj::Maybe HttpHeaders::get(HttpHeaderId id) const { - id.requireFrom(*table); - auto result = indexedHeaders[id.id]; - return result == nullptr ? kj::Maybe(nullptr) : result; -} - -inline void HttpHeaders::unset(HttpHeaderId id) { - id.requireFrom(*table); - indexedHeaders[id.id] = nullptr; -} - -template -inline void HttpHeaders::forEach(Func&& func) const { - for (auto i: kj::indices(indexedHeaders)) { - if (indexedHeaders[i] != nullptr) { - func(table->idToString(HttpHeaderId(table, i)), indexedHeaders[i]); - } - } - - for (auto& header: unindexedHeaders) { - func(header.name, header.value); - } -} - -} // namespace kj - -#endif // KJ_COMPAT_HTTP_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/debug.h b/phonelibs/capnp-cpp/mac/include/kj/debug.h deleted file mode 100644 index fff7f98bc0..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/debug.h +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file declares convenient macros for debug logging and error handling. The macros make -// it excessively easy to extract useful context information from code. Example: -// -// KJ_ASSERT(a == b, a, b, "a and b must be the same."); -// -// On failure, this will throw an exception whose description looks like: -// -// myfile.c++:43: bug in code: expected a == b; a = 14; b = 72; a and b must be the same. -// -// As you can see, all arguments after the first provide additional context. -// -// The macros available are: -// -// * `KJ_LOG(severity, ...)`: Just writes a log message, to stderr by default (but you can -// intercept messages by implementing an ExceptionCallback). `severity` is `INFO`, `WARNING`, -// `ERROR`, or `FATAL`. By default, `INFO` logs are not written, but for command-line apps the -// user should be able to pass a flag like `--verbose` to enable them. Other log levels are -// enabled by default. Log messages -- like exceptions -- can be intercepted by registering an -// ExceptionCallback. -// -// * `KJ_DBG(...)`: Like `KJ_LOG`, but intended specifically for temporary log lines added while -// debugging a particular problem. Calls to `KJ_DBG` should always be deleted before committing -// code. It is suggested that you set up a pre-commit hook that checks for this. -// -// * `KJ_ASSERT(condition, ...)`: Throws an exception if `condition` is false, or aborts if -// exceptions are disabled. This macro should be used to check for bugs in the surrounding code -// and its dependencies, but NOT to check for invalid input. The macro may be followed by a -// brace-delimited code block; if so, the block will be executed in the case where the assertion -// fails, before throwing the exception. If control jumps out of the block (e.g. with "break", -// "return", or "goto"), then the error is considered "recoverable" -- in this case, if -// exceptions are disabled, execution will continue normally rather than aborting (but if -// exceptions are enabled, an exception will still be thrown on exiting the block). A "break" -// statement in particular will jump to the code immediately after the block (it does not break -// any surrounding loop or switch). Example: -// -// KJ_ASSERT(value >= 0, "Value cannot be negative.", value) { -// // Assertion failed. Set value to zero to "recover". -// value = 0; -// // Don't abort if exceptions are disabled. Continue normally. -// // (Still throw an exception if they are enabled, though.) -// break; -// } -// // When exceptions are disabled, we'll get here even if the assertion fails. -// // Otherwise, we get here only if the assertion passes. -// -// * `KJ_REQUIRE(condition, ...)`: Like `KJ_ASSERT` but used to check preconditions -- e.g. to -// validate parameters passed from a caller. A failure indicates that the caller is buggy. -// -// * `KJ_SYSCALL(code, ...)`: Executes `code` assuming it makes a system call. A negative result -// is considered an error, with error code reported via `errno`. EINTR is handled by retrying. -// Other errors are handled by throwing an exception. If you need to examine the return code, -// assign it to a variable like so: -// -// int fd; -// KJ_SYSCALL(fd = open(filename, O_RDONLY), filename); -// -// `KJ_SYSCALL` can be followed by a recovery block, just like `KJ_ASSERT`. -// -// * `KJ_NONBLOCKING_SYSCALL(code, ...)`: Like KJ_SYSCALL, but will not throw an exception on -// EAGAIN/EWOULDBLOCK. The calling code should check the syscall's return value to see if it -// indicates an error; in this case, it can assume the error was EAGAIN because any other error -// would have caused an exception to be thrown. -// -// * `KJ_CONTEXT(...)`: Notes additional contextual information relevant to any exceptions thrown -// from within the current scope. That is, until control exits the block in which KJ_CONTEXT() -// is used, if any exception is generated, it will contain the given information in its context -// chain. This is helpful because it can otherwise be very difficult to come up with error -// messages that make sense within low-level helper code. Note that the parameters to -// KJ_CONTEXT() are only evaluated if an exception is thrown. This implies that any variables -// used must remain valid until the end of the scope. -// -// Notes: -// * Do not write expressions with side-effects in the message content part of the macro, as the -// message will not necessarily be evaluated. -// * For every macro `FOO` above except `LOG`, there is also a `FAIL_FOO` macro used to report -// failures that already happened. For the macros that check a boolean condition, `FAIL_FOO` -// omits the first parameter and behaves like it was `false`. `FAIL_SYSCALL` and -// `FAIL_RECOVERABLE_SYSCALL` take a string and an OS error number as the first two parameters. -// The string should be the name of the failed system call. -// * For every macro `FOO` above, there is a `DFOO` version (or `RECOVERABLE_DFOO`) which is only -// executed in debug mode, i.e. when KJ_DEBUG is defined. KJ_DEBUG is defined automatically -// by common.h when compiling without optimization (unless NDEBUG is defined), but you can also -// define it explicitly (e.g. -DKJ_DEBUG). Generally, production builds should NOT use KJ_DEBUG -// as it may enable expensive checks that are unlikely to fail. - -#ifndef KJ_DEBUG_H_ -#define KJ_DEBUG_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" -#include "exception.h" - -#ifdef ERROR -// This is problematic because windows.h #defines ERROR, which we use in an enum here. -#error "Make sure to to undefine ERROR (or just #include ) before this file" -#endif - -namespace kj { - -#if _MSC_VER -// MSVC does __VA_ARGS__ differently from GCC: -// - A trailing comma before an empty __VA_ARGS__ is removed automatically, whereas GCC wants -// you to request this behavior with "##__VA_ARGS__". -// - If __VA_ARGS__ is passed directly as an argument to another macro, it will be treated as a -// *single* argument rather than an argument list. This can be worked around by wrapping the -// outer macro call in KJ_EXPAND(), which appraently forces __VA_ARGS__ to be expanded before -// the macro is evaluated. I don't understand the C preprocessor. -// - Using "#__VA_ARGS__" to stringify __VA_ARGS__ expands to zero tokens when __VA_ARGS__ is -// empty, rather than expanding to an empty string literal. We can work around by concatenating -// with an empty string literal. - -#define KJ_EXPAND(X) X - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - "" #__VA_ARGS__, __VA_ARGS__) - -#define KJ_DBG(...) KJ_EXPAND(KJ_LOG(DBG, __VA_ARGS__)) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, "" #__VA_ARGS__, __VA_ARGS__);; f.fatal()) - -// TODO(msvc): MSVC mis-deduces `ContextImpl` as `ContextImpl` in some edge -// cases, such as inside nested lambdas inside member functions. Wrapping the type in -// `decltype(instance<...>())` helps it deduce the context function's type correctly. -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)); \ - }; \ - decltype(::kj::instance<::kj::_::Debug::ContextImpl>()) \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*[&] { \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", "" #__VA_ARGS__, __VA_ARGS__).fatal(); \ - } \ - return _kj_result; \ - }()) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription("" #__VA_ARGS__, __VA_ARGS__)) - -#else - -#define KJ_LOG(severity, ...) \ - if (!::kj::_::Debug::shouldLog(::kj::LogSeverity::severity)) {} else \ - ::kj::_::Debug::log(__FILE__, __LINE__, ::kj::LogSeverity::severity, \ - #__VA_ARGS__, ##__VA_ARGS__) - -#define KJ_DBG(...) KJ_LOG(DBG, ##__VA_ARGS__) - -#define KJ_REQUIRE(cond, ...) \ - if (KJ_LIKELY(cond)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #cond, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_REQUIRE(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, false)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_NONBLOCKING_SYSCALL(call, ...) \ - if (auto _kjSyscallResult = ::kj::_::Debug::syscall([&](){return (call);}, true)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - _kjSyscallResult.getErrorNumber(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_SYSCALL(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - errorNumber, code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#if _WIN32 - -#define KJ_WIN32(call, ...) \ - if (::kj::_::Debug::isWin32Success(call)) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_WINSOCK(call, ...) \ - if ((call) != SOCKET_ERROR) {} else \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::getWin32Error(), #call, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_FAIL_WIN32(code, errorNumber, ...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, \ - ::kj::_::Debug::Win32Error(errorNumber), code, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#endif - -#define KJ_UNIMPLEMENTED(...) \ - for (::kj::_::Debug::Fault f(__FILE__, __LINE__, ::kj::Exception::Type::UNIMPLEMENTED, \ - nullptr, #__VA_ARGS__, ##__VA_ARGS__);; f.fatal()) - -#define KJ_CONTEXT(...) \ - auto KJ_UNIQUE_NAME(_kjContextFunc) = [&]() -> ::kj::_::Debug::Context::Value { \ - return ::kj::_::Debug::Context::Value(__FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)); \ - }; \ - ::kj::_::Debug::ContextImpl \ - KJ_UNIQUE_NAME(_kjContext)(KJ_UNIQUE_NAME(_kjContextFunc)) - -#define KJ_REQUIRE_NONNULL(value, ...) \ - (*({ \ - auto _kj_result = ::kj::_::readMaybe(value); \ - if (KJ_UNLIKELY(!_kj_result)) { \ - ::kj::_::Debug::Fault(__FILE__, __LINE__, ::kj::Exception::Type::FAILED, \ - #value " != nullptr", #__VA_ARGS__, ##__VA_ARGS__).fatal(); \ - } \ - kj::mv(_kj_result); \ - })) - -#define KJ_EXCEPTION(type, ...) \ - ::kj::Exception(::kj::Exception::Type::type, __FILE__, __LINE__, \ - ::kj::_::Debug::makeDescription(#__VA_ARGS__, ##__VA_ARGS__)) - -#endif - -#define KJ_SYSCALL_HANDLE_ERRORS(call) \ - if (int _kjSyscallError = ::kj::_::Debug::syscallError([&](){return (call);}, false)) \ - switch (int error = _kjSyscallError) -// Like KJ_SYSCALL, but doesn't throw. Instead, the block after the macro is a switch block on the -// error. Additionally, the int value `error` is defined within the block. So you can do: -// -// KJ_SYSCALL_HANDLE_ERRORS(foo()) { -// case ENOENT: -// handleNoSuchFile(); -// break; -// case EEXIST: -// handleExists(); -// break; -// default: -// KJ_FAIL_SYSCALL("foo()", error); -// } else { -// handleSuccessCase(); -// } - -#define KJ_ASSERT KJ_REQUIRE -#define KJ_FAIL_ASSERT KJ_FAIL_REQUIRE -#define KJ_ASSERT_NONNULL KJ_REQUIRE_NONNULL -// Use "ASSERT" in place of "REQUIRE" when the problem is local to the immediate surrounding code. -// That is, if the assert ever fails, it indicates that the immediate surrounding code is broken. - -#ifdef KJ_DEBUG -#define KJ_DLOG KJ_LOG -#define KJ_DASSERT KJ_ASSERT -#define KJ_DREQUIRE KJ_REQUIRE -#else -#define KJ_DLOG(...) do {} while (false) -#define KJ_DASSERT(...) do {} while (false) -#define KJ_DREQUIRE(...) do {} while (false) -#endif - -namespace _ { // private - -class Debug { -public: - Debug() = delete; - - typedef LogSeverity Severity; // backwards-compatibility - -#if _WIN32 - struct Win32Error { - // Hack for overloading purposes. - uint number; - inline explicit Win32Error(uint number): number(number) {} - }; -#endif - - static inline bool shouldLog(LogSeverity severity) { return severity >= minSeverity; } - // Returns whether messages of the given severity should be logged. - - static inline void setLogLevel(LogSeverity severity) { minSeverity = severity; } - // Set the minimum message severity which will be logged. - // - // TODO(someday): Expose publicly. - - template - static void log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params); - - class Fault { - public: - template - Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params); - Fault(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs); - Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs); -#if _WIN32 - Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs); -#endif - ~Fault() noexcept(false); - - KJ_NOINLINE KJ_NORETURN(void fatal()); - // Throw the exception. - - private: - void init(const char* file, int line, Exception::Type type, - const char* condition, const char* macroArgs, ArrayPtr argValues); - void init(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#if _WIN32 - void init(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs, ArrayPtr argValues); -#endif - - Exception* exception; - }; - - class SyscallResult { - public: - inline SyscallResult(int errorNumber): errorNumber(errorNumber) {} - inline operator void*() { return errorNumber == 0 ? this : nullptr; } - inline int getErrorNumber() { return errorNumber; } - - private: - int errorNumber; - }; - - template - static SyscallResult syscall(Call&& call, bool nonblocking); - template - static int syscallError(Call&& call, bool nonblocking); - -#if _WIN32 - static bool isWin32Success(int boolean); - static bool isWin32Success(void* handle); - static Win32Error getWin32Error(); -#endif - - class Context: public ExceptionCallback { - public: - Context(); - KJ_DISALLOW_COPY(Context); - virtual ~Context() noexcept(false); - - struct Value { - const char* file; - int line; - String description; - - inline Value(const char* file, int line, String&& description) - : file(file), line(line), description(mv(description)) {} - }; - - virtual Value evaluate() = 0; - - virtual void onRecoverableException(Exception&& exception) override; - virtual void onFatalException(Exception&& exception) override; - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - - private: - bool logged; - Maybe value; - - Value ensureInitialized(); - }; - - template - class ContextImpl: public Context { - public: - inline ContextImpl(Func& func): func(func) {} - KJ_DISALLOW_COPY(ContextImpl); - - Value evaluate() override { - return func(); - } - private: - Func& func; - }; - - template - static String makeDescription(const char* macroArgs, Params&&... params); - -private: - static LogSeverity minSeverity; - - static void logInternal(const char* file, int line, LogSeverity severity, const char* macroArgs, - ArrayPtr argValues); - static String makeDescriptionInternal(const char* macroArgs, ArrayPtr argValues); - - static int getOsErrorNumber(bool nonblocking); - // Get the error code of the last error (e.g. from errno). Returns -1 on EINTR. -}; - -template -void Debug::log(const char* file, int line, LogSeverity severity, const char* macroArgs, - Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - logInternal(file, line, severity, macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline void Debug::log<>(const char* file, int line, LogSeverity severity, const char* macroArgs) { - logInternal(file, line, severity, macroArgs, nullptr); -} - -template -Debug::Fault::Fault(const char* file, int line, Code code, - const char* condition, const char* macroArgs, Params&&... params) - : exception(nullptr) { - String argValues[sizeof...(Params)] = {str(params)...}; - init(file, line, code, condition, macroArgs, - arrayPtr(argValues, sizeof...(Params))); -} - -inline Debug::Fault::Fault(const char* file, int line, int osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline Debug::Fault::Fault(const char* file, int line, kj::Exception::Type type, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, type, condition, macroArgs, nullptr); -} - -#if _WIN32 -inline Debug::Fault::Fault(const char* file, int line, Win32Error osErrorNumber, - const char* condition, const char* macroArgs) - : exception(nullptr) { - init(file, line, osErrorNumber, condition, macroArgs, nullptr); -} - -inline bool Debug::isWin32Success(int boolean) { - return boolean; -} -inline bool Debug::isWin32Success(void* handle) { - // Assume null and INVALID_HANDLE_VALUE mean failure. - return handle != nullptr && handle != (void*)-1; -} -#endif - -template -Debug::SyscallResult Debug::syscall(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return SyscallResult(errorNum); - } - } - return SyscallResult(0); -} - -template -int Debug::syscallError(Call&& call, bool nonblocking) { - while (call() < 0) { - int errorNum = getOsErrorNumber(nonblocking); - // getOsErrorNumber() returns -1 to indicate EINTR. - // Also, if nonblocking is true, then it returns 0 on EAGAIN, which will then be treated as a - // non-error. - if (errorNum != -1) { - return errorNum; - } - } - return 0; -} - -template -String Debug::makeDescription(const char* macroArgs, Params&&... params) { - String argValues[sizeof...(Params)] = {str(params)...}; - return makeDescriptionInternal(macroArgs, arrayPtr(argValues, sizeof...(Params))); -} - -template <> -inline String Debug::makeDescription<>(const char* macroArgs) { - return makeDescriptionInternal(macroArgs, nullptr); -} - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_DEBUG_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/exception.h b/phonelibs/capnp-cpp/mac/include/kj/exception.h deleted file mode 100644 index f6c0b2daa6..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/exception.h +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_EXCEPTION_H_ -#define KJ_EXCEPTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include "array.h" -#include "string.h" - -namespace kj { - -class ExceptionImpl; - -class Exception { - // Exception thrown in case of fatal errors. - // - // Actually, a subclass of this which also implements std::exception will be thrown, but we hide - // that fact from the interface to avoid #including . - -public: - enum class Type { - // What kind of failure? - - FAILED = 0, - // Something went wrong. This is the usual error type. KJ_ASSERT and KJ_REQUIRE throw this - // error type. - - OVERLOADED = 1, - // The call failed because of a temporary lack of resources. This could be space resources - // (out of memory, out of disk space) or time resources (request queue overflow, operation - // timed out). - // - // The operation might work if tried again, but it should NOT be repeated immediately as this - // may simply exacerbate the problem. - - DISCONNECTED = 2, - // The call required communication over a connection that has been lost. The callee will need - // to re-establish connections and try again. - - UNIMPLEMENTED = 3 - // The requested method is not implemented. The caller may wish to revert to a fallback - // approach based on other methods. - - // IF YOU ADD A NEW VALUE: - // - Update the stringifier. - // - Update Cap'n Proto's RPC protocol's Exception.Type enum. - }; - - Exception(Type type, const char* file, int line, String description = nullptr) noexcept; - Exception(Type type, String file, int line, String description = nullptr) noexcept; - Exception(const Exception& other) noexcept; - Exception(Exception&& other) = default; - ~Exception() noexcept; - - const char* getFile() const { return file; } - int getLine() const { return line; } - Type getType() const { return type; } - StringPtr getDescription() const { return description; } - ArrayPtr getStackTrace() const { return arrayPtr(trace, traceCount); } - - struct Context { - // Describes a bit about what was going on when the exception was thrown. - - const char* file; - int line; - String description; - Maybe> next; - - Context(const char* file, int line, String&& description, Maybe>&& next) - : file(file), line(line), description(mv(description)), next(mv(next)) {} - Context(const Context& other) noexcept; - }; - - inline Maybe getContext() const { - KJ_IF_MAYBE(c, context) { - return **c; - } else { - return nullptr; - } - } - - void wrapContext(const char* file, int line, String&& description); - // Wraps the context in a new node. This becomes the head node returned by getContext() -- it - // is expected that contexts will be added in reverse order as the exception passes up the - // callback stack. - - KJ_NOINLINE void extendTrace(uint ignoreCount); - // Append the current stack trace to the exception's trace, ignoring the first `ignoreCount` - // frames (see `getStackTrace()` for discussion of `ignoreCount`). - - KJ_NOINLINE void truncateCommonTrace(); - // Remove the part of the stack trace which the exception shares with the caller of this method. - // This is used by the async library to remove the async infrastructure from the stack trace - // before replacing it with the async trace. - - void addTrace(void* ptr); - // Append the given pointer to the backtrace, if it is not already full. This is used by the - // async library to trace through the promise chain that led to the exception. - -private: - String ownFile; - const char* file; - int line; - Type type; - String description; - Maybe> context; - void* trace[32]; - uint traceCount; - - friend class ExceptionImpl; -}; - -StringPtr KJ_STRINGIFY(Exception::Type type); -String KJ_STRINGIFY(const Exception& e); - -// ======================================================================================= - -enum class LogSeverity { - INFO, // Information describing what the code is up to, which users may request to see - // with a flag like `--verbose`. Does not indicate a problem. Not printed by - // default; you must call setLogLevel(INFO) to enable. - WARNING, // A problem was detected but execution can continue with correct output. - ERROR, // Something is wrong, but execution can continue with garbage output. - FATAL, // Something went wrong, and execution cannot continue. - DBG // Temporary debug logging. See KJ_DBG. - - // Make sure to update the stringifier if you add a new severity level. -}; - -StringPtr KJ_STRINGIFY(LogSeverity severity); - -class ExceptionCallback { - // If you don't like C++ exceptions, you may implement and register an ExceptionCallback in order - // to perform your own exception handling. For example, a reasonable thing to do is to have - // onRecoverableException() set a flag indicating that an error occurred, and then check for that - // flag just before writing to storage and/or returning results to the user. If the flag is set, - // discard whatever you have and return an error instead. - // - // ExceptionCallbacks must always be allocated on the stack. When an exception is thrown, the - // newest ExceptionCallback on the calling thread's stack is called. The default implementation - // of each method calls the next-oldest ExceptionCallback for that thread. Thus the callbacks - // behave a lot like try/catch blocks, except that they are called before any stack unwinding - // occurs. - -public: - ExceptionCallback(); - KJ_DISALLOW_COPY(ExceptionCallback); - virtual ~ExceptionCallback() noexcept(false); - - virtual void onRecoverableException(Exception&& exception); - // Called when an exception has been raised, but the calling code has the ability to continue by - // producing garbage output. This method _should_ throw the exception, but is allowed to simply - // return if garbage output is acceptable. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void onFatalException(Exception&& exception); - // Called when an exception has been raised and the calling code cannot continue. If this method - // returns normally, abort() will be called. The method must throw the exception to avoid - // aborting. - // - // The global default implementation throws an exception unless the library was compiled with - // -fno-exceptions, in which case it logs an error and returns. - - virtual void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text); - // Called when something wants to log some debug text. `contextDepth` indicates how many levels - // of context the message passed through; it may make sense to indent the message accordingly. - // - // The global default implementation writes the text to stderr. - - enum class StackTraceMode { - FULL, - // Stringifying a stack trace will attempt to determine source file and line numbers. This may - // be expensive. For example, on Linux, this shells out to `addr2line`. - // - // This is the default in debug builds. - - ADDRESS_ONLY, - // Stringifying a stack trace will only generate a list of code addresses. - // - // This is the default in release builds. - - NONE - // Generating a stack trace will always return an empty array. - // - // This avoids ever unwinding the stack. On Windows in particular, the stack unwinding library - // has been observed to be pretty slow, so exception-heavy code might benefit significantly - // from this setting. (But exceptions should be rare...) - }; - - virtual StackTraceMode stackTraceMode(); - // Returns the current preferred stack trace mode. - -protected: - ExceptionCallback& next; - -private: - ExceptionCallback(ExceptionCallback& next); - - class RootExceptionCallback; - friend ExceptionCallback& getExceptionCallback(); -}; - -ExceptionCallback& getExceptionCallback(); -// Returns the current exception callback. - -KJ_NOINLINE KJ_NORETURN(void throwFatalException(kj::Exception&& exception, uint ignoreCount = 0)); -// Invoke the exception callback to throw the given fatal exception. If the exception callback -// returns, abort. - -KJ_NOINLINE void throwRecoverableException(kj::Exception&& exception, uint ignoreCount = 0); -// Invoke the exception callback to throw the given recoverable exception. If the exception -// callback returns, return normally. - -// ======================================================================================= - -namespace _ { class Runnable; } - -template -Maybe runCatchingExceptions(Func&& func) noexcept; -// Executes the given function (usually, a lambda returning nothing) catching any exceptions that -// are thrown. Returns the Exception if there was one, or null if the operation completed normally. -// Non-KJ exceptions will be wrapped. -// -// If exception are disabled (e.g. with -fno-exceptions), this will still detect whether any -// recoverable exceptions occurred while running the function and will return those. - -class UnwindDetector { - // Utility for detecting when a destructor is called due to unwind. Useful for: - // - Avoiding throwing exceptions in this case, which would terminate the program. - // - Detecting whether to commit or roll back a transaction. - // - // To use this class, either inherit privately from it or declare it as a member. The detector - // works by comparing the exception state against that when the constructor was called, so for - // an object that was actually constructed during exception unwind, it will behave as if no - // unwind is taking place. This is usually the desired behavior. - -public: - UnwindDetector(); - - bool isUnwinding() const; - // Returns true if the current thread is in a stack unwind that it wasn't in at the time the - // object was constructed. - - template - void catchExceptionsIfUnwinding(Func&& func) const; - // Runs the given function (e.g., a lambda). If isUnwinding() is true, any exceptions are - // caught and treated as secondary faults, meaning they are considered to be side-effects of the - // exception that is unwinding the stack. Otherwise, exceptions are passed through normally. - -private: - uint uncaughtCount; - - void catchExceptionsAsSecondaryFaults(_::Runnable& runnable) const; -}; - -namespace _ { // private - -class Runnable { -public: - virtual void run() = 0; -}; - -template -class RunnableImpl: public Runnable { -public: - RunnableImpl(Func&& func): func(kj::mv(func)) {} - void run() override { - func(); - } -private: - Func func; -}; - -Maybe runCatchingExceptions(Runnable& runnable) noexcept; - -} // namespace _ (private) - -template -Maybe runCatchingExceptions(Func&& func) noexcept { - _::RunnableImpl> runnable(kj::fwd(func)); - return _::runCatchingExceptions(runnable); -} - -template -void UnwindDetector::catchExceptionsIfUnwinding(Func&& func) const { - if (isUnwinding()) { - _::RunnableImpl> runnable(kj::fwd(func)); - catchExceptionsAsSecondaryFaults(runnable); - } else { - func(); - } -} - -#define KJ_ON_SCOPE_SUCCESS(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (!KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited normally (not due to an exception). - -#define KJ_ON_SCOPE_FAILURE(code) \ - ::kj::UnwindDetector KJ_UNIQUE_NAME(_kjUnwindDetector); \ - KJ_DEFER(if (KJ_UNIQUE_NAME(_kjUnwindDetector).isUnwinding()) { code; }) -// Runs `code` if the current scope is exited due to an exception. - -// ======================================================================================= - -KJ_NOINLINE ArrayPtr getStackTrace(ArrayPtr space, uint ignoreCount); -// Attempt to get the current stack trace, returning a list of pointers to instructions. The -// returned array is a slice of `space`. Provide a larger `space` to get a deeper stack trace. -// If the platform doesn't support stack traces, returns an empty array. -// -// `ignoreCount` items will be truncated from the front of the trace. This is useful for chopping -// off a prefix of the trace that is uninteresting to the developer because it's just locations -// inside the debug infrastructure that is requesting the trace. Be careful to mark functions as -// KJ_NOINLINE if you intend to count them in `ignoreCount`. Note that, unfortunately, the -// ignored entries will still waste space in the `space` array (and the returned array's `begin()` -// is never exactly equal to `space.begin()` due to this effect, even if `ignoreCount` is zero -// since `getStackTrace()` needs to ignore its own internal frames). - -String stringifyStackTrace(ArrayPtr); -// Convert the stack trace to a string with file names and line numbers. This may involve executing -// suprocesses. - -String getStackTrace(); -// Get a stack trace right now and stringify it. Useful for debugging. - -void printStackTraceOnCrash(); -// Registers signal handlers on common "crash" signals like SIGSEGV that will (attempt to) print -// a stack trace. You should call this as early as possible on program startup. Programs using -// KJ_MAIN get this automatically. - -kj::StringPtr trimSourceFilename(kj::StringPtr filename); -// Given a source code file name, trim off noisy prefixes like "src/" or -// "/ekam-provider/canonical/". - -} // namespace kj - -#endif // KJ_EXCEPTION_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/function.h b/phonelibs/capnp-cpp/mac/include/kj/function.h deleted file mode 100644 index ba6601b560..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/function.h +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_FUNCTION_H_ -#define KJ_FUNCTION_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" - -namespace kj { - -template -class Function; -// Function wrapper using virtual-based polymorphism. Use this when template polymorphism is -// not possible. You can, for example, accept a Function as a parameter: -// -// void setFilter(Function filter); -// -// The caller of `setFilter()` may then pass any callable object as the parameter. The callable -// object does not have to have the exact signature specified, just one that is "compatible" -- -// i.e. the return type is covariant and the parameters are contravariant. -// -// Unlike `std::function`, `kj::Function`s are movable but not copyable, just like `kj::Own`. This -// is to avoid unexpected heap allocation or slow atomic reference counting. -// -// When a `Function` is constructed from an lvalue, it captures only a reference to the value. -// When constructed from an rvalue, it invokes the value's move constructor. So, for example: -// -// struct AddN { -// int n; -// int operator(int i) { return i + n; } -// } -// -// Function f1 = AddN{2}; -// // f1 owns an instance of AddN. It may safely be moved out -// // of the local scope. -// -// AddN adder(2); -// Function f2 = adder; -// // f2 contains a reference to `adder`. Thus, it becomes invalid -// // when `adder` goes out-of-scope. -// -// AddN adder2(2); -// Function f3 = kj::mv(adder2); -// // f3 owns an insatnce of AddN moved from `adder2`. f3 may safely -// // be moved out of the local scope. -// -// Additionally, a Function may be bound to a class method using KJ_BIND_METHOD(object, methodName). -// For example: -// -// class Printer { -// public: -// void print(int i); -// void print(kj::StringPtr s); -// }; -// -// Printer p; -// -// Function intPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(int). -// -// Function strPrinter = KJ_BIND_METHOD(p, print); -// // Will call Printer::print(kj::StringPtr). -// -// Notice how KJ_BIND_METHOD is able to figure out which overload to use depending on the kind of -// Function it is binding to. - -template -class ConstFunction; -// Like Function, but wraps a "const" (i.e. thread-safe) call. - -template -class Function { -public: - template - inline Function(F&& f): impl(heap>(kj::fwd(f))) {} - Function() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(Function); - Function(Function&) = delete; - Function& operator=(Function&) = delete; - template Function(const Function&) = delete; - template Function& operator=(const Function&) = delete; - template Function(const ConstFunction&) = delete; - template Function& operator=(const ConstFunction&) = delete; - Function(Function&&) = default; - Function& operator=(Function&&) = default; - - inline Return operator()(Params... params) { - return (*impl)(kj::fwd(params)...); - } - - Function reference() { - // Forms a new Function of the same type that delegates to this Function by reference. - // Therefore, this Function must outlive the returned Function, but otherwise they behave - // exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -template -class ConstFunction { -public: - template - inline ConstFunction(F&& f): impl(heap>(kj::fwd(f))) {} - ConstFunction() = default; - - // Make sure people don't accidentally end up wrapping a reference when they meant to return - // a function. - KJ_DISALLOW_COPY(ConstFunction); - ConstFunction(ConstFunction&) = delete; - ConstFunction& operator=(ConstFunction&) = delete; - template ConstFunction(const ConstFunction&) = delete; - template ConstFunction& operator=(const ConstFunction&) = delete; - template ConstFunction(const Function&) = delete; - template ConstFunction& operator=(const Function&) = delete; - ConstFunction(ConstFunction&&) = default; - ConstFunction& operator=(ConstFunction&&) = default; - - inline Return operator()(Params... params) const { - return (*impl)(kj::fwd(params)...); - } - - ConstFunction reference() const { - // Forms a new ConstFunction of the same type that delegates to this ConstFunction by reference. - // Therefore, this ConstFunction must outlive the returned ConstFunction, but otherwise they - // behave exactly the same. - - return *impl; - } - -private: - class Iface { - public: - virtual Return operator()(Params... params) const = 0; - }; - - template - class Impl final: public Iface { - public: - explicit Impl(F&& f): f(kj::fwd(f)) {} - - Return operator()(Params... params) const override { - return f(kj::fwd(params)...); - } - - private: - F f; - }; - - Own impl; -}; - -#if 1 - -namespace _ { // private - -template -class BoundMethod; - -template ::*method)(Params...)> -class BoundMethod::*)(Params...), method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -template ::*method)(Params...) const> -class BoundMethod::*)(Params...) const, method> { -public: - BoundMethod(T&& t): t(kj::fwd(t)) {} - - Return operator()(Params&&... params) const { - return (t.*method)(kj::fwd(params)...); - } - -private: - T t; -}; - -} // namespace _ (private) - -#define KJ_BIND_METHOD(obj, method) \ - ::kj::_::BoundMethod::method), \ - &::kj::Decay::method>(obj) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. -// -// The current implementation requires that the method is not overloaded. -// -// TODO(someday): C++14's generic lambdas may be able to simplify this code considerably, and -// probably make it work with overloaded methods. - -#else -// Here's a better implementation of the above that doesn't work with GCC (but does with Clang) -// because it uses a local class with a template method. Sigh. This implementation supports -// overloaded methods. - -#define KJ_BIND_METHOD(obj, method) \ - ({ \ - typedef KJ_DECLTYPE_REF(obj) T; \ - class F { \ - public: \ - inline F(T&& t): t(::kj::fwd(t)) {} \ - template \ - auto operator()(Params&&... params) \ - -> decltype(::kj::instance().method(::kj::fwd(params)...)) { \ - return t.method(::kj::fwd(params)...); \ - } \ - private: \ - T t; \ - }; \ - (F(obj)); \ - }) -// Macro that produces a functor object which forwards to the method `obj.name`. If `obj` is an -// lvalue, the functor will hold a reference to it. If `obj` is an rvalue, the functor will -// contain a copy (by move) of it. - -#endif - -} // namespace kj - -#endif // KJ_FUNCTION_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/io.h b/phonelibs/capnp-cpp/mac/include/kj/io.h deleted file mode 100644 index f5c03bfe7b..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/io.h +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_IO_H_ -#define KJ_IO_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "common.h" -#include "array.h" -#include "exception.h" - -namespace kj { - -// ======================================================================================= -// Abstract interfaces - -class InputStream { -public: - virtual ~InputStream() noexcept(false); - - size_t read(void* buffer, size_t minBytes, size_t maxBytes); - // Reads at least minBytes and at most maxBytes, copying them into the given buffer. Returns - // the size read. Throws an exception on errors. Implemented in terms of tryRead(). - // - // maxBytes is the number of bytes the caller really wants, but minBytes is the minimum amount - // needed by the caller before it can start doing useful processing. If the stream returns less - // than maxBytes, the caller will usually call read() again later to get the rest. Returning - // less than maxBytes is useful when it makes sense for the caller to parallelize processing - // with I/O. - // - // Never blocks if minBytes is zero. If minBytes is zero and maxBytes is non-zero, this may - // attempt a non-blocking read or may just return zero. To force a read, use a non-zero minBytes. - // To detect EOF without throwing an exception, use tryRead(). - // - // If the InputStream can't produce minBytes, it MUST throw an exception, as the caller is not - // expected to understand how to deal with partial reads. - - virtual size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) = 0; - // Like read(), but may return fewer than minBytes on EOF. - - inline void read(void* buffer, size_t bytes) { read(buffer, bytes, bytes); } - // Convenience method for reading an exact number of bytes. - - virtual void skip(size_t bytes); - // Skips past the given number of bytes, discarding them. The default implementation read()s - // into a scratch buffer. -}; - -class OutputStream { -public: - virtual ~OutputStream() noexcept(false); - - virtual void write(const void* buffer, size_t size) = 0; - // Always writes the full size. Throws exception on error. - - virtual void write(ArrayPtr> pieces); - // Equivalent to write()ing each byte array in sequence, which is what the default implementation - // does. Override if you can do something better, e.g. use writev() to do the write in a single - // syscall. -}; - -class BufferedInputStream: public InputStream { - // An input stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An input stream that actually reads from some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedInputStream() noexcept(false); - - ArrayPtr getReadBuffer(); - // Get a direct pointer into the read buffer, which contains the next bytes in the input. If the - // caller consumes any bytes, it should then call skip() to indicate this. This always returns a - // non-empty buffer or throws an exception. Implemented in terms of tryGetReadBuffer(). - - virtual ArrayPtr tryGetReadBuffer() = 0; - // Like getReadBuffer() but may return an empty buffer on EOF. -}; - -class BufferedOutputStream: public OutputStream { - // An output stream which buffers some bytes in memory to reduce system call overhead. - // - OR - - // An output stream that actually writes into some in-memory data structure and wants to give its - // caller a direct pointer to that memory to potentially avoid a copy. - -public: - virtual ~BufferedOutputStream() noexcept(false); - - virtual ArrayPtr getWriteBuffer() = 0; - // Get a direct pointer into the write buffer. The caller may choose to fill in some prefix of - // this buffer and then pass it to write(), in which case write() may avoid a copy. It is - // incorrect to pass to write any slice of this buffer which is not a prefix. -}; - -// ======================================================================================= -// Buffered streams implemented as wrappers around regular streams - -class BufferedInputStreamWrapper: public BufferedInputStream { - // Implements BufferedInputStream in terms of an InputStream. - // - // Note that the underlying stream's position is unpredictable once the wrapper is destroyed, - // unless the entire stream was consumed. To read a predictable number of bytes in a buffered - // way without going over, you'd need this wrapper to wrap some other wrapper which itself - // implements an artificial EOF at the desired point. Such a stream should be trivial to write - // but is not provided by the library at this time. - -public: - explicit BufferedInputStreamWrapper(InputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. No guarantee is made about - // the position of the inner stream after a buffered wrapper has been created unless the entire - // input is read. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedInputStreamWrapper); - ~BufferedInputStreamWrapper() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - InputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - ArrayPtr bufferAvailable; -}; - -class BufferedOutputStreamWrapper: public BufferedOutputStream { - // Implements BufferedOutputStream in terms of an OutputStream. Note that writes to the - // underlying stream may be delayed until flush() is called or the wrapper is destroyed. - -public: - explicit BufferedOutputStreamWrapper(OutputStream& inner, ArrayPtr buffer = nullptr); - // Creates a buffered stream wrapping the given non-buffered stream. - // - // If the second parameter is non-null, the stream uses the given buffer instead of allocating - // its own. This may improve performance if the buffer can be reused. - - KJ_DISALLOW_COPY(BufferedOutputStreamWrapper); - ~BufferedOutputStreamWrapper() noexcept(false); - - void flush(); - // Force the wrapper to write any remaining bytes in its buffer to the inner stream. Note that - // this only flushes this object's buffer; this object has no idea how to flush any other buffers - // that may be present in the underlying stream. - - // implements BufferedOutputStream --------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - OutputStream& inner; - Array ownedBuffer; - ArrayPtr buffer; - byte* bufferPos; - UnwindDetector unwindDetector; -}; - -// ======================================================================================= -// Array I/O - -class ArrayInputStream: public BufferedInputStream { -public: - explicit ArrayInputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayInputStream); - ~ArrayInputStream() noexcept(false); - - // implements BufferedInputStream ---------------------------------- - ArrayPtr tryGetReadBuffer() override; - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - void skip(size_t bytes) override; - -private: - ArrayPtr array; -}; - -class ArrayOutputStream: public BufferedOutputStream { -public: - explicit ArrayOutputStream(ArrayPtr array); - KJ_DISALLOW_COPY(ArrayOutputStream); - ~ArrayOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(array.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - ArrayPtr array; - byte* fillPos; -}; - -class VectorOutputStream: public BufferedOutputStream { -public: - explicit VectorOutputStream(size_t initialCapacity = 4096); - KJ_DISALLOW_COPY(VectorOutputStream); - ~VectorOutputStream() noexcept(false); - - ArrayPtr getArray() { - // Get the portion of the array which has been filled in. - return arrayPtr(vector.begin(), fillPos); - } - - // implements BufferedInputStream ---------------------------------- - ArrayPtr getWriteBuffer() override; - void write(const void* buffer, size_t size) override; - -private: - Array vector; - byte* fillPos; - - void grow(size_t minSize); -}; - -// ======================================================================================= -// File descriptor I/O - -class AutoCloseFd { - // A wrapper around a file descriptor which automatically closes the descriptor when destroyed. - // The wrapper supports move construction for transferring ownership of the descriptor. If - // close() returns an error, the destructor throws an exception, UNLESS the destructor is being - // called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseFd. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseFd(): fd(-1) {} - inline AutoCloseFd(decltype(nullptr)): fd(-1) {} - inline explicit AutoCloseFd(int fd): fd(fd) {} - inline AutoCloseFd(AutoCloseFd&& other) noexcept: fd(other.fd) { other.fd = -1; } - KJ_DISALLOW_COPY(AutoCloseFd); - ~AutoCloseFd() noexcept(false); - - inline AutoCloseFd& operator=(AutoCloseFd&& other) { - AutoCloseFd old(kj::mv(*this)); - fd = other.fd; - other.fd = -1; - return *this; - } - - inline AutoCloseFd& operator=(decltype(nullptr)) { - AutoCloseFd old(kj::mv(*this)); - return *this; - } - - inline operator int() const { return fd; } - inline int get() const { return fd; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the int conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return fd < 0; } - inline bool operator!=(decltype(nullptr)) { return fd >= 0; } - -private: - int fd; - UnwindDetector unwindDetector; -}; - -inline auto KJ_STRINGIFY(const AutoCloseFd& fd) - -> decltype(kj::toCharSequence(implicitCast(fd))) { - return kj::toCharSequence(implicitCast(fd)); -} - -class FdInputStream: public InputStream { - // An InputStream wrapping a file descriptor. - -public: - explicit FdInputStream(int fd): fd(fd) {} - explicit FdInputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdInputStream); - ~FdInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -class FdOutputStream: public OutputStream { - // An OutputStream wrapping a file descriptor. - -public: - explicit FdOutputStream(int fd): fd(fd) {} - explicit FdOutputStream(AutoCloseFd fd): fd(fd), autoclose(mv(fd)) {} - KJ_DISALLOW_COPY(FdOutputStream); - ~FdOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - void write(ArrayPtr> pieces) override; - - inline int getFd() const { return fd; } - -private: - int fd; - AutoCloseFd autoclose; -}; - -// ======================================================================================= -// Win32 Handle I/O - -#ifdef _WIN32 - -class AutoCloseHandle { - // A wrapper around a Win32 HANDLE which automatically closes the handle when destroyed. - // The wrapper supports move construction for transferring ownership of the handle. If - // CloseHandle() returns an error, the destructor throws an exception, UNLESS the destructor is - // being called during unwind from another exception, in which case the close error is ignored. - // - // If your code is not exception-safe, you should not use AutoCloseHandle. In this case you will - // have to call close() yourself and handle errors appropriately. - -public: - inline AutoCloseHandle(): handle((void*)-1) {} - inline AutoCloseHandle(decltype(nullptr)): handle((void*)-1) {} - inline explicit AutoCloseHandle(void* handle): handle(handle) {} - inline AutoCloseHandle(AutoCloseHandle&& other) noexcept: handle(other.handle) { - other.handle = (void*)-1; - } - KJ_DISALLOW_COPY(AutoCloseHandle); - ~AutoCloseHandle() noexcept(false); - - inline AutoCloseHandle& operator=(AutoCloseHandle&& other) { - AutoCloseHandle old(kj::mv(*this)); - handle = other.handle; - other.handle = (void*)-1; - return *this; - } - - inline AutoCloseHandle& operator=(decltype(nullptr)) { - AutoCloseHandle old(kj::mv(*this)); - return *this; - } - - inline operator void*() const { return handle; } - inline void* get() const { return handle; } - - operator bool() const = delete; - // Deleting this operator prevents accidental use in boolean contexts, which - // the void* conversion operator above would otherwise allow. - - inline bool operator==(decltype(nullptr)) { return handle != (void*)-1; } - inline bool operator!=(decltype(nullptr)) { return handle == (void*)-1; } - -private: - void* handle; // -1 (aka INVALID_HANDLE_VALUE) if not valid. -}; - -class HandleInputStream: public InputStream { - // An InputStream wrapping a Win32 HANDLE. - -public: - explicit HandleInputStream(void* handle): handle(handle) {} - explicit HandleInputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleInputStream); - ~HandleInputStream() noexcept(false); - - size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -class HandleOutputStream: public OutputStream { - // An OutputStream wrapping a Win32 HANDLE. - -public: - explicit HandleOutputStream(void* handle): handle(handle) {} - explicit HandleOutputStream(AutoCloseHandle handle): handle(handle), autoclose(mv(handle)) {} - KJ_DISALLOW_COPY(HandleOutputStream); - ~HandleOutputStream() noexcept(false); - - void write(const void* buffer, size_t size) override; - -private: - void* handle; - AutoCloseHandle autoclose; -}; - -#endif // _WIN32 - -} // namespace kj - -#endif // KJ_IO_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/main.h b/phonelibs/capnp-cpp/mac/include/kj/main.h deleted file mode 100644 index 4dcd804fd4..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/main.h +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MAIN_H_ -#define KJ_MAIN_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" -#include "string.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class ProcessContext { - // Context for command-line programs. - -public: - virtual StringPtr getProgramName() = 0; - // Get argv[0] as passed to main(). - - KJ_NORETURN(virtual void exit()) = 0; - // Indicates program completion. The program is considered successful unless `error()` was - // called. Typically this exits with _Exit(), meaning that the stack is not unwound, buffers - // are not flushed, etc. -- it is the responsibility of the caller to flush any buffers that - // matter. However, an alternate context implementation e.g. for unit testing purposes could - // choose to throw an exception instead. - // - // At first this approach may sound crazy. Isn't it much better to shut down cleanly? What if - // you lose data? However, it turns out that if you look at each common class of program, _Exit() - // is almost always preferable. Let's break it down: - // - // * Commands: A typical program you might run from the command line is single-threaded and - // exits quickly and deterministically. Commands often use buffered I/O and need to flush - // those buffers before exit. However, most of the work performed by destructors is not - // flushing buffers, but rather freeing up memory, placing objects into freelists, and closing - // file descriptors. All of this is irrelevant if the process is about to exit anyway, and - // for a command that runs quickly, time wasted freeing heap space may make a real difference - // in the overall runtime of a script. Meanwhile, it is usually easy to determine exactly what - // resources need to be flushed before exit, and easy to tell if they are not being flushed - // (because the command fails to produce the expected output). Therefore, it is reasonably - // easy for commands to explicitly ensure all output is flushed before exiting, and it is - // probably a good idea for them to do so anyway, because write failures should be detected - // and handled. For commands, a good strategy is to allocate any objects that require clean - // destruction on the stack, and allow them to go out of scope before the command exits. - // Meanwhile, any resources which do not need to be cleaned up should be allocated as members - // of the command's main class, whose destructor normally will not be called. - // - // * Interactive apps: Programs that interact with the user (whether they be graphical apps - // with windows or console-based apps like emacs) generally exit only when the user asks them - // to. Such applications may store large data structures in memory which need to be synced - // to disk, such as documents or user preferences. However, relying on stack unwind or global - // destructors as the mechanism for ensuring such syncing occurs is probably wrong. First of - // all, it's 2013, and applications ought to be actively syncing changes to non-volatile - // storage the moment those changes are made. Applications can crash at any time and a crash - // should never lose data that is more than half a second old. Meanwhile, if a user actually - // does try to close an application while unsaved changes exist, the application UI should - // prompt the user to decide what to do. Such a UI mechanism is obviously too high level to - // be implemented via destructors, so KJ's use of _Exit() shouldn't make a difference here. - // - // * Servers: A good server is fault-tolerant, prepared for the possibility that at any time - // it could crash, the OS could decide to kill it off, or the machine it is running on could - // just die. So, using _Exit() should be no problem. In fact, servers generally never even - // call exit anyway; they are killed externally. - // - // * Batch jobs: A long-running batch job is something between a command and a server. It - // probably knows exactly what needs to be flushed before exiting, and it probably should be - // fault-tolerant. - // - // Meanwhile, regardless of program type, if you are adhering to KJ style, then the use of - // _Exit() shouldn't be a problem anyway: - // - // * KJ style forbids global mutable state (singletons) in general and global constructors and - // destructors in particular. Therefore, everything that could possibly need cleanup either - // lives on the stack or is transitively owned by something living on the stack. - // - // * Calling exit() simply means "Don't clean up anything older than this stack frame.". If you - // have resources that require cleanup before exit, make sure they are owned by stack frames - // beyond the one that eventually calls exit(). To be as safe as possible, don't place any - // state in your program's main class, and don't call exit() yourself. Then, runMainAndExit() - // will do it, and the only thing on the stack at that time will be your main class, which - // has no state anyway. - // - // TODO(someday): Perhaps we should use the new std::quick_exit(), so that at_quick_exit() is - // available for those who really think they need it. Unfortunately, it is not yet available - // on many platforms. - - virtual void warning(StringPtr message) = 0; - // Print the given message to standard error. A newline is printed after the message if it - // doesn't already have one. - - virtual void error(StringPtr message) = 0; - // Like `warning()`, but also sets a flag indicating that the process has failed, and that when - // it eventually exits it should indicate an error status. - - KJ_NORETURN(virtual void exitError(StringPtr message)) = 0; - // Equivalent to `error(message)` followed by `exit()`. - - KJ_NORETURN(virtual void exitInfo(StringPtr message)) = 0; - // Displays the given non-error message to the user and then calls `exit()`. This is used to - // implement things like --help. - - virtual void increaseLoggingVerbosity() = 0; - // Increase the level of detail produced by the debug logging system. `MainBuilder` invokes - // this if the caller uses the -v flag. - - // TODO(someday): Add interfaces representing standard OS resources like the filesystem, so that - // these things can be mocked out. -}; - -class TopLevelProcessContext final: public ProcessContext { - // A ProcessContext implementation appropriate for use at the actual entry point of a process - // (as opposed to when you are trying to call a program's main function from within some other - // program). This implementation writes errors to stderr, and its `exit()` method actually - // calls the C `quick_exit()` function. - -public: - explicit TopLevelProcessContext(StringPtr programName); - - struct CleanShutdownException { int exitCode; }; - // If the environment variable KJ_CLEAN_SHUTDOWN is set, then exit() will actually throw this - // exception rather than exiting. `kj::runMain()` catches this exception and returns normally. - // This is useful primarily for testing purposes, to assist tools like memory leak checkers that - // are easily confused by quick_exit(). - - StringPtr getProgramName() override; - KJ_NORETURN(void exit() override); - void warning(StringPtr message) override; - void error(StringPtr message) override; - KJ_NORETURN(void exitError(StringPtr message) override); - KJ_NORETURN(void exitInfo(StringPtr message) override); - void increaseLoggingVerbosity() override; - -private: - StringPtr programName; - bool cleanShutdown; - bool hadErrors = false; -}; - -typedef Function params)> MainFunc; - -int runMainAndExit(ProcessContext& context, MainFunc&& func, int argc, char* argv[]); -// Runs the given main function and then exits using the given context. If an exception is thrown, -// this will catch it, report it via the context and exit with an error code. -// -// Normally this function does not return, because returning would probably lead to wasting time -// on cleanup when the process is just going to exit anyway. However, to facilitate memory leak -// checkers and other tools that require a clean shutdown to do their job, if the environment -// variable KJ_CLEAN_SHUTDOWN is set, the function will in fact return an exit code, which should -// then be returned from main(). -// -// Most users will use the KJ_MAIN() macro rather than call this function directly. - -#define KJ_MAIN(MainClass) \ - int main(int argc, char* argv[]) { \ - ::kj::TopLevelProcessContext context(argv[0]); \ - MainClass mainObject(context); \ - return ::kj::runMainAndExit(context, mainObject.getMain(), argc, argv); \ - } -// Convenience macro for declaring a main function based on the given class. The class must have -// a constructor that accepts a ProcessContext& and a method getMain() which returns -// kj::MainFunc (probably building it using a MainBuilder). - -class MainBuilder { - // Builds a main() function with nice argument parsing. As options and arguments are parsed, - // corresponding callbacks are called, so that you never have to write a massive switch() - // statement to interpret arguments. Additionally, this approach encourages you to write - // main classes that have a reasonable API that can be used as an alternative to their - // command-line interface. - // - // All StringPtrs passed to MainBuilder must remain valid until option parsing completes. The - // assumption is that these strings will all be literals, making this an easy requirement. If - // not, consider allocating them in an Arena. - // - // Some flags are automatically recognized by the main functions built by this class: - // --help: Prints help text and exits. The help text is constructed based on the - // information you provide to the builder as you define each flag. - // --verbose: Increase logging verbosity. - // --version: Print version information and exit. - // - // Example usage: - // - // class FooMain { - // public: - // FooMain(kj::ProcessContext& context): context(context) {} - // - // bool setAll() { all = true; return true; } - // // Enable the --all flag. - // - // kj::MainBuilder::Validity setOutput(kj::StringPtr name) { - // // Set the output file. - // - // if (name.endsWith(".foo")) { - // outputFile = name; - // return true; - // } else { - // return "Output file must have extension .foo."; - // } - // } - // - // kj::MainBuilder::Validity processInput(kj::StringPtr name) { - // // Process an input file. - // - // if (!exists(name)) { - // return kj::str(name, ": file not found"); - // } - // // ... process the input file ... - // return true; - // } - // - // kj::MainFunc getMain() { - // return MainBuilder(context, "Foo Builder v1.5", "Reads s and builds a Foo.") - // .addOption({'a', "all"}, KJ_BIND_METHOD(*this, setAll), - // "Frob all the widgets. Otherwise, only some widgets are frobbed.") - // .addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to . Must be a .foo file.") - // .expectOneOrMoreArgs("", KJ_BIND_METHOD(*this, processInput)) - // .build(); - // } - // - // private: - // bool all = false; - // kj::StringPtr outputFile; - // kj::ProcessContext& context; - // }; - -public: - MainBuilder(ProcessContext& context, StringPtr version, - StringPtr briefDescription, StringPtr extendedDescription = nullptr); - ~MainBuilder() noexcept(false); - - class OptionName { - public: - OptionName() = default; - inline OptionName(char shortName): isLong(false), shortName(shortName) {} - inline OptionName(const char* longName): isLong(true), longName(longName) {} - - private: - bool isLong; - union { - char shortName; - const char* longName; - }; - friend class MainBuilder; - }; - - class Validity { - public: - inline Validity(bool valid) { - if (!valid) errorMessage = heapString("invalid argument"); - } - inline Validity(const char* errorMessage) - : errorMessage(heapString(errorMessage)) {} - inline Validity(String&& errorMessage) - : errorMessage(kj::mv(errorMessage)) {} - - inline const Maybe& getError() const { return errorMessage; } - inline Maybe releaseError() { return kj::mv(errorMessage); } - - private: - Maybe errorMessage; - friend class MainBuilder; - }; - - MainBuilder& addOption(std::initializer_list names, Function callback, - StringPtr helpText); - // Defines a new option (flag). `names` is a list of characters and strings that can be used to - // specify the option on the command line. Single-character names are used with "-" while string - // names are used with "--". `helpText` is a natural-language description of the flag. - // - // `callback` is called when the option is seen. Its return value indicates whether the option - // was accepted. If not, further option processing stops, and error is written, and the process - // exits. - // - // Example: - // - // builder.addOption({'a', "all"}, KJ_BIND_METHOD(*this, showAll), "Show all files."); - // - // This option could be specified in the following ways: - // - // -a - // --all - // - // Note that single-character option names can be combined into a single argument. For example, - // `-abcd` is equivalent to `-a -b -c -d`. - // - // The help text for this option would look like: - // - // -a, --all - // Show all files. - // - // Note that help text is automatically word-wrapped. - - MainBuilder& addOptionWithArg(std::initializer_list names, - Function callback, - StringPtr argumentTitle, StringPtr helpText); - // Like `addOption()`, but adds an option which accepts an argument. `argumentTitle` is used in - // the help text. The argument text is passed to the callback. - // - // Example: - // - // builder.addOptionWithArg({'o', "output"}, KJ_BIND_METHOD(*this, setOutput), - // "", "Output to ."); - // - // This option could be specified with an argument of "foo" in the following ways: - // - // -ofoo - // -o foo - // --output=foo - // --output foo - // - // Note that single-character option names can be combined, but only the last option can have an - // argument, since the characters after the option letter are interpreted as the argument. E.g. - // `-abofoo` would be equivalent to `-a -b -o foo`. - // - // The help text for this option would look like: - // - // -o FILENAME, --output=FILENAME - // Output to FILENAME. - - MainBuilder& addSubCommand(StringPtr name, Function getSubParser, - StringPtr briefHelpText); - // If exactly the given name is seen as an argument, invoke getSubParser() and then pass all - // remaining arguments to the parser it returns. This is useful for implementing commands which - // have lots of sub-commands, like "git" (which has sub-commands "checkout", "branch", "pull", - // etc.). - // - // `getSubParser` is only called if the command is seen. This avoids building main functions - // for commands that aren't used. - // - // `briefHelpText` should be brief enough to show immediately after the command name on a single - // line. It will not be wrapped. Users can use the built-in "help" command to get extended - // help on a particular command. - - MainBuilder& expectArg(StringPtr title, Function callback); - MainBuilder& expectOptionalArg(StringPtr title, Function callback); - MainBuilder& expectZeroOrMoreArgs(StringPtr title, Function callback); - MainBuilder& expectOneOrMoreArgs(StringPtr title, Function callback); - // Set callbacks to handle arguments. `expectArg()` and `expectOptionalArg()` specify positional - // arguments with special handling, while `expect{Zero,One}OrMoreArgs()` specifies a handler for - // an argument list (the handler is called once for each argument in the list). `title` - // specifies how the argument should be represented in the usage text. - // - // All options callbacks are called before argument callbacks, regardless of their ordering on - // the command line. This matches GNU getopt's behavior of permuting non-flag arguments to the - // end of the argument list. Also matching getopt, the special option "--" indicates that the - // rest of the command line is all arguments, not options, even if they start with '-'. - // - // The interpretation of positional arguments is fairly flexible. The non-optional arguments can - // be expected at the beginning, end, or in the middle. If more arguments are specified than - // the number of non-optional args, they are assigned to the optional argument handlers in the - // order of registration. - // - // For example, say you called: - // builder.expectArg("", ...); - // builder.expectOptionalArg("", ...); - // builder.expectArg("", ...); - // builder.expectZeroOrMoreArgs("", ...); - // builder.expectArg("", ...); - // - // This command requires at least three arguments: foo, baz, and corge. If four arguments are - // given, the second is assigned to bar. If five or more arguments are specified, then the - // arguments between the third and last are assigned to qux. Note that it never makes sense - // to call `expect*OrMoreArgs()` more than once since only the first call would ever be used. - // - // In practice, you probably shouldn't create such complicated commands as in the above example. - // But, this flexibility seems necessary to support commands where the first argument is special - // as well as commands (like `cp`) where the last argument is special. - - MainBuilder& callAfterParsing(Function callback); - // Call the given function after all arguments have been parsed. - - MainFunc build(); - // Build the "main" function, which simply parses the arguments. Once this returns, the - // `MainBuilder` is no longer valid. - -private: - struct Impl; - Own impl; - - class MainImpl; -}; - -} // namespace kj - -#endif // KJ_MAIN_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/memory.h b/phonelibs/capnp-cpp/mac/include/kj/memory.h deleted file mode 100644 index 60912b0a34..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/memory.h +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MEMORY_H_ -#define KJ_MEMORY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -// ======================================================================================= -// Disposer -- Implementation details. - -class Disposer { - // Abstract interface for a thing that "disposes" of objects, where "disposing" usually means - // calling the destructor followed by freeing the underlying memory. `Own` encapsulates an - // object pointer with corresponding Disposer. - // - // Few developers will ever touch this interface. It is primarily useful for those implementing - // custom memory allocators. - -protected: - // Do not declare a destructor, as doing so will force a global initializer for each HeapDisposer - // instance. Eww! - - virtual void disposeImpl(void* pointer) const = 0; - // Disposes of the object, given a pointer to the beginning of the object. If the object is - // polymorphic, this pointer is determined by dynamic_cast(). For non-polymorphic types, - // Own does not allow any casting, so the pointer exactly matches the original one given to - // Own. - -public: - - template - void dispose(T* object) const; - // Helper wrapper around disposeImpl(). - // - // If T is polymorphic, calls `disposeImpl(dynamic_cast(object))`, otherwise calls - // `disposeImpl(implicitCast(object))`. - // - // Callers must not call dispose() on the same pointer twice, even if the first call throws - // an exception. - -private: - template - struct Dispose_; -}; - -template -class DestructorOnlyDisposer: public Disposer { - // A disposer that merely calls the type's destructor and nothing else. - -public: - static const DestructorOnlyDisposer instance; - - void disposeImpl(void* pointer) const override { - reinterpret_cast(pointer)->~T(); - } -}; - -template -const DestructorOnlyDisposer DestructorOnlyDisposer::instance = DestructorOnlyDisposer(); - -class NullDisposer: public Disposer { - // A disposer that does nothing. - -public: - static const NullDisposer instance; - - void disposeImpl(void* pointer) const override {} -}; - -// ======================================================================================= -// Own -- An owned pointer. - -template -class Own { - // A transferrable title to a T. When an Own goes out of scope, the object's Disposer is - // called to dispose of it. An Own can be efficiently passed by move, without relocating the - // underlying object; this transfers ownership. - // - // This is much like std::unique_ptr, except: - // - You cannot release(). An owned object is not necessarily allocated with new (see next - // point), so it would be hard to use release() correctly. - // - The deleter is made polymorphic by virtual call rather than by template. This is much - // more powerful -- it allows the use of custom allocators, freelists, etc. This could - // _almost_ be accomplished with unique_ptr by forcing everyone to use something like - // std::unique_ptr, except that things get hairy in the presence of multiple - // inheritance and upcasting, and anyway if you force everyone to use a custom deleter - // then you've lost any benefit to interoperating with the "standard" unique_ptr. - -public: - KJ_DISALLOW_COPY(Own); - inline Own(): disposer(nullptr), ptr(nullptr) {} - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - inline Own(Own>&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { other.ptr = nullptr; } - template ()>> - inline Own(Own&& other) noexcept - : disposer(other.disposer), ptr(other.ptr) { - static_assert(__is_polymorphic(T), - "Casting owned pointers requires that the target type is polymorphic."); - other.ptr = nullptr; - } - inline Own(T* ptr, const Disposer& disposer) noexcept: disposer(&disposer), ptr(ptr) {} - - ~Own() noexcept(false) { dispose(); } - - inline Own& operator=(Own&& other) { - // Move-assingnment operator. - - // Careful, this might own `other`. Therefore we have to transfer the pointers first, then - // dispose. - const Disposer* disposerCopy = disposer; - T* ptrCopy = ptr; - disposer = other.disposer; - ptr = other.ptr; - other.ptr = nullptr; - if (ptrCopy != nullptr) { - disposerCopy->dispose(const_cast*>(ptrCopy)); - } - return *this; - } - - inline Own& operator=(decltype(nullptr)) { - dispose(); - return *this; - } - - template - Own downcast() { - // Downcast the pointer to Own, destroying the original pointer. If this pointer does not - // actually point at an instance of U, the results are undefined (throws an exception in debug - // mode if RTTI is enabled, otherwise you're on your own). - - Own result; - if (ptr != nullptr) { - result.ptr = &kj::downcast(*ptr); - result.disposer = disposer; - ptr = nullptr; - } - return result; - } - -#define NULLCHECK KJ_IREQUIRE(ptr != nullptr, "null Own<> dereference") - inline T* operator->() { NULLCHECK; return ptr; } - inline const T* operator->() const { NULLCHECK; return ptr; } - inline T& operator*() { NULLCHECK; return *ptr; } - inline const T& operator*() const { NULLCHECK; return *ptr; } -#undef NULLCHECK - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - const Disposer* disposer; // Only valid if ptr != nullptr. - T* ptr; - - inline explicit Own(decltype(nullptr)): disposer(nullptr), ptr(nullptr) {} - - inline bool operator==(decltype(nullptr)) { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) { return ptr != nullptr; } - // Only called by Maybe>. - - inline void dispose() { - // Make sure that if an exception is thrown, we are left with a null ptr, so we won't possibly - // dispose again. - T* ptrCopy = ptr; - if (ptrCopy != nullptr) { - ptr = nullptr; - disposer->dispose(const_cast*>(ptrCopy)); - } - } - - template - friend class Own; - friend class Maybe>; -}; - -namespace _ { // private - -template -class OwnOwn { -public: - inline OwnOwn(Own&& value) noexcept: value(kj::mv(value)) {} - - inline Own& operator*() & { return value; } - inline const Own& operator*() const & { return value; } - inline Own&& operator*() && { return kj::mv(value); } - inline const Own&& operator*() const && { return kj::mv(value); } - inline Own* operator->() { return &value; } - inline const Own* operator->() const { return &value; } - inline operator Own*() { return value ? &value : nullptr; } - inline operator const Own*() const { return value ? &value : nullptr; } - -private: - Own value; -}; - -template -OwnOwn readMaybe(Maybe>&& maybe) { return OwnOwn(kj::mv(maybe.ptr)); } -template -Own* readMaybe(Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } -template -const Own* readMaybe(const Maybe>& maybe) { return maybe.ptr ? &maybe.ptr : nullptr; } - -} // namespace _ (private) - -template -class Maybe> { -public: - inline Maybe(): ptr(nullptr) {} - inline Maybe(Own&& t) noexcept: ptr(kj::mv(t)) {} - inline Maybe(Maybe&& other) noexcept: ptr(kj::mv(other.ptr)) {} - - template - inline Maybe(Maybe>&& other): ptr(mv(other.ptr)) {} - template - inline Maybe(Own&& other): ptr(mv(other)) {} - - inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} - - inline operator Maybe() { return ptr.get(); } - inline operator Maybe() const { return ptr.get(); } - - inline Maybe& operator=(Maybe&& other) { ptr = kj::mv(other.ptr); return *this; } - - inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } - inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - - Own& orDefault(Own& defaultValue) { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - const Own& orDefault(const Own& defaultValue) const { - if (ptr == nullptr) { - return defaultValue; - } else { - return ptr; - } - } - - template - auto map(Func&& f) & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) const & -> Maybe&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(ptr); - } - } - - template - auto map(Func&& f) && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - - template - auto map(Func&& f) const && -> Maybe&&>()))> { - if (ptr == nullptr) { - return nullptr; - } else { - return f(kj::mv(ptr)); - } - } - -private: - Own ptr; - - template - friend class Maybe; - template - friend _::OwnOwn _::readMaybe(Maybe>&& maybe); - template - friend Own* _::readMaybe(Maybe>& maybe); - template - friend const Own* _::readMaybe(const Maybe>& maybe); -}; - -namespace _ { // private - -template -class HeapDisposer final: public Disposer { -public: - virtual void disposeImpl(void* pointer) const override { delete reinterpret_cast(pointer); } - - static const HeapDisposer instance; -}; - -template -const HeapDisposer HeapDisposer::instance = HeapDisposer(); - -} // namespace _ (private) - -template -Own heap(Params&&... params) { - // heap(...) allocates a T on the heap, forwarding the parameters to its constructor. The - // exact heap implementation is unspecified -- for now it is operator new, but you should not - // assume this. (Since we know the object size at delete time, we could actually implement an - // allocator that is more efficient than operator new.) - - return Own(new T(kj::fwd(params)...), _::HeapDisposer::instance); -} - -template -Own> heap(T&& orig) { - // Allocate a copy (or move) of the argument on the heap. - // - // The purpose of this overload is to allow you to omit the template parameter as there is only - // one argument and the purpose is to copy it. - - typedef Decay T2; - return Own(new T2(kj::fwd(orig)), _::HeapDisposer::instance); -} - -// ======================================================================================= -// SpaceFor -- assists in manual allocation - -template -class SpaceFor { - // A class which has the same size and alignment as T but does not call its constructor or - // destructor automatically. Instead, call construct() to construct a T in the space, which - // returns an Own which will take care of calling T's destructor later. - -public: - inline SpaceFor() {} - inline ~SpaceFor() {} - - template - Own construct(Params&&... params) { - ctor(value, kj::fwd(params)...); - return Own(&value, DestructorOnlyDisposer::instance); - } - -private: - union { - T value; - }; -}; - -// ======================================================================================= -// Inline implementation details - -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - // Note that dynamic_cast does not require RTTI to be enabled, because the offset to - // the top of the object is in the vtable -- as it obviously needs to be to correctly implement - // operator delete. - disposer.disposeImpl(dynamic_cast(object)); - } -}; -template -struct Disposer::Dispose_ { - static void dispose(T* object, const Disposer& disposer) { - disposer.disposeImpl(static_cast(object)); - } -}; - -template -void Disposer::dispose(T* object) const { - Dispose_::dispose(object, *this); -} - -} // namespace kj - -#endif // KJ_MEMORY_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/miniposix.h b/phonelibs/capnp-cpp/mac/include/kj/miniposix.h deleted file mode 100644 index 111c9bc379..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/miniposix.h +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MINIPOSIX_H_ -#define KJ_MINIPOSIX_H_ - -// This header provides a small subset of the POSIX API which also happens to be available on -// Windows under slightly-different names. - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#if _WIN32 -#include -#include -#include // _O_BINARY -#else -#include -#include -#endif - -#if !_WIN32 || __MINGW32__ -#include -#include -#include -#endif - -#if !_WIN32 -#include -#endif - -namespace kj { -namespace miniposix { - -#if _WIN32 && !__MINGW32__ -// We're on Windows and not MinGW. So, we need to define wrappers for the POSIX API. - -typedef int ssize_t; - -inline ssize_t read(int fd, void* buffer, size_t size) { - return ::_read(fd, buffer, size); -} -inline ssize_t write(int fd, const void* buffer, size_t size) { - return ::_write(fd, buffer, size); -} -inline int close(int fd) { - return ::_close(fd); -} - -#ifndef F_OK -#define F_OK 0 // access() existence test -#endif - -#ifndef S_ISREG -#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) // stat() regular file test -#endif -#ifndef S_ISDIR -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) // stat() directory test -#endif - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -#define STDERR_FILENO 2 -#endif - -#else -// We're on a POSIX system or MinGW which already defines the wrappers for us. - -using ::ssize_t; -using ::read; -using ::write; -using ::close; - -#endif - -#if _WIN32 -// We're on Windows, including MinGW. pipe() and mkdir() are non-standard even on MinGW. - -inline int pipe(int fds[2]) { - return ::_pipe(fds, 8192, _O_BINARY); -} -inline int mkdir(const char* path, int mode) { - return ::_mkdir(path); -} - -#else -// We're on real POSIX. - -using ::pipe; -using ::mkdir; - -inline size_t iovMax(size_t count) { - // Apparently, there is a maximum number of iovecs allowed per call. I don't understand why. - // Most platforms define IOV_MAX but Linux defines only UIO_MAXIOV and others, like Hurd, - // define neither. - // - // On platforms where both IOV_MAX and UIO_MAXIOV are undefined, we poke sysconf(_SC_IOV_MAX), - // then try to fall back to the POSIX-mandated minimum of _XOPEN_IOV_MAX if that fails. - // - // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html#tag_13_23_03_01 - -#if defined(IOV_MAX) - // Solaris (and others?) - return IOV_MAX; -#elif defined(UIO_MAXIOV) - // Linux - return UIO_MAXIOV; -#else - // POSIX mystery meat - - long iovmax; - - errno = 0; - if ((iovmax = sysconf(_SC_IOV_MAX)) == -1) { - // assume iovmax == -1 && errno == 0 means "unbounded" - return errno ? _XOPEN_IOV_MAX : count; - } else { - return (size_t) iovmax; - } -#endif -} - -#endif - -} // namespace miniposix -} // namespace kj - -#endif // KJ_MINIPOSIX_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/mutex.h b/phonelibs/capnp-cpp/mac/include/kj/mutex.h deleted file mode 100644 index d211ebfeb1..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/mutex.h +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_MUTEX_H_ -#define KJ_MUTEX_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "memory.h" -#include - -#if __linux__ && !defined(KJ_USE_FUTEX) -#define KJ_USE_FUTEX 1 -#endif - -#if !KJ_USE_FUTEX && !_WIN32 -// On Linux we use futex. On other platforms we wrap pthreads. -// TODO(someday): Write efficient low-level locking primitives for other platforms. -#include -#endif - -namespace kj { - -// ======================================================================================= -// Private details -- public interfaces follow below. - -namespace _ { // private - -class Mutex { - // Internal implementation details. See `MutexGuarded`. - -public: - Mutex(); - ~Mutex(); - KJ_DISALLOW_COPY(Mutex); - - enum Exclusivity { - EXCLUSIVE, - SHARED - }; - - void lock(Exclusivity exclusivity); - void unlock(Exclusivity exclusivity); - - void assertLockedByCaller(Exclusivity exclusivity); - // In debug mode, assert that the mutex is locked by the calling thread, or if that is - // non-trivial, assert that the mutex is locked (which should be good enough to catch problems - // in unit tests). In non-debug builds, do nothing. - -private: -#if KJ_USE_FUTEX - uint futex; - // bit 31 (msb) = set if exclusive lock held - // bit 30 (msb) = set if threads are waiting for exclusive lock - // bits 0-29 = count of readers; If an exclusive lock is held, this is the count of threads - // waiting for a read lock, otherwise it is the count of threads that currently hold a read - // lock. - - static constexpr uint EXCLUSIVE_HELD = 1u << 31; - static constexpr uint EXCLUSIVE_REQUESTED = 1u << 30; - static constexpr uint SHARED_COUNT_MASK = EXCLUSIVE_REQUESTED - 1; - -#elif _WIN32 - uintptr_t srwLock; // Actually an SRWLOCK, but don't want to #include in header. - -#else - mutable pthread_rwlock_t mutex; -#endif -}; - -class Once { - // Internal implementation details. See `Lazy`. - -public: -#if KJ_USE_FUTEX - inline Once(bool startInitialized = false) - : futex(startInitialized ? INITIALIZED : UNINITIALIZED) {} -#else - Once(bool startInitialized = false); - ~Once(); -#endif - KJ_DISALLOW_COPY(Once); - - class Initializer { - public: - virtual void run() = 0; - }; - - void runOnce(Initializer& init); - -#if _WIN32 // TODO(perf): Can we make this inline on win32 somehow? - bool isInitialized() noexcept; - -#else - inline bool isInitialized() noexcept { - // Fast path check to see if runOnce() would simply return immediately. -#if KJ_USE_FUTEX - return __atomic_load_n(&futex, __ATOMIC_ACQUIRE) == INITIALIZED; -#else - return __atomic_load_n(&state, __ATOMIC_ACQUIRE) == INITIALIZED; -#endif - } -#endif - - void reset(); - // Returns the state from initialized to uninitialized. It is an error to call this when - // not already initialized, or when runOnce() or isInitialized() might be called concurrently in - // another thread. - -private: -#if KJ_USE_FUTEX - uint futex; - - enum State { - UNINITIALIZED, - INITIALIZING, - INITIALIZING_WITH_WAITERS, - INITIALIZED - }; - -#elif _WIN32 - uintptr_t initOnce; // Actually an INIT_ONCE, but don't want to #include in header. - -#else - enum State { - UNINITIALIZED, - INITIALIZED - }; - State state; - pthread_mutex_t mutex; -#endif -}; - -} // namespace _ (private) - -// ======================================================================================= -// Public interface - -template -class Locked { - // Return type for `MutexGuarded::lock()`. `Locked` provides access to the bounded object - // and unlocks the mutex when it goes out of scope. - -public: - KJ_DISALLOW_COPY(Locked); - inline Locked(): mutex(nullptr), ptr(nullptr) {} - inline Locked(Locked&& other): mutex(other.mutex), ptr(other.ptr) { - other.mutex = nullptr; - other.ptr = nullptr; - } - inline ~Locked() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - } - - inline Locked& operator=(Locked&& other) { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = other.mutex; - ptr = other.ptr; - other.mutex = nullptr; - other.ptr = nullptr; - return *this; - } - - inline void release() { - if (mutex != nullptr) mutex->unlock(isConst() ? _::Mutex::SHARED : _::Mutex::EXCLUSIVE); - mutex = nullptr; - ptr = nullptr; - } - - inline T* operator->() { return ptr; } - inline const T* operator->() const { return ptr; } - inline T& operator*() { return *ptr; } - inline const T& operator*() const { return *ptr; } - inline T* get() { return ptr; } - inline const T* get() const { return ptr; } - inline operator T*() { return ptr; } - inline operator const T*() const { return ptr; } - -private: - _::Mutex* mutex; - T* ptr; - - inline Locked(_::Mutex& mutex, T& value): mutex(&mutex), ptr(&value) {} - - template - friend class MutexGuarded; -}; - -template -class MutexGuarded { - // An object of type T, bounded by a mutex. In order to access the object, you must lock it. - // - // Write locks are not "recursive" -- trying to lock again in a thread that already holds a lock - // will deadlock. Recursive write locks are usually a sign of bad design. - // - // Unfortunately, **READ LOCKS ARE NOT RECURSIVE** either. Common sense says they should be. - // But on many operating systems (BSD, OSX), recursively read-locking a pthread_rwlock is - // actually unsafe. The problem is that writers are "prioritized" over readers, so a read lock - // request will block if any write lock requests are outstanding. So, if thread A takes a read - // lock, thread B requests a write lock (and starts waiting), and then thread A tries to take - // another read lock recursively, the result is deadlock. - -public: - template - explicit MutexGuarded(Params&&... params); - // Initialize the mutex-bounded object by passing the given parameters to its constructor. - - Locked lockExclusive() const; - // Exclusively locks the object and returns it. The returned `Locked` can be passed by - // move, similar to `Own`. - // - // This method is declared `const` in accordance with KJ style rules which say that constness - // should be used to indicate thread-safety. It is safe to share a const pointer between threads, - // but it is not safe to share a mutable pointer. Since the whole point of MutexGuarded is to - // be shared between threads, its methods should be const, even though locking it produces a - // non-const pointer to the contained object. - - Locked lockShared() const; - // Lock the value for shared access. Multiple shared locks can be taken concurrently, but cannot - // be held at the same time as a non-shared lock. - - inline const T& getWithoutLock() const { return value; } - inline T& getWithoutLock() { return value; } - // Escape hatch for cases where some external factor guarantees that it's safe to get the - // value. You should treat these like const_cast -- be highly suspicious of any use. - - inline const T& getAlreadyLockedShared() const; - inline T& getAlreadyLockedShared(); - inline T& getAlreadyLockedExclusive() const; - // Like `getWithoutLock()`, but asserts that the lock is already held by the calling thread. - -private: - mutable _::Mutex mutex; - mutable T value; -}; - -template -class MutexGuarded { - // MutexGuarded cannot guard a const type. This would be pointless anyway, and would complicate - // the implementation of Locked, which uses constness to decide what kind of lock it holds. - static_assert(sizeof(T) < 0, "MutexGuarded's type cannot be const."); -}; - -template -class Lazy { - // A lazily-initialized value. - -public: - template - T& get(Func&& init); - template - const T& get(Func&& init) const; - // The first thread to call get() will invoke the given init function to construct the value. - // Other threads will block until construction completes, then return the same value. - // - // `init` is a functor(typically a lambda) which takes `SpaceFor&` as its parameter and returns - // `Own`. If `init` throws an exception, the exception is propagated out of that thread's - // call to `get()`, and subsequent calls behave as if `get()` hadn't been called at all yet -- - // in other words, subsequent calls retry initialization until it succeeds. - -private: - mutable _::Once once; - mutable SpaceFor space; - mutable Own value; - - template - class InitImpl; -}; - -// ======================================================================================= -// Inline implementation details - -template -template -inline MutexGuarded::MutexGuarded(Params&&... params) - : value(kj::fwd(params)...) {} - -template -inline Locked MutexGuarded::lockExclusive() const { - mutex.lock(_::Mutex::EXCLUSIVE); - return Locked(mutex, value); -} - -template -inline Locked MutexGuarded::lockShared() const { - mutex.lock(_::Mutex::SHARED); - return Locked(mutex, value); -} - -template -inline const T& MutexGuarded::getAlreadyLockedShared() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedShared() { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::SHARED); -#endif - return value; -} -template -inline T& MutexGuarded::getAlreadyLockedExclusive() const { -#ifdef KJ_DEBUG - mutex.assertLockedByCaller(_::Mutex::EXCLUSIVE); -#endif - return const_cast(value); -} - -template -template -class Lazy::InitImpl: public _::Once::Initializer { -public: - inline InitImpl(const Lazy& lazy, Func&& func): lazy(lazy), func(kj::fwd(func)) {} - - void run() override { - lazy.value = func(lazy.space); - } - -private: - const Lazy& lazy; - Func func; -}; - -template -template -inline T& Lazy::get(Func&& init) { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -template -template -inline const T& Lazy::get(Func&& init) const { - if (!once.isInitialized()) { - InitImpl initImpl(*this, kj::fwd(init)); - once.runOnce(initImpl); - } - return *value; -} - -} // namespace kj - -#endif // KJ_MUTEX_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/one-of.h b/phonelibs/capnp-cpp/mac/include/kj/one-of.h deleted file mode 100644 index 6e143c44cf..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/one-of.h +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_ONE_OF_H_ -#define KJ_ONE_OF_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { - -namespace _ { // private - -template -struct TypeIndex_ { static constexpr uint value = TypeIndex_::value; }; -template -struct TypeIndex_ { static constexpr uint value = i; }; - -} // namespace _ (private) - -template -class OneOf { - template - static inline constexpr uint typeIndex() { return _::TypeIndex_<1, Key, Variants...>::value; } - // Get the 1-based index of Key within the type list Types. - -public: - inline OneOf(): tag(0) {} - OneOf(const OneOf& other) { copyFrom(other); } - OneOf(OneOf&& other) { moveFrom(other); } - ~OneOf() { destroy(); } - - OneOf& operator=(const OneOf& other) { if (tag != 0) destroy(); copyFrom(other); return *this; } - OneOf& operator=(OneOf&& other) { if (tag != 0) destroy(); moveFrom(other); return *this; } - - inline bool operator==(decltype(nullptr)) const { return tag == 0; } - inline bool operator!=(decltype(nullptr)) const { return tag != 0; } - - template - bool is() const { - return tag == typeIndex(); - } - - template - T& get() { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - template - const T& get() const { - KJ_IREQUIRE(is(), "Must check OneOf::is() before calling get()."); - return *reinterpret_cast(space); - } - - template - T& init(Params&&... params) { - if (tag != 0) destroy(); - ctor(*reinterpret_cast(space), kj::fwd(params)...); - tag = typeIndex(); - return *reinterpret_cast(space); - } - -private: - uint tag; - - static inline constexpr size_t maxSize(size_t a) { - return a; - } - template - static inline constexpr size_t maxSize(size_t a, size_t b, Rest... rest) { - return maxSize(kj::max(a, b), rest...); - } - // Returns the maximum of all the parameters. - // TODO(someday): Generalize the above template and make it common. I tried, but C++ decided to - // be difficult so I cut my losses. - - static constexpr auto spaceSize = maxSize(sizeof(Variants)...); - // TODO(msvc): This constant could just as well go directly inside space's bracket's, where it's - // used, but MSVC suffers a parse error on `...`. - - union { - byte space[spaceSize]; - - void* forceAligned; - // TODO(someday): Use C++11 alignas() once we require GCC 4.8 / Clang 3.3. - }; - - template - inline void doAll(T... t) {} - - template - inline bool destroyVariant() { - if (tag == typeIndex()) { - tag = 0; - dtor(*reinterpret_cast(space)); - } - return false; - } - void destroy() { - doAll(destroyVariant()...); - } - - template - inline bool copyVariantFrom(const OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), other.get()); - } - return false; - } - void copyFrom(const OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(copyVariantFrom(other)...); - } - - template - inline bool moveVariantFrom(OneOf& other) { - if (other.is()) { - ctor(*reinterpret_cast(space), kj::mv(other.get())); - } - return false; - } - void moveFrom(OneOf& other) { - // Initialize as a copy of `other`. Expects that `this` starts out uninitialized, so the tag - // is invalid. - tag = other.tag; - doAll(moveVariantFrom(other)...); - } -}; - -} // namespace kj - -#endif // KJ_ONE_OF_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/parse/char.h b/phonelibs/capnp-cpp/mac/include/kj/parse/char.h deleted file mode 100644 index 2e6d51921d..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/parse/char.h +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains parsers useful for character stream inputs, including parsers to parse -// common kinds of tokens like identifiers, numbers, and quoted strings. - -#ifndef KJ_PARSE_CHAR_H_ -#define KJ_PARSE_CHAR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "../string.h" -#include - -namespace kj { -namespace parse { - -// ======================================================================================= -// Exact char/string. - -class ExactString_ { -public: - constexpr inline ExactString_(const char* str): str(str) {} - - template - Maybe> operator()(Input& input) const { - const char* ptr = str; - - while (*ptr != '\0') { - if (input.atEnd() || input.current() != *ptr) return nullptr; - input.next(); - ++ptr; - } - - return Tuple<>(); - } - -private: - const char* str; -}; - -constexpr inline ExactString_ exactString(const char* str) { - return ExactString_(str); -} - -template -constexpr ExactlyConst_ exactChar() { - // Returns a parser that matches exactly the character given by the template argument (returning - // no result). - return ExactlyConst_(); -} - -// ======================================================================================= -// Char ranges / sets - -class CharGroup_ { -public: - constexpr inline CharGroup_(): bits{0, 0, 0, 0} {} - - constexpr inline CharGroup_ orRange(unsigned char first, unsigned char last) const { - return CharGroup_(bits[0] | (oneBits(last + 1) & ~oneBits(first )), - bits[1] | (oneBits(last - 63) & ~oneBits(first - 64)), - bits[2] | (oneBits(last - 127) & ~oneBits(first - 128)), - bits[3] | (oneBits(last - 191) & ~oneBits(first - 192))); - } - - constexpr inline CharGroup_ orAny(const char* chars) const { - return *chars == 0 ? *this : orChar(*chars).orAny(chars + 1); - } - - constexpr inline CharGroup_ orChar(unsigned char c) const { - return CharGroup_(bits[0] | bit(c), - bits[1] | bit(c - 64), - bits[2] | bit(c - 128), - bits[3] | bit(c - 256)); - } - - constexpr inline CharGroup_ orGroup(CharGroup_ other) const { - return CharGroup_(bits[0] | other.bits[0], - bits[1] | other.bits[1], - bits[2] | other.bits[2], - bits[3] | other.bits[3]); - } - - constexpr inline CharGroup_ invert() const { - return CharGroup_(~bits[0], ~bits[1], ~bits[2], ~bits[3]); - } - - constexpr inline bool contains(unsigned char c) const { - return (bits[c / 64] & (1ll << (c % 64))) != 0; - } - - template - Maybe operator()(Input& input) const { - if (input.atEnd()) return nullptr; - unsigned char c = input.current(); - if (contains(c)) { - input.next(); - return c; - } else { - return nullptr; - } - } - -private: - typedef unsigned long long Bits64; - - constexpr inline CharGroup_(Bits64 a, Bits64 b, Bits64 c, Bits64 d): bits{a, b, c, d} {} - Bits64 bits[4]; - - static constexpr inline Bits64 oneBits(int count) { - return count <= 0 ? 0ll : count >= 64 ? -1ll : ((1ll << count) - 1); - } - static constexpr inline Bits64 bit(int index) { - return index < 0 ? 0 : index >= 64 ? 0 : (1ll << index); - } -}; - -constexpr inline CharGroup_ charRange(char first, char last) { - // Create a parser which accepts any character in the range from `first` to `last`, inclusive. - // For example: `charRange('a', 'z')` matches all lower-case letters. The parser's result is the - // character matched. - // - // The returned object has methods which can be used to match more characters. The following - // produces a parser which accepts any letter as well as '_', '+', '-', and '.'. - // - // charRange('a', 'z').orRange('A', 'Z').orChar('_').orAny("+-.") - // - // You can also use `.invert()` to match the opposite set of characters. - - return CharGroup_().orRange(first, last); -} - -#if _MSC_VER -#define anyOfChars(chars) CharGroup_().orAny(chars) -// TODO(msvc): MSVC ICEs on the proper definition of `anyOfChars()`, which in turn prevents us from -// building the compiler or schema parser. We don't know why this happens, but Harris found that -// this horrible, horrible hack makes things work. This is awful, but it's better than nothing. -// Hopefully, MSVC will get fixed soon and we'll be able to remove this. -#else -constexpr inline CharGroup_ anyOfChars(const char* chars) { - // Returns a parser that accepts any of the characters in the given string (which should usually - // be a literal). The returned parser is of the same type as returned by `charRange()` -- see - // that function for more info. - - return CharGroup_().orAny(chars); -} -#endif - -// ======================================================================================= - -namespace _ { // private - -struct ArrayToString { - inline String operator()(const Array& arr) const { - return heapString(arr); - } -}; - -} // namespace _ (private) - -template -constexpr inline auto charsToString(SubParser&& subParser) - -> decltype(transform(kj::fwd(subParser), _::ArrayToString())) { - // Wraps a parser that returns Array such that it returns String instead. - return parse::transform(kj::fwd(subParser), _::ArrayToString()); -} - -// ======================================================================================= -// Basic character classes. - -constexpr auto alpha = charRange('a', 'z').orRange('A', 'Z'); -constexpr auto digit = charRange('0', '9'); -constexpr auto alphaNumeric = alpha.orGroup(digit); -constexpr auto nameStart = alpha.orChar('_'); -constexpr auto nameChar = alphaNumeric.orChar('_'); -constexpr auto hexDigit = charRange('0', '9').orRange('a', 'f').orRange('A', 'F'); -constexpr auto octDigit = charRange('0', '7'); -constexpr auto whitespaceChar = anyOfChars(" \f\n\r\t\v"); -constexpr auto controlChar = charRange(0, 0x1f).invert().orGroup(whitespaceChar).invert(); - -constexpr auto whitespace = many(anyOfChars(" \f\n\r\t\v")); - -constexpr auto discardWhitespace = discard(many(discard(anyOfChars(" \f\n\r\t\v")))); -// Like discard(whitespace) but avoids some memory allocation. - -// ======================================================================================= -// Identifiers - -namespace _ { // private - -struct IdentifierToString { - inline String operator()(char first, const Array& rest) const { - String result = heapString(rest.size() + 1); - result[0] = first; - memcpy(result.begin() + 1, rest.begin(), rest.size()); - return result; - } -}; - -} // namespace _ (private) - -constexpr auto identifier = transform(sequence(nameStart, many(nameChar)), _::IdentifierToString()); -// Parses an identifier (e.g. a C variable name). - -// ======================================================================================= -// Integers - -namespace _ { // private - -inline char parseDigit(char c) { - if (c < 'A') return c - '0'; - if (c < 'a') return c - 'A' + 10; - return c - 'a' + 10; -} - -template -struct ParseInteger { - inline uint64_t operator()(const Array& digits) const { - return operator()('0', digits); - } - uint64_t operator()(char first, const Array& digits) const { - uint64_t result = parseDigit(first); - for (char digit: digits) { - result = result * base + parseDigit(digit); - } - return result; - } -}; - - -} // namespace _ (private) - -constexpr auto integer = sequence( - oneOf( - transform(sequence(exactChar<'0'>(), exactChar<'x'>(), oneOrMore(hexDigit)), _::ParseInteger<16>()), - transform(sequence(exactChar<'0'>(), many(octDigit)), _::ParseInteger<8>()), - transform(sequence(charRange('1', '9'), many(digit)), _::ParseInteger<10>())), - notLookingAt(alpha.orAny("_."))); - -// ======================================================================================= -// Numbers (i.e. floats) - -namespace _ { // private - -struct ParseFloat { - double operator()(const Array& digits, - const Maybe>& fraction, - const Maybe, Array>>& exponent) const; -}; - -} // namespace _ (private) - -constexpr auto number = transform( - sequence( - oneOrMore(digit), - optional(sequence(exactChar<'.'>(), many(digit))), - optional(sequence(discard(anyOfChars("eE")), optional(anyOfChars("+-")), many(digit))), - notLookingAt(alpha.orAny("_."))), - _::ParseFloat()); - -// ======================================================================================= -// Quoted strings - -namespace _ { // private - -struct InterpretEscape { - char operator()(char c) const { - switch (c) { - case 'a': return '\a'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'n': return '\n'; - case 'r': return '\r'; - case 't': return '\t'; - case 'v': return '\v'; - default: return c; - } - } -}; - -struct ParseHexEscape { - inline char operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseHexByte { - inline byte operator()(char first, char second) const { - return (parseDigit(first) << 4) | parseDigit(second); - } -}; - -struct ParseOctEscape { - inline char operator()(char first, Maybe second, Maybe third) const { - char result = first - '0'; - KJ_IF_MAYBE(digit1, second) { - result = (result << 3) | (*digit1 - '0'); - KJ_IF_MAYBE(digit2, third) { - result = (result << 3) | (*digit2 - '0'); - } - } - return result; - } -}; - -} // namespace _ (private) - -constexpr auto escapeSequence = - sequence(exactChar<'\\'>(), oneOf( - transform(anyOfChars("abfnrtv'\"\\\?"), _::InterpretEscape()), - transform(sequence(exactChar<'x'>(), hexDigit, hexDigit), _::ParseHexEscape()), - transform(sequence(octDigit, optional(octDigit), optional(octDigit)), - _::ParseOctEscape()))); -// A parser that parses a C-string-style escape sequence (starting with a backslash). Returns -// a char. - -constexpr auto doubleQuotedString = charsToString(sequence( - exactChar<'\"'>(), - many(oneOf(anyOfChars("\\\n\"").invert(), escapeSequence)), - exactChar<'\"'>())); -// Parses a C-style double-quoted string. - -constexpr auto singleQuotedString = charsToString(sequence( - exactChar<'\''>(), - many(oneOf(anyOfChars("\\\n\'").invert(), escapeSequence)), - exactChar<'\''>())); -// Parses a C-style single-quoted string. - -constexpr auto doubleQuotedHexBinary = sequence( - exactChar<'0'>(), exactChar<'x'>(), exactChar<'\"'>(), - oneOrMore(transform(sequence(discardWhitespace, hexDigit, hexDigit), _::ParseHexByte())), - discardWhitespace, - exactChar<'\"'>()); -// Parses a double-quoted hex binary literal. Returns Array. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_CHAR_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/parse/common.h b/phonelibs/capnp-cpp/mac/include/kj/parse/common.h deleted file mode 100644 index 3af3a8760d..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/parse/common.h +++ /dev/null @@ -1,824 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Parser combinator framework! -// -// This file declares several functions which construct parsers, usually taking other parsers as -// input, thus making them parser combinators. -// -// A valid parser is any functor which takes a reference to an input cursor (defined below) as its -// input and returns a Maybe. The parser returns null on parse failure, or returns the parsed -// result on success. -// -// An "input cursor" is any type which implements the same interface as IteratorInput, below. Such -// a type acts as a pointer to the current input location. When a parser returns successfully, it -// will have updated the input cursor to point to the position just past the end of what was parsed. -// On failure, the cursor position is unspecified. - -#ifndef KJ_PARSE_COMMON_H_ -#define KJ_PARSE_COMMON_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../common.h" -#include "../memory.h" -#include "../array.h" -#include "../tuple.h" -#include "../vector.h" -#if _MSC_VER -#include // result_of_t -#endif - -namespace kj { -namespace parse { - -template -class IteratorInput { - // A parser input implementation based on an iterator range. - -public: - IteratorInput(Iterator begin, Iterator end) - : parent(nullptr), pos(begin), end(end), best(begin) {} - explicit IteratorInput(IteratorInput& parent) - : parent(&parent), pos(parent.pos), end(parent.end), best(parent.pos) {} - ~IteratorInput() { - if (parent != nullptr) { - parent->best = kj::max(kj::max(pos, best), parent->best); - } - } - KJ_DISALLOW_COPY(IteratorInput); - - void advanceParent() { - parent->pos = pos; - } - void forgetParent() { - parent = nullptr; - } - - bool atEnd() { return pos == end; } - auto current() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos; - } - auto consume() -> decltype(*instance()) { - KJ_IREQUIRE(!atEnd()); - return *pos++; - } - void next() { - KJ_IREQUIRE(!atEnd()); - ++pos; - } - - Iterator getBest() { return kj::max(pos, best); } - - Iterator getPosition() { return pos; } - -private: - IteratorInput* parent; - Iterator pos; - Iterator end; - Iterator best; // furthest we got with any sub-input -}; - -template struct OutputType_; -template struct OutputType_> { typedef T Type; }; -template -using OutputType = typename OutputType_< -#if _MSC_VER - std::result_of_t - // The instance() based version below results in: - // C2064: term does not evaluate to a function taking 1 arguments -#else - decltype(instance()(instance())) -#endif - >::Type; -// Synonym for the output type of a parser, given the parser type and the input type. - -// ======================================================================================= - -template -class ParserRef { - // Acts as a reference to some other parser, with simplified type. The referenced parser - // is polymorphic by virtual call rather than templates. For grammars of non-trivial size, - // it is important to inject refs into the grammar here and there to prevent the parser types - // from becoming ridiculous. Using too many of them can hurt performance, though. - -public: - ParserRef(): parser(nullptr), wrapper(nullptr) {} - ParserRef(const ParserRef&) = default; - ParserRef(ParserRef&&) = default; - ParserRef& operator=(const ParserRef& other) = default; - ParserRef& operator=(ParserRef&& other) = default; - - template - constexpr ParserRef(Other&& other) - : parser(&other), wrapper(&WrapperImplInstance>::instance) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - } - - template - inline ParserRef& operator=(Other&& other) { - static_assert(kj::isReference(), "ParserRef should not be assigned to a temporary."); - parser = &other; - wrapper = &WrapperImplInstance>::instance; - return *this; - } - - KJ_ALWAYS_INLINE(Maybe operator()(Input& input) const) { - // Always inline in the hopes that this allows branch prediction to kick in so the virtual call - // doesn't hurt so much. - return wrapper->parse(parser, input); - } - -private: - struct Wrapper { - virtual Maybe parse(const void* parser, Input& input) const = 0; - }; - template - struct WrapperImpl: public Wrapper { - Maybe parse(const void* parser, Input& input) const override { - return (*reinterpret_cast(parser))(input); - } - }; - template - struct WrapperImplInstance { -#if _MSC_VER - // TODO(msvc): MSVC currently fails to initialize vtable pointers for constexpr values so - // we have to make this just const instead. - static const WrapperImpl instance; -#else - static constexpr WrapperImpl instance = WrapperImpl(); -#endif - }; - - const void* parser; - const Wrapper* wrapper; -}; - -template -template -#if _MSC_VER -const typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance = WrapperImpl(); -#else -constexpr typename ParserRef::template WrapperImpl -ParserRef::WrapperImplInstance::instance; -#endif - -template -constexpr ParserRef> ref(ParserImpl& impl) { - // Constructs a ParserRef. You must specify the input type explicitly, e.g. - // `ref(myParser)`. - - return ParserRef>(impl); -} - -// ------------------------------------------------------------------- -// any -// Output = one token - -class Any_ { -public: - template - Maybe().consume())>> operator()(Input& input) const { - if (input.atEnd()) { - return nullptr; - } else { - return input.consume(); - } - } -}; - -constexpr Any_ any = Any_(); -// A parser which matches any token and simply returns it. - -// ------------------------------------------------------------------- -// exactly() -// Output = Tuple<> - -template -class Exactly_ { -public: - explicit constexpr Exactly_(T&& expected): expected(expected) {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } - -private: - T expected; -}; - -template -constexpr Exactly_ exactly(T&& expected) { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. - - return Exactly_(kj::fwd(expected)); -} - -// ------------------------------------------------------------------- -// exactlyConst() -// Output = Tuple<> - -template -class ExactlyConst_ { -public: - explicit constexpr ExactlyConst_() {} - - template - Maybe> operator()(Input& input) const { - if (input.atEnd() || input.current() != expected) { - return nullptr; - } else { - input.next(); - return Tuple<>(); - } - } -}; - -template -constexpr ExactlyConst_ exactlyConst() { - // Constructs a parser which succeeds when the input is exactly the token specified. The - // result is always the empty tuple. This parser is templated on the token value which may cause - // it to perform better -- or worse. Be sure to measure. - - return ExactlyConst_(); -} - -// ------------------------------------------------------------------- -// constResult() - -template -class ConstResult_ { -public: - explicit constexpr ConstResult_(SubParser&& subParser, Result&& result) - : subParser(kj::fwd(subParser)), result(kj::fwd(result)) {} - - template - Maybe operator()(Input& input) const { - if (subParser(input) == nullptr) { - return nullptr; - } else { - return result; - } - } - -private: - SubParser subParser; - Result result; -}; - -template -constexpr ConstResult_ constResult(SubParser&& subParser, Result&& result) { - // Constructs a parser which returns exactly `result` if `subParser` is successful. - return ConstResult_(kj::fwd(subParser), kj::fwd(result)); -} - -template -constexpr ConstResult_> discard(SubParser&& subParser) { - // Constructs a parser which wraps `subParser` but discards the result. - return constResult(kj::fwd(subParser), Tuple<>()); -} - -// ------------------------------------------------------------------- -// sequence() -// Output = Flattened Tuple of outputs of sub-parsers. - -template class Sequence_; - -template -class Sequence_ { -public: - template - explicit constexpr Sequence_(T&& firstSubParser, U&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - // TODO(msvc): The trailing return types on `operator()` and `parseNext()` expose at least two - // bugs in MSVC: - // - // 1. An ICE. - // 2. 'error C2672: 'operator __surrogate_func': no matching overloaded function found)', - // which crops up in numerous places when trying to build the capnp command line tools. - // - // The only workaround I found for both bugs is to omit the trailing return types and instead - // rely on C++14's return type deduction. - - template - auto operator()(Input& input) const -#ifndef _MSC_VER - -> Maybe>(), - instance>()...))> -#endif - { - return parseNext(input); - } - - template - auto parseNext(Input& input, InitialParams&&... initialParams) const -#ifndef _MSC_VER - -> Maybe(initialParams)..., - instance>(), - instance>()...))> -#endif - { - KJ_IF_MAYBE(firstResult, first(input)) { - return rest.parseNext(input, kj::fwd(initialParams)..., - kj::mv(*firstResult)); - } else { - // TODO(msvc): MSVC depends on return type deduction to compile this function, so we need to - // help it deduce the right type on this code path. - return Maybe(initialParams)..., - instance>(), - instance>()...))>{nullptr}; - } - } - -private: - FirstSubParser first; - Sequence_ rest; -}; - -template <> -class Sequence_<> { -public: - template - Maybe> operator()(Input& input) const { - return parseNext(input); - } - - template - auto parseNext(Input& input, Params&&... params) const -> - Maybe(params)...))> { - return tuple(kj::fwd(params)...); - } -}; - -template -constexpr Sequence_ sequence(SubParsers&&... subParsers) { - // Constructs a parser that executes each of the parameter parsers in sequence and returns a - // tuple of their results. - - return Sequence_(kj::fwd(subParsers)...); -} - -// ------------------------------------------------------------------- -// many() -// Output = Array of output of sub-parser, or just a uint count if the sub-parser returns Tuple<>. - -template -class Many_ { - template > - struct Impl; -public: - explicit constexpr Many_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)); - -private: - SubParser subParser; -}; - -template -template -struct Many_::Impl { - static Maybe> apply(const SubParser& subParser, Input& input) { - typedef Vector> Results; - Results results; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - results.add(kj::mv(*subResult)); - } else { - break; - } - } - - if (atLeastOne && results.empty()) { - return nullptr; - } - - return results.releaseAsArray(); - } -}; - -template -template -struct Many_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe apply(const SubParser& subParser, Input& input) { - uint count = 0; - - while (!input.atEnd()) { - Input subInput(input); - - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - ++count; - } else { - break; - } - } - - if (atLeastOne && count == 0) { - return nullptr; - } - - return count; - } -}; - -template -template -auto Many_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), input)) { - return Impl>::apply(subParser, input); -} - -template -constexpr Many_ many(SubParser&& subParser) { - // Constructs a parser that repeatedly executes the given parser until it fails, returning an - // Array of the results (or a uint count if `subParser` returns an empty tuple). - return Many_(kj::fwd(subParser)); -} - -template -constexpr Many_ oneOrMore(SubParser&& subParser) { - // Like `many()` but the parser must parse at least one item to be successful. - return Many_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// times() -// Output = Array of output of sub-parser, or Tuple<> if sub-parser returns Tuple<>. - -template -class Times_ { - template > - struct Impl; -public: - explicit constexpr Times_(SubParser&& subParser, uint count) - : subParser(kj::fwd(subParser)), count(count) {} - - template - auto operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)); - -private: - SubParser subParser; - uint count; -}; - -template -template -struct Times_::Impl { - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - auto results = heapArrayBuilder>(count); - - while (results.size() < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - results.add(kj::mv(*subResult)); - } else { - return nullptr; - } - } - - return results.finish(); - } -}; - -template -template -struct Times_::Impl> { - // If the sub-parser output is Tuple<>, just return a count. - - static Maybe> apply(const SubParser& subParser, uint count, Input& input) { - uint actualCount = 0; - - while (actualCount < count) { - if (input.atEnd()) { - return nullptr; - } else KJ_IF_MAYBE(subResult, subParser(input)) { - ++actualCount; - } else { - return nullptr; - } - } - - return tuple(); - } -}; - -template -template -auto Times_::operator()(Input& input) const - -> decltype(Impl::apply(instance(), instance(), input)) { - return Impl>::apply(subParser, count, input); -} - -template -constexpr Times_ times(SubParser&& subParser, uint count) { - // Constructs a parser that repeats the subParser exactly `count` times. - return Times_(kj::fwd(subParser), count); -} - -// ------------------------------------------------------------------- -// optional() -// Output = Maybe - -template -class Optional_ { -public: - explicit constexpr Optional_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe>> operator()(Input& input) const { - typedef Maybe> Result; - - Input subInput(input); - KJ_IF_MAYBE(subResult, subParser(subInput)) { - subInput.advanceParent(); - return Result(kj::mv(*subResult)); - } else { - return Result(nullptr); - } - } - -private: - SubParser subParser; -}; - -template -constexpr Optional_ optional(SubParser&& subParser) { - // Constructs a parser that accepts zero or one of the given sub-parser, returning a Maybe - // of the sub-parser's result. - return Optional_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// oneOf() -// All SubParsers must have same output type, which becomes the output type of the -// OneOfParser. - -template -class OneOf_; - -template -class OneOf_ { -public: - explicit constexpr OneOf_(FirstSubParser&& firstSubParser, SubParsers&&... rest) - : first(kj::fwd(firstSubParser)), rest(kj::fwd(rest)...) {} - - template - Maybe> operator()(Input& input) const { - { - Input subInput(input); - Maybe> firstResult = first(subInput); - - if (firstResult != nullptr) { - subInput.advanceParent(); - return kj::mv(firstResult); - } - } - - // Hoping for some tail recursion here... - return rest(input); - } - -private: - FirstSubParser first; - OneOf_ rest; -}; - -template <> -class OneOf_<> { -public: - template - decltype(nullptr) operator()(Input& input) const { - return nullptr; - } -}; - -template -constexpr OneOf_ oneOf(SubParsers&&... parsers) { - // Constructs a parser that accepts one of a set of options. The parser behaves as the first - // sub-parser in the list which returns successfully. All of the sub-parsers must return the - // same type. - return OneOf_(kj::fwd(parsers)...); -} - -// ------------------------------------------------------------------- -// transform() -// Output = Result of applying transform functor to input value. If input is a tuple, it is -// unpacked to form the transformation parameters. - -template -struct Span { -public: - inline const Position& begin() const { return begin_; } - inline const Position& end() const { return end_; } - - Span() = default; - inline constexpr Span(Position&& begin, Position&& end): begin_(mv(begin)), end_(mv(end)) {} - -private: - Position begin_; - Position end_; -}; - -template -constexpr Span> span(Position&& start, Position&& end) { - return Span>(kj::fwd(start), kj::fwd(end)); -} - -template -class Transform_ { -public: - explicit constexpr Transform_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance&&>()))> - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformOrReject_ { -public: - explicit constexpr TransformOrReject_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - decltype(kj::apply(instance(), instance&&>())) - operator()(Input& input) const { - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -class TransformWithLocation_ { -public: - explicit constexpr TransformWithLocation_(SubParser&& subParser, TransformFunc&& transform) - : subParser(kj::fwd(subParser)), transform(kj::fwd(transform)) {} - - template - Maybe(), - instance().getPosition())>>>(), - instance&&>()))> - operator()(Input& input) const { - auto start = input.getPosition(); - KJ_IF_MAYBE(subResult, subParser(input)) { - return kj::apply(transform, Span(kj::mv(start), input.getPosition()), - kj::mv(*subResult)); - } else { - return nullptr; - } - } - -private: - SubParser subParser; - TransformFunc transform; -}; - -template -constexpr Transform_ transform( - SubParser&& subParser, TransformFunc&& functor) { - // Constructs a parser which executes some other parser and then transforms the result by invoking - // `functor` on it. Typically `functor` is a lambda. It is invoked using `kj::apply`, - // meaning tuples will be unpacked as arguments. - return Transform_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformOrReject_ transformOrReject( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform()` except that `functor` returns a `Maybe`. If it returns null, parsing fails, - // otherwise the parser's result is the content of the `Maybe`. - return TransformOrReject_( - kj::fwd(subParser), kj::fwd(functor)); -} - -template -constexpr TransformWithLocation_ transformWithLocation( - SubParser&& subParser, TransformFunc&& functor) { - // Like `transform` except that `functor` also takes a `Span` as its first parameter specifying - // the location of the parsed content. The span's position type is whatever the parser input's - // getPosition() returns. - return TransformWithLocation_( - kj::fwd(subParser), kj::fwd(functor)); -} - -// ------------------------------------------------------------------- -// notLookingAt() -// Fails if the given parser succeeds at the current location. - -template -class NotLookingAt_ { -public: - explicit constexpr NotLookingAt_(SubParser&& subParser) - : subParser(kj::fwd(subParser)) {} - - template - Maybe> operator()(Input& input) const { - Input subInput(input); - subInput.forgetParent(); - if (subParser(subInput) == nullptr) { - return Tuple<>(); - } else { - return nullptr; - } - } - -private: - SubParser subParser; -}; - -template -constexpr NotLookingAt_ notLookingAt(SubParser&& subParser) { - // Constructs a parser which fails at any position where the given parser succeeds. Otherwise, - // it succeeds without consuming any input and returns an empty tuple. - return NotLookingAt_(kj::fwd(subParser)); -} - -// ------------------------------------------------------------------- -// endOfInput() -// Output = Tuple<>, only succeeds if at end-of-input - -class EndOfInput_ { -public: - template - Maybe> operator()(Input& input) const { - if (input.atEnd()) { - return Tuple<>(); - } else { - return nullptr; - } - } -}; - -constexpr EndOfInput_ endOfInput = EndOfInput_(); -// A parser that succeeds only if it is called with no input. - -} // namespace parse -} // namespace kj - -#endif // KJ_PARSE_COMMON_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/refcount.h b/phonelibs/capnp-cpp/mac/include/kj/refcount.h deleted file mode 100644 index a24e4bf5b9..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/refcount.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include "memory.h" - -#ifndef KJ_REFCOUNT_H_ -#define KJ_REFCOUNT_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -namespace kj { - -class Refcounted: private Disposer { - // Subclass this to create a class that contains a reference count. Then, use - // `kj::refcounted()` to allocate a new refcounted pointer. - // - // Do NOT use this lightly. Refcounting is a crutch. Good designs should strive to make object - // ownership clear, so that refcounting is not necessary. All that said, reference counting can - // sometimes simplify code that would otherwise become convoluted with explicit ownership, even - // when ownership relationships are clear at an abstract level. - // - // NOT THREADSAFE: This refcounting implementation assumes that an object's references are - // manipulated only in one thread, because atomic (thread-safe) refcounting is surprisingly slow. - // - // In general, abstract classes should _not_ subclass this. The concrete class at the bottom - // of the hierarchy should be the one to decide how it implements refcounting. Interfaces should - // expose only an `addRef()` method that returns `Own`. There are two reasons for - // this rule: - // 1. Interfaces would need to virtually inherit Refcounted, otherwise two refcounted interfaces - // could not be inherited by the same subclass. Virtual inheritance is awkward and - // inefficient. - // 2. An implementation may decide that it would rather return a copy than a refcount, or use - // some other strategy. - // - // TODO(cleanup): Rethink above. Virtual inheritance is not necessarily that bad. OTOH, a - // virtual function call for every refcount is sad in its own way. A Ref type to replace - // Own could also be nice. - -public: - virtual ~Refcounted() noexcept(false); - - inline bool isShared() const { return refcount > 1; } - // Check if there are multiple references to this object. This is sometimes useful for deciding - // whether it's safe to modify the object vs. make a copy. - -private: - mutable uint refcount = 0; - // "mutable" because disposeImpl() is const. Bleh. - - void disposeImpl(void* pointer) const override; - template - static Own addRefInternal(T* object); - - template - friend Own addRef(T& object); - template - friend Own refcounted(Params&&... params); -}; - -template -inline Own refcounted(Params&&... params) { - // Allocate a new refcounted instance of T, passing `params` to its constructor. Returns an - // initial reference to the object. More references can be created with `kj::addRef()`. - - return Refcounted::addRefInternal(new T(kj::fwd(params)...)); -} - -template -Own addRef(T& object) { - // Return a new reference to `object`, which must subclass Refcounted and have been allocated - // using `kj::refcounted<>()`. It is suggested that subclasses implement a non-static addRef() - // method which wraps this and returns the appropriate type. - - KJ_IREQUIRE(object.Refcounted::refcount > 0, "Object not allocated with kj::refcounted()."); - return Refcounted::addRefInternal(&object); -} - -template -Own Refcounted::addRefInternal(T* object) { - Refcounted* refcounted = object; - ++refcounted->refcount; - return Own(object, *refcounted); -} - -} // namespace kj - -#endif // KJ_REFCOUNT_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/std/iostream.h b/phonelibs/capnp-cpp/mac/include/kj/std/iostream.h deleted file mode 100644 index 627e0fcf86..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/std/iostream.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/* - * Compatibility layer for stdlib iostream - */ - -#ifndef KJ_STD_IOSTREAM_H_ -#define KJ_STD_IOSTREAM_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "../io.h" -#include - -namespace kj { -namespace std { - -class StdOutputStream: public kj::OutputStream { - -public: - explicit StdOutputStream(::std::ostream& stream) : stream_(stream) {} - ~StdOutputStream() noexcept(false) {} - - virtual void write(const void* src, size_t size) override { - // Always writes the full size. - - stream_.write((char*)src, size); - } - - virtual void write(ArrayPtr> pieces) override { - // Equivalent to write()ing each byte array in sequence, which is what the - // default implementation does. Override if you can do something better, - // e.g. use writev() to do the write in a single syscall. - - for (auto piece : pieces) { - write(piece.begin(), piece.size()); - } - } - -private: - ::std::ostream& stream_; - -}; - -class StdInputStream: public kj::InputStream { - -public: - explicit StdInputStream(::std::istream& stream) : stream_(stream) {} - ~StdInputStream() noexcept(false) {} - - virtual size_t tryRead( - void* buffer, size_t minBytes, size_t maxBytes) override { - // Like read(), but may return fewer than minBytes on EOF. - - stream_.read((char*)buffer, maxBytes); - return stream_.gcount(); - } - -private: - ::std::istream& stream_; - -}; - -} // namespace std -} // namespace kj - -#endif // KJ_STD_IOSTREAM_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/string-tree.h b/phonelibs/capnp-cpp/mac/include/kj/string-tree.h deleted file mode 100644 index 70a46319ef..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/string-tree.h +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_TREE_H_ -#define KJ_STRING_TREE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "string.h" - -namespace kj { - -class StringTree { - // A long string, represented internally as a tree of strings. This data structure is like a - // String, but optimized for concatenation and iteration at the expense of seek time. The - // structure is intended to be used for building large text blobs from many small pieces, where - // repeatedly concatenating smaller strings into larger ones would waste copies. This structure - // is NOT intended for use cases requiring random access or computing substrings. For those, - // you should use a Rope, which is a much more complicated data structure. - // - // The proper way to construct a StringTree is via kj::strTree(...), which works just like - // kj::str(...) but returns a StringTree rather than a String. - // - // KJ_STRINGIFY() functions that construct large strings from many smaller strings are encouraged - // to return StringTree rather than a flat char container. - -public: - inline StringTree(): size_(0) {} - inline StringTree(String&& text): size_(text.size()), text(kj::mv(text)) {} - - StringTree(Array&& pieces, StringPtr delim); - // Build a StringTree by concatenating the given pieces, delimited by the given delimiter - // (e.g. ", "). - - inline size_t size() const { return size_; } - - template - void visit(Func&& func) const; - - String flatten() const; - // Return the contents as a string. - - // TODO(someday): flatten() when *this is an rvalue and when branches.size() == 0 could simply - // return `kj::mv(text)`. Requires reference qualifiers (Clang 3.3 / GCC 4.8). - - void flattenTo(char* __restrict__ target) const; - // Copy the contents to the given character array. Does not add a NUL terminator. - -private: - size_t size_; - String text; - - struct Branch; - Array branches; // In order. - - inline void fill(char* pos, size_t branchIndex); - template - void fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, Array&& first, Rest&&... rest); - template - void fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest); - - template - static StringTree concat(Params&&... params); - static StringTree&& concat(StringTree&& param) { return kj::mv(param); } - - template - static inline size_t flatSize(const T& t) { return t.size(); } - static inline size_t flatSize(String&& s) { return 0; } - static inline size_t flatSize(StringTree&& s) { return 0; } - - template - static inline size_t branchCount(const T& t) { return 0; } - static inline size_t branchCount(String&& s) { return 1; } - static inline size_t branchCount(StringTree&& s) { return 1; } - - template - friend StringTree strTree(Params&&... params); -}; - -inline StringTree&& KJ_STRINGIFY(StringTree&& tree) { return kj::mv(tree); } -inline const StringTree& KJ_STRINGIFY(const StringTree& tree) { return tree; } - -inline StringTree KJ_STRINGIFY(Array&& trees) { return StringTree(kj::mv(trees), ""); } - -template -StringTree strTree(Params&&... params); -// Build a StringTree by stringifying the given parameters and concatenating the results. -// If any of the parameters stringify to StringTree rvalues, they will be incorporated as -// branches to avoid a copy. - -// ======================================================================================= -// Inline implementation details - -namespace _ { // private - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest) { - // Make str() work with stringifiers that return StringTree by patching fill(). - - first.flattenTo(target); - return fill(target + first.size(), kj::fwd(rest)...); -} - -template constexpr bool isStringTree() { return false; } -template <> constexpr bool isStringTree() { return true; } - -inline StringTree&& toStringTreeOrCharSequence(StringTree&& tree) { return kj::mv(tree); } -inline StringTree toStringTreeOrCharSequence(String&& str) { return StringTree(kj::mv(str)); } - -template -inline auto toStringTreeOrCharSequence(T&& value) - -> decltype(toCharSequence(kj::fwd(value))) { - static_assert(!isStringTree>(), - "When passing a StringTree into kj::strTree(), either pass it by rvalue " - "(use kj::mv(value)) or explicitly call value.flatten() to make a copy."); - - return toCharSequence(kj::fwd(value)); -} - -} // namespace _ (private) - -struct StringTree::Branch { - size_t index; - // Index in `text` where this branch should be inserted. - - StringTree content; -}; - -template -void StringTree::visit(Func&& func) const { - size_t pos = 0; - for (auto& branch: branches) { - if (branch.index > pos) { - func(text.slice(pos, branch.index)); - pos = branch.index; - } - branch.content.visit(func); - } - if (text.size() > pos) { - func(text.slice(pos, text.size())); - } -} - -inline void StringTree::fill(char* pos, size_t branchIndex) { - KJ_IREQUIRE(pos == text.end() && branchIndex == branches.size(), - kj::str(text.end() - pos, ' ', branches.size() - branchIndex).cStr()); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, First&& first, Rest&&... rest) { - pos = _::fill(pos, kj::fwd(first)); - fill(pos, branchIndex, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, StringTree&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = kj::mv(first); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -void StringTree::fill(char* pos, size_t branchIndex, String&& first, Rest&&... rest) { - branches[branchIndex].index = pos - text.begin(); - branches[branchIndex].content = StringTree(kj::mv(first)); - fill(pos, branchIndex + 1, kj::fwd(rest)...); -} - -template -StringTree StringTree::concat(Params&&... params) { - StringTree result; - result.size_ = _::sum({params.size()...}); - result.text = heapString( - _::sum({StringTree::flatSize(kj::fwd(params))...})); - result.branches = heapArray( - _::sum({StringTree::branchCount(kj::fwd(params))...})); - result.fill(result.text.begin(), 0, kj::fwd(params)...); - return result; -} - -template -StringTree strTree(Params&&... params) { - return StringTree::concat(_::toStringTreeOrCharSequence(kj::fwd(params))...); -} - -} // namespace kj - -#endif // KJ_STRING_TREE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/string.h b/phonelibs/capnp-cpp/mac/include/kj/string.h deleted file mode 100644 index 9048be2417..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/string.h +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_STRING_H_ -#define KJ_STRING_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include -#include "array.h" -#include - -namespace kj { - -class StringPtr; -class String; - -class StringTree; // string-tree.h - -// Our STL string SFINAE trick does not work with GCC 4.7, but it works with Clang and GCC 4.8, so -// we'll just preprocess it out if not supported. -#if __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || _MSC_VER -#define KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP 1 -#endif - -// ======================================================================================= -// StringPtr -- A NUL-terminated ArrayPtr containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. - -class StringPtr { -public: - inline StringPtr(): content("", 1) {} - inline StringPtr(decltype(nullptr)): content("", 1) {} - inline StringPtr(const char* value): content(value, strlen(value) + 1) {} - inline StringPtr(const char* value, size_t size): content(value, size + 1) { - KJ_IREQUIRE(value[size] == '\0', "StringPtr must be NUL-terminated."); - } - inline StringPtr(const char* begin, const char* end): StringPtr(begin, end - begin) {} - inline StringPtr(const String& value); - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP - template ().c_str())> - inline StringPtr(const T& t): StringPtr(t.c_str()) {} - // Allow implicit conversion from any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. - - template ().c_str())> - inline operator T() const { return cStr(); } - // Allow implicit conversion to any class that has a c_str() method (namely, std::string). - // We use a template trick to detect std::string in order to avoid including the header for - // those who don't want it. -#endif - - inline operator ArrayPtr() const; - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline const char* cStr() const { return content.begin(); } - // Returns NUL-terminated string. - - inline size_t size() const { return content.size() - 1; } - // Result does not include NUL terminator. - - inline char operator[](size_t index) const { return content[index]; } - - inline const char* begin() const { return content.begin(); } - inline const char* end() const { return content.end() - 1; } - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const; - inline bool operator!=(const StringPtr& other) const { return !(*this == other); } - inline bool operator< (const StringPtr& other) const; - inline bool operator> (const StringPtr& other) const { return other < *this; } - inline bool operator<=(const StringPtr& other) const { return !(other < *this); } - inline bool operator>=(const StringPtr& other) const { return !(*this < other); } - - inline StringPtr slice(size_t start) const; - inline ArrayPtr slice(size_t start, size_t end) const; - // A string slice is only NUL-terminated if it is a suffix, so slice() has a one-parameter - // version that assumes end = size(). - - inline bool startsWith(const StringPtr& other) const; - inline bool endsWith(const StringPtr& other) const; - - inline Maybe findFirst(char c) const; - inline Maybe findLast(char c) const; - - template - T parseAs() const; - // Parse string as template number type. - // Integer numbers prefixed by "0x" and "0X" are parsed in base 16 (like strtoi with base 0). - // Integer numbers prefixed by "0" are parsed in base 10 (unlike strtoi with base 0). - // Overflowed integer numbers throw exception. - // Overflowed floating numbers return inf. - -private: - inline StringPtr(ArrayPtr content): content(content) {} - - ArrayPtr content; -}; - -inline bool operator==(const char* a, const StringPtr& b) { return b == a; } -inline bool operator!=(const char* a, const StringPtr& b) { return b != a; } - -template <> char StringPtr::parseAs() const; -template <> signed char StringPtr::parseAs() const; -template <> unsigned char StringPtr::parseAs() const; -template <> short StringPtr::parseAs() const; -template <> unsigned short StringPtr::parseAs() const; -template <> int StringPtr::parseAs() const; -template <> unsigned StringPtr::parseAs() const; -template <> long StringPtr::parseAs() const; -template <> unsigned long StringPtr::parseAs() const; -template <> long long StringPtr::parseAs() const; -template <> unsigned long long StringPtr::parseAs() const; -template <> float StringPtr::parseAs() const; -template <> double StringPtr::parseAs() const; - -// ======================================================================================= -// String -- A NUL-terminated Array containing UTF-8 text. -// -// NUL bytes are allowed to appear before the end of the string. The only requirement is that -// a NUL byte appear immediately after the last byte of the content. This terminator byte is not -// counted in the string's size. -// -// To allocate a String, you must call kj::heapString(). We do not implement implicit copying to -// the heap because this hides potential inefficiency from the developer. - -class String { -public: - String() = default; - inline String(decltype(nullptr)): content(nullptr) {} - inline String(char* value, size_t size, const ArrayDisposer& disposer); - // Does not copy. `size` does not include NUL terminator, but `value` must be NUL-terminated. - inline explicit String(Array buffer); - // Does not copy. Requires `buffer` ends with `\0`. - - inline operator ArrayPtr(); - inline operator ArrayPtr() const; - inline ArrayPtr asArray(); - inline ArrayPtr asArray() const; - inline ArrayPtr asBytes() { return asArray().asBytes(); } - inline ArrayPtr asBytes() const { return asArray().asBytes(); } - // Result does not include NUL terminator. - - inline Array releaseArray() { return kj::mv(content); } - // Disowns the backing array (which includes the NUL terminator) and returns it. The String value - // is clobbered (as if moved away). - - inline const char* cStr() const; - - inline size_t size() const; - // Result does not include NUL terminator. - - inline char operator[](size_t index) const; - inline char& operator[](size_t index); - - inline char* begin(); - inline char* end(); - inline const char* begin() const; - inline const char* end() const; - - inline bool operator==(decltype(nullptr)) const { return content.size() <= 1; } - inline bool operator!=(decltype(nullptr)) const { return content.size() > 1; } - - inline bool operator==(const StringPtr& other) const { return StringPtr(*this) == other; } - inline bool operator!=(const StringPtr& other) const { return StringPtr(*this) != other; } - inline bool operator< (const StringPtr& other) const { return StringPtr(*this) < other; } - inline bool operator> (const StringPtr& other) const { return StringPtr(*this) > other; } - inline bool operator<=(const StringPtr& other) const { return StringPtr(*this) <= other; } - inline bool operator>=(const StringPtr& other) const { return StringPtr(*this) >= other; } - - inline bool startsWith(const StringPtr& other) const { return StringPtr(*this).startsWith(other);} - inline bool endsWith(const StringPtr& other) const { return StringPtr(*this).endsWith(other); } - - inline StringPtr slice(size_t start) const { return StringPtr(*this).slice(start); } - inline ArrayPtr slice(size_t start, size_t end) const { - return StringPtr(*this).slice(start, end); - } - - inline Maybe findFirst(char c) const { return StringPtr(*this).findFirst(c); } - inline Maybe findLast(char c) const { return StringPtr(*this).findLast(c); } - - template - T parseAs() const { return StringPtr(*this).parseAs(); } - // Parse as number - -private: - Array content; -}; - -inline bool operator==(const char* a, const String& b) { return b == a; } -inline bool operator!=(const char* a, const String& b) { return b != a; } - -String heapString(size_t size); -// Allocate a String of the given size on the heap, not including NUL terminator. The NUL -// terminator will be initialized automatically but the rest of the content is not initialized. - -String heapString(const char* value); -String heapString(const char* value, size_t size); -String heapString(StringPtr value); -String heapString(const String& value); -String heapString(ArrayPtr value); -// Allocates a copy of the given value on the heap. - -// ======================================================================================= -// Magic str() function which transforms parameters to text and concatenates them into one big -// String. - -namespace _ { // private - -inline size_t sum(std::initializer_list nums) { - size_t result = 0; - for (auto num: nums) { - result += num; - } - return result; -} - -inline char* fill(char* ptr) { return ptr; } - -template -char* fill(char* __restrict__ target, const StringTree& first, Rest&&... rest); -// Make str() work with stringifiers that return StringTree by patching fill(). -// -// Defined in string-tree.h. - -template -char* fill(char* __restrict__ target, const First& first, Rest&&... rest) { - auto i = first.begin(); - auto end = first.end(); - while (i != end) { - *target++ = *i++; - } - return fill(target, kj::fwd(rest)...); -} - -template -String concat(Params&&... params) { - // Concatenate a bunch of containers into a single Array. The containers can be anything that - // is iterable and whose elements can be converted to `char`. - - String result = heapString(sum({params.size()...})); - fill(result.begin(), kj::fwd(params)...); - return result; -} - -inline String concat(String&& arr) { - return kj::mv(arr); -} - -struct Stringifier { - // This is a dummy type with only one instance: STR (below). To make an arbitrary type - // stringifiable, define `operator*(Stringifier, T)` to return an iterable container of `char`. - // The container type must have a `size()` method. Be sure to declare the operator in the same - // namespace as `T` **or** in the global scope. - // - // A more usual way to accomplish what we're doing here would be to require that you define - // a function like `toString(T)` and then rely on argument-dependent lookup. However, this has - // the problem that it pollutes other people's namespaces and even the global namespace. For - // example, some other project may already have functions called `toString` which do something - // different. Declaring `operator*` with `Stringifier` as the left operand cannot conflict with - // anything. - - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(ArrayPtr s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - inline ArrayPtr operator*(const Array& s) const { return s; } - template - inline ArrayPtr operator*(const CappedArray& s) const { return s; } - template - inline ArrayPtr operator*(const FixedArray& s) const { return s; } - inline ArrayPtr operator*(const char* s) const { return arrayPtr(s, strlen(s)); } - inline ArrayPtr operator*(const String& s) const { return s.asArray(); } - inline ArrayPtr operator*(const StringPtr& s) const { return s.asArray(); } - - inline Range operator*(const Range& r) const { return r; } - inline Repeat operator*(const Repeat& r) const { return r; } - - inline FixedArray operator*(char c) const { - FixedArray result; - result[0] = c; - return result; - } - - StringPtr operator*(decltype(nullptr)) const; - StringPtr operator*(bool b) const; - - CappedArray operator*(signed char i) const; - CappedArray operator*(unsigned char i) const; - CappedArray operator*(short i) const; - CappedArray operator*(unsigned short i) const; - CappedArray operator*(int i) const; - CappedArray operator*(unsigned int i) const; - CappedArray operator*(long i) const; - CappedArray operator*(unsigned long i) const; - CappedArray operator*(long long i) const; - CappedArray operator*(unsigned long long i) const; - CappedArray operator*(float f) const; - CappedArray operator*(double f) const; - CappedArray operator*(const void* s) const; - - template - String operator*(ArrayPtr arr) const; - template - String operator*(const Array& arr) const; - -#if KJ_COMPILER_SUPPORTS_STL_STRING_INTEROP // supports expression SFINAE? - template ().toString())> - inline Result operator*(T&& value) const { return kj::fwd(value).toString(); } -#endif -}; -static KJ_CONSTEXPR(const) Stringifier STR = Stringifier(); - -} // namespace _ (private) - -template -auto toCharSequence(T&& value) -> decltype(_::STR * kj::fwd(value)) { - // Returns an iterable of chars that represent a textual representation of the value, suitable - // for debugging. - // - // Most users should use str() instead, but toCharSequence() may occasionally be useful to avoid - // heap allocation overhead that str() implies. - // - // To specialize this function for your type, see KJ_STRINGIFY. - - return _::STR * kj::fwd(value); -} - -CappedArray hex(unsigned char i); -CappedArray hex(unsigned short i); -CappedArray hex(unsigned int i); -CappedArray hex(unsigned long i); -CappedArray hex(unsigned long long i); - -template -String str(Params&&... params) { - // Magic function which builds a string from a bunch of arbitrary values. Example: - // str(1, " / ", 2, " = ", 0.5) - // returns: - // "1 / 2 = 0.5" - // To teach `str` how to stringify a type, see `Stringifier`. - - return _::concat(toCharSequence(kj::fwd(params))...); -} - -inline String str(String&& s) { return mv(s); } -// Overload to prevent redundant allocation. - -template -String strArray(T&& arr, const char* delim) { - size_t delimLen = strlen(delim); - KJ_STACK_ARRAY(decltype(_::STR * arr[0]), pieces, kj::size(arr), 8, 32); - size_t size = 0; - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) size += delimLen; - pieces[i] = _::STR * arr[i]; - size += pieces[i].size(); - } - - String result = heapString(size); - char* pos = result.begin(); - for (size_t i = 0; i < kj::size(arr); i++) { - if (i > 0) { - memcpy(pos, delim, delimLen); - pos += delimLen; - } - pos = _::fill(pos, pieces[i]); - } - return result; -} - -namespace _ { // private - -template -inline String Stringifier::operator*(ArrayPtr arr) const { - return strArray(arr, ", "); -} - -template -inline String Stringifier::operator*(const Array& arr) const { - return strArray(arr, ", "); -} - -} // namespace _ (private) - -#define KJ_STRINGIFY(...) operator*(::kj::_::Stringifier, __VA_ARGS__) -// Defines a stringifier for a custom type. Example: -// -// class Foo {...}; -// inline StringPtr KJ_STRINGIFY(const Foo& foo) { return foo.name(); } -// -// This allows Foo to be passed to str(). -// -// The function should be declared either in the same namespace as the target type or in the global -// namespace. It can return any type which is an iterable container of chars. - -// ======================================================================================= -// Inline implementation details. - -inline StringPtr::StringPtr(const String& value): content(value.begin(), value.size() + 1) {} - -inline StringPtr::operator ArrayPtr() const { - return content.slice(0, content.size() - 1); -} - -inline ArrayPtr StringPtr::asArray() const { - return content.slice(0, content.size() - 1); -} - -inline bool StringPtr::operator==(const StringPtr& other) const { - return content.size() == other.content.size() && - memcmp(content.begin(), other.content.begin(), content.size() - 1) == 0; -} - -inline bool StringPtr::operator<(const StringPtr& other) const { - bool shorter = content.size() < other.content.size(); - int cmp = memcmp(content.begin(), other.content.begin(), - shorter ? content.size() : other.content.size()); - return cmp < 0 || (cmp == 0 && shorter); -} - -inline StringPtr StringPtr::slice(size_t start) const { - return StringPtr(content.slice(start, content.size())); -} -inline ArrayPtr StringPtr::slice(size_t start, size_t end) const { - return content.slice(start, end); -} - -inline bool StringPtr::startsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(content.begin(), other.content.begin(), other.size()) == 0; -} -inline bool StringPtr::endsWith(const StringPtr& other) const { - return other.content.size() <= content.size() && - memcmp(end() - other.size(), other.content.begin(), other.size()) == 0; -} - -inline Maybe StringPtr::findFirst(char c) const { - const char* pos = reinterpret_cast(memchr(content.begin(), c, size())); - if (pos == nullptr) { - return nullptr; - } else { - return pos - content.begin(); - } -} - -inline Maybe StringPtr::findLast(char c) const { - for (size_t i = size(); i > 0; --i) { - if (content[i-1] == c) { - return i-1; - } - } - return nullptr; -} - -inline String::operator ArrayPtr() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline String::operator ArrayPtr() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline ArrayPtr String::asArray() { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} -inline ArrayPtr String::asArray() const { - return content == nullptr ? ArrayPtr(nullptr) : content.slice(0, content.size() - 1); -} - -inline const char* String::cStr() const { return content == nullptr ? "" : content.begin(); } - -inline size_t String::size() const { return content == nullptr ? 0 : content.size() - 1; } - -inline char String::operator[](size_t index) const { return content[index]; } -inline char& String::operator[](size_t index) { return content[index]; } - -inline char* String::begin() { return content == nullptr ? nullptr : content.begin(); } -inline char* String::end() { return content == nullptr ? nullptr : content.end() - 1; } -inline const char* String::begin() const { return content == nullptr ? nullptr : content.begin(); } -inline const char* String::end() const { return content == nullptr ? nullptr : content.end() - 1; } - -inline String::String(char* value, size_t size, const ArrayDisposer& disposer) - : content(value, size + 1, disposer) { - KJ_IREQUIRE(value[size] == '\0', "String must be NUL-terminated."); -} - -inline String::String(Array buffer): content(kj::mv(buffer)) { - KJ_IREQUIRE(content.size() > 0 && content.back() == '\0', "String must be NUL-terminated."); -} - -inline String heapString(const char* value) { - return heapString(value, strlen(value)); -} -inline String heapString(StringPtr value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(const String& value) { - return heapString(value.begin(), value.size()); -} -inline String heapString(ArrayPtr value) { - return heapString(value.begin(), value.size()); -} - -} // namespace kj - -#endif // KJ_STRING_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/test.h b/phonelibs/capnp-cpp/mac/include/kj/test.h deleted file mode 100644 index 69e1c80840..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/test.h +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TEST_H_ -#define KJ_TEST_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "debug.h" -#include "vector.h" -#include "function.h" - -namespace kj { - -class TestRunner; - -class TestCase { -public: - TestCase(const char* file, uint line, const char* description); - ~TestCase(); - - virtual void run() = 0; - -private: - const char* file; - uint line; - const char* description; - TestCase* next; - TestCase** prev; - bool matchedFilter; - - friend class TestRunner; -}; - -#define KJ_TEST(description) \ - /* Make sure the linker fails if tests are not in anonymous namespaces. */ \ - extern int KJ_CONCAT(YouMustWrapTestsInAnonymousNamespace, __COUNTER__) KJ_UNUSED; \ - class KJ_UNIQUE_NAME(TestCase): public ::kj::TestCase { \ - public: \ - KJ_UNIQUE_NAME(TestCase)(): ::kj::TestCase(__FILE__, __LINE__, description) {} \ - void run() override; \ - } KJ_UNIQUE_NAME(testCase); \ - void KJ_UNIQUE_NAME(TestCase)::run() - -#if _MSC_VER -#define KJ_INDIRECT_EXPAND(m, vargs) m vargs -#define KJ_FAIL_EXPECT(...) \ - KJ_INDIRECT_EXPAND(KJ_LOG, (ERROR , __VA_ARGS__)); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_INDIRECT_EXPAND(KJ_FAIL_EXPECT, ("failed: expected " #cond , __VA_ARGS__)) -#else -#define KJ_FAIL_EXPECT(...) \ - KJ_LOG(ERROR, ##__VA_ARGS__); -#define KJ_EXPECT(cond, ...) \ - if (cond); else KJ_FAIL_EXPECT("failed: expected " #cond, ##__VA_ARGS__) -#endif - -#define KJ_EXPECT_THROW_RECOVERABLE(type, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(e->getType() == ::kj::Exception::Type::type, \ - "code threw wrong exception type: " #code, e->getType()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#define KJ_EXPECT_THROW_RECOVERABLE_MESSAGE(message, code) \ - do { \ - KJ_IF_MAYBE(e, ::kj::runCatchingExceptions([&]() { code; })) { \ - KJ_EXPECT(::kj::_::hasSubstring(e->getDescription(), message), \ - "exception description didn't contain expected substring", e->getDescription()); \ - } else { \ - KJ_FAIL_EXPECT("code did not throw: " #code); \ - } \ - } while (false) - -#if KJ_NO_EXCEPTIONS -#define KJ_EXPECT_THROW(type, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(type, nullptr, [&]() { code; })); \ - } while (false) -#define KJ_EXPECT_THROW_MESSAGE(message, code) \ - do { \ - KJ_EXPECT(::kj::_::expectFatalThrow(nullptr, kj::StringPtr(message), [&]() { code; })); \ - } while (false) -#else -#define KJ_EXPECT_THROW KJ_EXPECT_THROW_RECOVERABLE -#define KJ_EXPECT_THROW_MESSAGE KJ_EXPECT_THROW_RECOVERABLE_MESSAGE -#endif - -#define KJ_EXPECT_LOG(level, substring) \ - ::kj::_::LogExpectation KJ_UNIQUE_NAME(_kjLogExpectation)(::kj::LogSeverity::level, substring) -// Expects that a log message with the given level and substring text will be printed within -// the current scope. This message will not cause the test to fail, even if it is an error. - -// ======================================================================================= - -namespace _ { // private - -bool hasSubstring(kj::StringPtr haystack, kj::StringPtr needle); - -#if KJ_NO_EXCEPTIONS -bool expectFatalThrow(Maybe type, Maybe message, - Function code); -// Expects that the given code will throw a fatal exception matching the given type and/or message. -// Since exceptions are disabled, the test will fork() and run in a subprocess. On Windows, where -// fork() is not available, this always returns true. -#endif - -class LogExpectation: public ExceptionCallback { -public: - LogExpectation(LogSeverity severity, StringPtr substring); - ~LogExpectation(); - - void logMessage(LogSeverity severity, const char* file, int line, int contextDepth, - String&& text) override; - -private: - LogSeverity severity; - StringPtr substring; - bool seen; - UnwindDetector unwindDetector; -}; - -class GlobFilter { - // Implements glob filters for the --filter flag. - // - // Exposed in header only for testing. - -public: - explicit GlobFilter(const char* pattern); - explicit GlobFilter(ArrayPtr pattern); - - bool matches(StringPtr name); - -private: - String pattern; - Vector states; - - void applyState(char c, int state); -}; - -} // namespace _ (private) -} // namespace kj - -#endif // KJ_TEST_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/thread.h b/phonelibs/capnp-cpp/mac/include/kj/thread.h deleted file mode 100644 index b17b88c520..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/thread.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREAD_H_ -#define KJ_THREAD_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include "function.h" -#include "exception.h" - -namespace kj { - -class Thread { - // A thread! Pass a lambda to the constructor, and it runs in the thread. The destructor joins - // the thread. If the function throws an exception, it is rethrown from the thread's destructor - // (if not unwinding from another exception). - -public: - explicit Thread(Function func); - KJ_DISALLOW_COPY(Thread); - - ~Thread() noexcept(false); - -#if !_WIN32 - void sendSignal(int signo); - // Send a Unix signal to the given thread, using pthread_kill or an equivalent. -#endif - - void detach(); - // Don't join the thread in ~Thread(). - -private: - struct ThreadState { - Function func; - kj::Maybe exception; - - unsigned int refcount; - // Owned by the parent thread and the child thread. - - void unref(); - }; - ThreadState* state; - -#if _WIN32 - void* threadHandle; -#else - unsigned long long threadId; // actually pthread_t -#endif - bool detached = false; - -#if _WIN32 - static unsigned long __stdcall runThread(void* ptr); -#else - static void* runThread(void* ptr); -#endif -}; - -} // namespace kj - -#endif // KJ_THREAD_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/threadlocal.h b/phonelibs/capnp-cpp/mac/include/kj/threadlocal.h deleted file mode 100644 index 67d0db60ef..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/threadlocal.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014, Jason Choy -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_THREADLOCAL_H_ -#define KJ_THREADLOCAL_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif -// This file declares a macro `KJ_THREADLOCAL_PTR` for declaring thread-local pointer-typed -// variables. Use like: -// KJ_THREADLOCAL_PTR(MyType) foo = nullptr; -// This is equivalent to: -// thread_local MyType* foo = nullptr; -// This can only be used at the global scope. -// -// AVOID USING THIS. Use of thread-locals is discouraged because they often have many of the same -// properties as singletons: http://www.object-oriented-security.org/lets-argue/singletons -// -// Also, thread-locals tend to be hostile to event-driven code, which can be particularly -// surprising when using fibers (all fibers in the same thread will share the same threadlocals, -// even though they do not share a stack). -// -// That said, thread-locals are sometimes needed for runtime logistics in the KJ framework. For -// example, the current exception callback and current EventLoop are stored as thread-local -// pointers. Since KJ only ever needs to store pointers, not values, we avoid the question of -// whether these values' destructors need to be run, and we avoid the need for heap allocation. - -#include "common.h" - -#if !defined(KJ_USE_PTHREAD_THREADLOCAL) && defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -// iOS apparently does not support __thread (nor C++11 thread_local). -#define KJ_USE_PTHREAD_TLS 1 -#endif -#endif - -#if KJ_USE_PTHREAD_TLS -#include -#endif - -namespace kj { - -#if KJ_USE_PTHREAD_TLS -// If __thread is unavailable, we'll fall back to pthreads. - -#define KJ_THREADLOCAL_PTR(type) \ - namespace { struct KJ_UNIQUE_NAME(_kj_TlpTag); } \ - static ::kj::_::ThreadLocalPtr< type, KJ_UNIQUE_NAME(_kj_TlpTag)> -// Hack: In order to ensure each thread-local results in a unique template instance, we declare -// a one-off dummy type to use as the second type parameter. - -namespace _ { // private - -template -class ThreadLocalPtr { - // Hacky type to emulate __thread T*. We need a separate instance of the ThreadLocalPtr template - // for every thread-local variable, because we don't want to require a global constructor, and in - // order to initialize the TLS on first use we need to use a local static variable (in getKey()). - // Each template instance will get a separate such local static variable, fulfilling our need. - -public: - ThreadLocalPtr() = default; - constexpr ThreadLocalPtr(decltype(nullptr)) {} - // Allow initialization to nullptr without a global constructor. - - inline ThreadLocalPtr& operator=(T* val) { - pthread_setspecific(getKey(), val); - return *this; - } - - inline operator T*() const { - return get(); - } - - inline T& operator*() const { - return *get(); - } - - inline T* operator->() const { - return get(); - } - -private: - inline T* get() const { - return reinterpret_cast(pthread_getspecific(getKey())); - } - - inline static pthread_key_t getKey() { - static pthread_key_t key = createKey(); - return key; - } - - static pthread_key_t createKey() { - pthread_key_t key; - pthread_key_create(&key, 0); - return key; - } -}; - -} // namespace _ (private) - -#elif __GNUC__ - -#define KJ_THREADLOCAL_PTR(type) static __thread type* -// GCC's __thread is lighter-weight than thread_local and is good enough for our purposes. - -#else - -#define KJ_THREADLOCAL_PTR(type) static thread_local type* - -#endif // KJ_USE_PTHREAD_TLS - -} // namespace kj - -#endif // KJ_THREADLOCAL_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/time.h b/phonelibs/capnp-cpp/mac/include/kj/time.h deleted file mode 100644 index 37d7b8a90e..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/time.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2014 Google Inc. (contributed by Remy Blank ) -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_TIME_H_ -#define KJ_TIME_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "async.h" -#include "units.h" -#include - -namespace kj { -namespace _ { // private - -class NanosecondLabel; -class TimeLabel; -class DateLabel; - -} // namespace _ (private) - -using Duration = Quantity; -// A time value, in nanoseconds. - -constexpr Duration NANOSECONDS = unit(); -constexpr Duration MICROSECONDS = 1000 * NANOSECONDS; -constexpr Duration MILLISECONDS = 1000 * MICROSECONDS; -constexpr Duration SECONDS = 1000 * MILLISECONDS; -constexpr Duration MINUTES = 60 * SECONDS; -constexpr Duration HOURS = 60 * MINUTES; -constexpr Duration DAYS = 24 * HOURS; - -using TimePoint = Absolute; -// An absolute time measured by some particular instance of `Timer`. `Time`s from two different -// `Timer`s may be measured from different origins and so are not necessarily compatible. - -using Date = Absolute; -// A point in real-world time, measured relative to the Unix epoch (Jan 1, 1970 00:00:00 UTC). - -constexpr Date UNIX_EPOCH = origin(); -// The `Date` representing Jan 1, 1970 00:00:00 UTC. - -class Clock { - // Interface to read the current date and time. -public: - virtual Date now() = 0; -}; - -Clock& nullClock(); -// A clock which always returns UNIX_EPOCH as the current time. Useful when you don't care about -// time. - -class Timer { - // Interface to time and timer functionality. - // - // Each `Timer` may have a different origin, and some `Timer`s may in fact tick at a different - // rate than real time (e.g. a `Timer` could represent CPU time consumed by a thread). However, - // all `Timer`s are monotonic: time will never appear to move backwards, even if the calendar - // date as tracked by the system is manually modified. - -public: - virtual TimePoint now() = 0; - // Returns the current value of a clock that moves steadily forward, independent of any - // changes in the wall clock. The value is updated every time the event loop waits, - // and is constant in-between waits. - - virtual Promise atTime(TimePoint time) = 0; - // Returns a promise that returns as soon as now() >= time. - - virtual Promise afterDelay(Duration delay) = 0; - // Equivalent to atTime(now() + delay). - - template - Promise timeoutAt(TimePoint time, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed by `time`. The thrown exception is of type - // "OVERLOADED". - - template - Promise timeoutAfter(Duration delay, Promise&& promise) KJ_WARN_UNUSED_RESULT; - // Return a promise equivalent to `promise` but which throws an exception (and cancels the - // original promise) if it hasn't completed after `delay` from now. The thrown exception is of - // type "OVERLOADED". - -private: - static kj::Exception makeTimeoutException(); -}; - -class TimerImpl final: public Timer { - // Implementation of Timer that expects an external caller -- usually, the EventPort - // implementation -- to tell it when time has advanced. - -public: - TimerImpl(TimePoint startTime); - ~TimerImpl() noexcept(false); - - Maybe nextEvent(); - // Returns the time at which the next scheduled timer event will occur, or null if no timer - // events are scheduled. - - Maybe timeoutToNextEvent(TimePoint start, Duration unit, uint64_t max); - // Convenience method which computes a timeout value to pass to an event-waiting system call to - // cause it to time out when the next timer event occurs. - // - // `start` is the time at which the timeout starts counting. This is typically not the same as - // now() since some time may have passed since the last time advanceTo() was called. - // - // `unit` is the time unit in which the timeout is measured. This is often MILLISECONDS. Note - // that this method will fractional values *up*, to guarantee that the returned timeout waits - // until just *after* the time the event is scheduled. - // - // The timeout will be clamped to `max`. Use this to avoid an overflow if e.g. the OS wants a - // 32-bit value or a signed value. - // - // Returns nullptr if there are no future events. - - void advanceTo(TimePoint newTime); - // Set the time to `time` and fire any at() events that have been passed. - - // implements Timer ---------------------------------------------------------- - TimePoint now() override; - Promise atTime(TimePoint time) override; - Promise afterDelay(Duration delay) override; - -private: - struct Impl; - class TimerPromiseAdapter; - TimePoint time; - Own impl; -}; - -// ======================================================================================= -// inline implementation details - -template -Promise Timer::timeoutAt(TimePoint time, Promise&& promise) { - return promise.exclusiveJoin(atTime(time).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -template -Promise Timer::timeoutAfter(Duration delay, Promise&& promise) { - return promise.exclusiveJoin(afterDelay(delay).then([]() -> kj::Promise { - return makeTimeoutException(); - })); -} - -inline TimePoint TimerImpl::now() { return time; } - -} // namespace kj - -#endif // KJ_TIME_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/tuple.h b/phonelibs/capnp-cpp/mac/include/kj/tuple.h deleted file mode 100644 index 2ea7276ec5..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/tuple.h +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file defines a notion of tuples that is simpler that `std::tuple`. It works as follows: -// - `kj::Tuple is the type of a tuple of an A, a B, and a C. -// - `kj::tuple(a, b, c)` returns a tuple containing a, b, and c. If any of these are themselves -// tuples, they are flattened, so `tuple(a, tuple(b, c), d)` is equivalent to `tuple(a, b, c, d)`. -// - `kj::get(myTuple)` returns the element of `myTuple` at index n. -// - `kj::apply(func, ...)` calls func on the following arguments after first expanding any tuples -// in the argument list. So `kj::apply(foo, a, tuple(b, c), d)` would call `foo(a, b, c, d)`. -// -// Note that: -// - The type `Tuple` is a synonym for T. This is why `get` and `apply` are not members of the -// type. -// - It is illegal for an element of `Tuple` to itself be a tuple, as tuples are meant to be -// flattened. -// - It is illegal for an element of `Tuple` to be a reference, due to problems this would cause -// with type inference and `tuple()`. - -#ifndef KJ_TUPLE_H_ -#define KJ_TUPLE_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" - -namespace kj { -namespace _ { // private - -template -struct TypeByIndex_; -template -struct TypeByIndex_<0, First, Rest...> { - typedef First Type; -}; -template -struct TypeByIndex_ - : public TypeByIndex_ {}; -template -struct TypeByIndex_ { - static_assert(index != index, "Index out-of-range."); -}; -template -using TypeByIndex = typename TypeByIndex_::Type; -// Chose a particular type out of a list of types, by index. - -template -struct Indexes {}; -// Dummy helper type that just encapsulates a sequential list of indexes, so that we can match -// templates against them and unpack them with '...'. - -template -struct MakeIndexes_: public MakeIndexes_ {}; -template -struct MakeIndexes_<0, prefix...> { - typedef Indexes Type; -}; -template -using MakeIndexes = typename MakeIndexes_::Type; -// Equivalent to Indexes<0, 1, 2, ..., end>. - -template -class Tuple; -template -inline TypeByIndex& getImpl(Tuple& tuple); -template -inline TypeByIndex&& getImpl(Tuple&& tuple); -template -inline const TypeByIndex& getImpl(const Tuple& tuple); - -template -struct TupleElement { - // Encapsulates one element of a tuple. The actual tuple implementation multiply-inherits - // from a TupleElement for each element, which is more efficient than a recursive definition. - - T value; - TupleElement() = default; - constexpr inline TupleElement(const T& value): value(value) {} - constexpr inline TupleElement(T&& value): value(kj::mv(value)) {} -}; - -template -struct TupleElement { - // If tuples contained references, one of the following would have to be true: - // - `auto x = tuple(y, z)` would cause x to be a tuple of references to y and z, which is - // probably not what you expected. - // - `Tuple x = tuple(a, b)` would not work, because `tuple()` returned - // Tuple. - static_assert(sizeof(T*) == 0, "Sorry, tuples cannot contain references."); -}; - -template -struct TupleElement> { - static_assert(sizeof(Tuple*) == 0, - "Tuples cannot contain other tuples -- they should be flattened."); -}; - -template -struct TupleImpl; - -template -struct TupleImpl, Types...> - : public TupleElement... { - // Implementation of Tuple. The only reason we need this rather than rolling this into class - // Tuple (below) is so that we can get "indexes" as an unpackable list. - - static_assert(sizeof...(indexes) == sizeof...(Types), "Incorrect use of TupleImpl."); - - template - inline TupleImpl(Params&&... params) - : TupleElement(kj::fwd(params))... { - // Work around Clang 3.2 bug 16303 where this is not detected. (Unfortunately, Clang sometimes - // segfaults instead.) - static_assert(sizeof...(params) == sizeof...(indexes), - "Wrong number of parameters to Tuple constructor."); - } - - template - constexpr inline TupleImpl(Tuple&& other) - : TupleElement(kj::mv(getImpl(other)))... {} - template - constexpr inline TupleImpl(Tuple& other) - : TupleElement(getImpl(other))... {} - template - constexpr inline TupleImpl(const Tuple& other) - : TupleElement(getImpl(other))... {} -}; - -struct MakeTupleFunc; - -template -class Tuple { - // The actual Tuple class (used for tuples of size other than 1). - -public: - template - constexpr inline Tuple(Tuple&& other): impl(kj::mv(other)) {} - template - constexpr inline Tuple(Tuple& other): impl(other) {} - template - constexpr inline Tuple(const Tuple& other): impl(other) {} - -private: - template - constexpr Tuple(Params&&... params): impl(kj::fwd(params)...) {} - - TupleImpl, T...> impl; - - template - friend inline TypeByIndex& getImpl(Tuple& tuple); - template - friend inline TypeByIndex&& getImpl(Tuple&& tuple); - template - friend inline const TypeByIndex& getImpl(const Tuple& tuple); - friend struct MakeTupleFunc; -}; - -template <> -class Tuple<> { - // Simplified zero-member version of Tuple. In particular this is important to make sure that - // Tuple<>() is constexpr. -}; - -template -class Tuple; -// Single-element tuple should never be used. The public API should ensure this. - -template -inline TypeByIndex& getImpl(Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline TypeByIndex&& getImpl(Tuple&& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return kj::mv(implicitCast>&>(tuple.impl).value); -} -template -inline const TypeByIndex& getImpl(const Tuple& tuple) { - // Get member of a Tuple by index, e.g. `get<2>(myTuple)`. - static_assert(index < sizeof...(T), "Tuple element index out-of-bounds."); - return implicitCast>&>(tuple.impl).value; -} -template -inline T&& getImpl(T&& value) { - // Get member of a Tuple by index, e.g. `getImpl<2>(myTuple)`. - - // Non-tuples are equivalent to one-element tuples. - static_assert(index == 0, "Tuple element index out-of-bounds."); - return kj::fwd(value); -} - - -template -struct ExpandAndApplyResult_; -// Template which computes the return type of applying Func to T... after flattening tuples. -// SoFar starts as Tuple<> and accumulates the flattened parameter types -- so after this template -// is recursively expanded, T... is empty and SoFar is a Tuple containing all the parameters. - -template -struct ExpandAndApplyResult_, First, Rest...> - : public ExpandAndApplyResult_, Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple, Rest...> - : public ExpandAndApplyResult_, FirstTypes&&..., Rest...> {}; -template -struct ExpandAndApplyResult_, Tuple&, Rest...> - : public ExpandAndApplyResult_, FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_, const Tuple&, Rest...> - : public ExpandAndApplyResult_, const FirstTypes&..., Rest...> {}; -template -struct ExpandAndApplyResult_> { - typedef decltype(instance()(instance()...)) Type; -}; -template -using ExpandAndApplyResult = typename ExpandAndApplyResult_, T...>::Type; -// Computes the expected return type of `expandAndApply()`. - -template -inline auto expandAndApply(Func&& func) -> ExpandAndApplyResult { - return func(); -} - -template -struct ExpandAndApplyFunc { - Func&& func; - First&& first; - ExpandAndApplyFunc(Func&& func, First&& first) - : func(kj::fwd(func)), first(kj::fwd(first)) {} - template - auto operator()(T&&... params) - -> decltype(this->func(kj::fwd(first), kj::fwd(params)...)) { - return this->func(kj::fwd(first), kj::fwd(params)...); - } -}; - -template -inline auto expandAndApply(Func&& func, First&& first, Rest&&... rest) - -> ExpandAndApplyResult { - - return expandAndApply( - ExpandAndApplyFunc(kj::fwd(func), kj::fwd(first)), - kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), kj::mv(first), kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApply(Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApplyWithIndexes(MakeIndexes(), - kj::fwd(func), first, kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, Tuple&& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), kj::mv(getImpl(first))..., - kj::fwd(rest)...); -} - -template -inline auto expandAndApplyWithIndexes( - Indexes, Func&& func, const Tuple& first, Rest&&... rest) - -> ExpandAndApplyResult { - return expandAndApply(kj::fwd(func), getImpl(first)..., - kj::fwd(rest)...); -} - -struct MakeTupleFunc { - template - Tuple...> operator()(Params&&... params) { - return Tuple...>(kj::fwd(params)...); - } - template - Decay operator()(Param&& param) { - return kj::fwd(param); - } -}; - -} // namespace _ (private) - -template struct Tuple_ { typedef _::Tuple Type; }; -template struct Tuple_ { typedef T Type; }; - -template using Tuple = typename Tuple_::Type; -// Tuple type. `Tuple` (i.e. a single-element tuple) is a synonym for `T`. Tuples of size -// other than 1 expand to an internal type. Either way, you can construct a Tuple using -// `kj::tuple(...)`, get an element by index `i` using `kj::get(myTuple)`, and expand the tuple -// as arguments to a function using `kj::apply(func, myTuple)`. -// -// Tuples are always flat -- that is, no element of a Tuple is ever itself a Tuple. If you -// construct a tuple from other tuples, the elements are flattened and concatenated. - -template -inline auto tuple(Params&&... params) - -> decltype(_::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...)) { - // Construct a new tuple from the given values. Any tuples in the argument list will be - // flattened into the result. - return _::expandAndApply(_::MakeTupleFunc(), kj::fwd(params)...); -} - -template -inline auto get(Tuple&& tuple) -> decltype(_::getImpl(kj::fwd(tuple))) { - // Unpack and return the tuple element at the given index. The index is specified as a template - // parameter, e.g. `kj::get<3>(myTuple)`. - return _::getImpl(kj::fwd(tuple)); -} - -template -inline auto apply(Func&& func, Params&&... params) - -> decltype(_::expandAndApply(kj::fwd(func), kj::fwd(params)...)) { - // Apply a function to some arguments, expanding tuples into separate arguments. - return _::expandAndApply(kj::fwd(func), kj::fwd(params)...); -} - -template struct TupleSize_ { static constexpr size_t size = 1; }; -template struct TupleSize_<_::Tuple> { - static constexpr size_t size = sizeof...(T); -}; - -template -constexpr size_t tupleSize() { return TupleSize_::size; } -// Returns size of the tuple T. - -} // namespace kj - -#endif // KJ_TUPLE_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/units.h b/phonelibs/capnp-cpp/mac/include/kj/units.h deleted file mode 100644 index 8bba40338b..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/units.h +++ /dev/null @@ -1,1172 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// This file contains types which are intended to help detect incorrect usage at compile -// time, but should then be optimized down to basic primitives (usually, integers) by the -// compiler. - -#ifndef KJ_UNITS_H_ -#define KJ_UNITS_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "common.h" -#include - -namespace kj { - -// ======================================================================================= -// IDs - -template -struct Id { - // A type-safe numeric ID. `UnderlyingType` is the underlying integer representation. `Label` - // distinguishes this Id from other Id types. Sample usage: - // - // class Foo; - // typedef Id FooId; - // - // class Bar; - // typedef Id BarId; - // - // You can now use the FooId and BarId types without any possibility of accidentally using a - // FooId when you really wanted a BarId or vice-versa. - - UnderlyingType value; - - inline constexpr Id(): value(0) {} - inline constexpr explicit Id(int value): value(value) {} - - inline constexpr bool operator==(const Id& other) const { return value == other.value; } - inline constexpr bool operator!=(const Id& other) const { return value != other.value; } - inline constexpr bool operator<=(const Id& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Id& other) const { return value >= other.value; } - inline constexpr bool operator< (const Id& other) const { return value < other.value; } - inline constexpr bool operator> (const Id& other) const { return value > other.value; } -}; - -// ======================================================================================= -// Quantity and UnitRatio -- implement unit analysis via the type system - -struct Unsafe_ {}; -constexpr Unsafe_ unsafe = Unsafe_(); -// Use as a parameter to constructors that are unsafe to indicate that you really do mean it. - -template -class Bounded; -template -class BoundedConst; - -template constexpr bool isIntegral() { return false; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } -template <> constexpr bool isIntegral() { return true; } - -template -struct IsIntegralOrBounded_ { static constexpr bool value = isIntegral(); }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; -template -struct IsIntegralOrBounded_> { static constexpr bool value = true; }; - -template -inline constexpr bool isIntegralOrBounded() { return IsIntegralOrBounded_::value; } - -template -class UnitRatio { - // A multiplier used to convert Quantities of one unit to Quantities of another unit. See - // Quantity, below. - // - // Construct this type by dividing one Quantity by another of a different unit. Use this type - // by multiplying it by a Quantity, or dividing a Quantity by it. - - static_assert(isIntegralOrBounded(), - "Underlying type for UnitRatio must be integer."); - -public: - inline UnitRatio() {} - - constexpr UnitRatio(Number unit1PerUnit2, decltype(unsafe)): unit1PerUnit2(unit1PerUnit2) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr UnitRatio(const UnitRatio& other) - : unit1PerUnit2(other.unit1PerUnit2) {} - - template - inline constexpr UnitRatio - operator+(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 + other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator-(UnitRatio other) const { - return UnitRatio( - unit1PerUnit2 - other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U3 / U1 = U3 / U2 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator*(UnitRatio other) const { - // U1 / U2 * U2 / U3 = U1 / U3 - return UnitRatio( - unit1PerUnit2 * other.unit1PerUnit2, unsafe); - } - - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U1 / U3) = U3 / U2 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(UnitRatio other) const { - // (U1 / U2) / (U3 / U2) = U1 / U3 - return UnitRatio( - unit1PerUnit2 / other.unit1PerUnit2, unsafe); - } - - template - inline decltype(Number() / OtherNumber()) - operator/(UnitRatio other) const { - return unit1PerUnit2 / other.unit1PerUnit2; - } - - inline bool operator==(UnitRatio other) const { return unit1PerUnit2 == other.unit1PerUnit2; } - inline bool operator!=(UnitRatio other) const { return unit1PerUnit2 != other.unit1PerUnit2; } - -private: - Number unit1PerUnit2; - - template - friend class Quantity; - template - friend class UnitRatio; - - template - friend inline constexpr UnitRatio - operator*(N1, UnitRatio); -}; - -template () && isIntegralOrBounded()>> -inline constexpr UnitRatio - operator*(N1 n, UnitRatio r) { - return UnitRatio(n * r.unit1PerUnit2, unsafe); -} - -template -class Quantity { - // A type-safe numeric quantity, specified in terms of some unit. Two Quantities cannot be used - // in arithmetic unless they use the same unit. The `Unit` type parameter is only used to prevent - // accidental mixing of units; this type is never instantiated and can very well be incomplete. - // `Number` is the underlying primitive numeric type. - // - // Quantities support most basic arithmetic operators, intelligently handling units, and - // automatically casting the underlying type in the same way that the compiler would. - // - // To convert a primitive number to a Quantity, multiply it by unit>(). - // To convert a Quantity to a primitive number, divide it by unit>(). - // To convert a Quantity of one unit to another unit, multiply or divide by a UnitRatio. - // - // The Quantity class is not well-suited to hardcore physics as it does not allow multiplying - // one quantity by another. For example, multiplying meters by meters won't get you square - // meters; it will get you a compiler error. It would be interesting to see if template - // metaprogramming could properly deal with such things but this isn't needed for the present - // use case. - // - // Sample usage: - // - // class SecondsLabel; - // typedef Quantity Seconds; - // constexpr Seconds SECONDS = unit(); - // - // class MinutesLabel; - // typedef Quantity Minutes; - // constexpr Minutes MINUTES = unit(); - // - // constexpr UnitRatio SECONDS_PER_MINUTE = - // 60 * SECONDS / MINUTES; - // - // void waitFor(Seconds seconds) { - // sleep(seconds / SECONDS); - // } - // void waitFor(Minutes minutes) { - // waitFor(minutes * SECONDS_PER_MINUTE); - // } - // - // void waitThreeMinutes() { - // waitFor(3 * MINUTES); - // } - - static_assert(isIntegralOrBounded(), - "Underlying type for Quantity must be integer."); - -public: - inline constexpr Quantity() = default; - - inline constexpr Quantity(MaxValue_): value(maxValue) {} - inline constexpr Quantity(MinValue_): value(minValue) {} - // Allow initialization from maxValue and minValue. - // TODO(msvc): decltype(maxValue) and decltype(minValue) deduce unknown-type for these function - // parameters, causing the compiler to complain of a duplicate constructor definition, so we - // specify MaxValue_ and MinValue_ types explicitly. - - inline constexpr Quantity(Number value, decltype(unsafe)): value(value) {} - // This constructor was intended to be private, but GCC complains about it being private in a - // bunch of places that don't appear to even call it, so I made it public. Oh well. - - template - inline constexpr Quantity(const Quantity& other) - : value(other.value) {} - - template - inline Quantity& operator=(const Quantity& other) { - value = other.value; - return *this; - } - - template - inline constexpr Quantity - operator+(const Quantity& other) const { - return Quantity(value + other.value, unsafe); - } - template - inline constexpr Quantity - operator-(const Quantity& other) const { - return Quantity(value - other.value, unsafe); - } - template ()>> - inline constexpr Quantity - operator*(OtherNumber other) const { - return Quantity(value * other, unsafe); - } - template ()>> - inline constexpr Quantity - operator/(OtherNumber other) const { - return Quantity(value / other, unsafe); - } - template - inline constexpr decltype(Number() / OtherNumber()) - operator/(const Quantity& other) const { - return value / other.value; - } - template - inline constexpr Quantity - operator%(const Quantity& other) const { - return Quantity(value % other.value, unsafe); - } - - template - inline constexpr Quantity - operator*(UnitRatio ratio) const { - return Quantity( - value * ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator/(UnitRatio ratio) const { - return Quantity( - value / ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr Quantity - operator%(UnitRatio ratio) const { - return Quantity( - value % ratio.unit1PerUnit2, unsafe); - } - template - inline constexpr UnitRatio - operator/(Quantity other) const { - return UnitRatio( - value / other.value, unsafe); - } - - template - inline constexpr bool operator==(const Quantity& other) const { - return value == other.value; - } - template - inline constexpr bool operator!=(const Quantity& other) const { - return value != other.value; - } - template - inline constexpr bool operator<=(const Quantity& other) const { - return value <= other.value; - } - template - inline constexpr bool operator>=(const Quantity& other) const { - return value >= other.value; - } - template - inline constexpr bool operator<(const Quantity& other) const { - return value < other.value; - } - template - inline constexpr bool operator>(const Quantity& other) const { - return value > other.value; - } - - template - inline Quantity& operator+=(const Quantity& other) { - value += other.value; - return *this; - } - template - inline Quantity& operator-=(const Quantity& other) { - value -= other.value; - return *this; - } - template - inline Quantity& operator*=(OtherNumber other) { - value *= other; - return *this; - } - template - inline Quantity& operator/=(OtherNumber other) { - value /= other.value; - return *this; - } - -private: - Number value; - - template - friend class Quantity; - - template - friend inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity; -}; - -template struct Unit_ { - static inline constexpr T get() { return T(1); } -}; -template -struct Unit_> { - static inline constexpr Quantity::get()), U> get() { - return Quantity::get()), U>(Unit_::get(), unsafe); - } -}; - -template -inline constexpr auto unit() -> decltype(Unit_::get()) { return Unit_::get(); } -// unit>() returns a Quantity of value 1. It also, intentionally, works on basic -// numeric types. - -template -inline constexpr auto operator*(Number1 a, Quantity b) - -> Quantity { - return Quantity(a * b.value, unsafe); -} - -template -inline constexpr auto operator*(UnitRatio ratio, - Quantity measure) - -> decltype(measure * ratio) { - return measure * ratio; -} - -// ======================================================================================= -// Absolute measures - -template -class Absolute { - // Wraps some other value -- typically a Quantity -- but represents a value measured based on - // some absolute origin. For example, if `Duration` is a type representing a time duration, - // Absolute might be a calendar date. - // - // Since Absolute represents measurements relative to some arbitrary origin, the only sensible - // arithmetic to perform on them is addition and subtraction. - - // TODO(someday): Do the same automatic expansion of integer width that Quantity does? Doesn't - // matter for our time use case, where we always use 64-bit anyway. Note that fixing this - // would implicitly allow things like multiplying an Absolute by a UnitRatio to change its - // units, which is actually totally logical and kind of neat. - -public: - inline constexpr Absolute operator+(const T& other) const { return Absolute(value + other); } - inline constexpr Absolute operator-(const T& other) const { return Absolute(value - other); } - inline constexpr T operator-(const Absolute& other) const { return value - other.value; } - - inline Absolute& operator+=(const T& other) { value += other; return *this; } - inline Absolute& operator-=(const T& other) { value -= other; return *this; } - - inline constexpr bool operator==(const Absolute& other) const { return value == other.value; } - inline constexpr bool operator!=(const Absolute& other) const { return value != other.value; } - inline constexpr bool operator<=(const Absolute& other) const { return value <= other.value; } - inline constexpr bool operator>=(const Absolute& other) const { return value >= other.value; } - inline constexpr bool operator< (const Absolute& other) const { return value < other.value; } - inline constexpr bool operator> (const Absolute& other) const { return value > other.value; } - -private: - T value; - - explicit constexpr Absolute(T value): value(value) {} - - template - friend inline constexpr U origin(); -}; - -template -inline constexpr Absolute operator+(const T& a, const Absolute& b) { - return b + a; -} - -template struct UnitOf_ { typedef T Type; }; -template struct UnitOf_> { typedef T Type; }; -template -using UnitOf = typename UnitOf_::Type; -// UnitOf> is T. UnitOf is AnythingElse. - -template -inline constexpr T origin() { return T(0 * unit>()); } -// origin>() returns an Absolute of value 0. It also, intentionally, works on basic -// numeric types. - -// ======================================================================================= -// Overflow avoidance - -template -struct BitCount_ { - static constexpr uint value = BitCount_<(n >> 1), accum + 1>::value; -}; -template -struct BitCount_<0, accum> { - static constexpr uint value = accum; -}; - -template -inline constexpr uint bitCount() { return BitCount_::value; } -// Number of bits required to represent the number `n`. - -template struct AtLeastUInt_ { - static_assert(bitCountBitCount < 7, "don't know how to represent integers over 64 bits"); -}; -template <> struct AtLeastUInt_<0> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<1> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<2> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<3> { typedef uint8_t Type; }; -template <> struct AtLeastUInt_<4> { typedef uint16_t Type; }; -template <> struct AtLeastUInt_<5> { typedef uint32_t Type; }; -template <> struct AtLeastUInt_<6> { typedef uint64_t Type; }; - -template -using AtLeastUInt = typename AtLeastUInt_()>::Type; -// AtLeastUInt is an unsigned integer of at least n bits. E.g. AtLeastUInt<12> is uint16_t. - -// ------------------------------------------------------------------- - -template -class BoundedConst { - // A constant integer value on which we can do bit size analysis. - -public: - BoundedConst() = default; - - inline constexpr uint unwrap() const { return value; } - -#define OP(op, check) \ - template \ - inline constexpr BoundedConst<(value op other)> \ - operator op(BoundedConst) const { \ - static_assert(check, "overflow in BoundedConst arithmetic"); \ - return BoundedConst<(value op other)>(); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(BoundedConst) const { \ - return value op other; \ - } - - OP(+, value + other >= value) - OP(-, value - other <= value) - OP(*, value * other / other == value) - OP(/, true) // div by zero already errors out; no other division ever overflows - OP(%, true) // mod by zero already errors out; no other modulus ever overflows - OP(<<, value << other >= value) - OP(>>, true) // right shift can't overflow - OP(&, true) // bitwise ops can't overflow - OP(|, true) // bitwise ops can't overflow - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) -#undef OP -#undef COMPARE_OP -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -struct Unit_> { - static inline constexpr BoundedConst<1> get() { return BoundedConst<1>(); } -}; - -template -inline constexpr BoundedConst bounded() { - return BoundedConst(); -} - -template -static constexpr uint64_t boundedAdd() { - static_assert(a + b >= a, "possible overflow detected"); - return a + b; -} -template -static constexpr uint64_t boundedSub() { - static_assert(a - b <= a, "possible underflow detected"); - return a - b; -} -template -static constexpr uint64_t boundedMul() { - static_assert(a * b / b == a, "possible overflow detected"); - return a * b; -} -template -static constexpr uint64_t boundedLShift() { - static_assert(a << b >= a, "possible overflow detected"); - return a << b; -} - -template -inline constexpr BoundedConst min(BoundedConst, BoundedConst) { - return bounded(); -} -template -inline constexpr BoundedConst max(BoundedConst, BoundedConst) { - return bounded(); -} -// We need to override min() and max() between constants because the ternary operator in the -// default implementation would complain. - -// ------------------------------------------------------------------- - -template -class Bounded { -public: - static_assert(maxN <= T(kj::maxValue), "possible overflow detected"); - - Bounded() = default; - - Bounded(const Bounded& other) = default; - template ()>> - inline constexpr Bounded(OtherInt value): value(value) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(const Bounded& other) - : value(other.value) { - static_assert(otherMax <= maxN, "possible overflow detected"); - } - template - inline constexpr Bounded(BoundedConst) - : value(otherValue) { - static_assert(otherValue <= maxN, "overflow detected"); - } - - Bounded& operator=(const Bounded& other) = default; - template ()>> - Bounded& operator=(OtherInt other) { - static_assert(OtherInt(maxValue) <= maxN, "possible overflow detected"); - value = other; - return *this; - } - template - inline Bounded& operator=(const Bounded& other) { - static_assert(otherMax <= maxN, "possible overflow detected"); - value = other.value; - return *this; - } - template - inline Bounded& operator=(BoundedConst) { - static_assert(otherValue <= maxN, "overflow detected"); - value = otherValue; - return *this; - } - - inline constexpr T unwrap() const { return value; } - -#define OP(op, newMax) \ - template \ - inline constexpr Bounded \ - operator op(const Bounded& other) const { \ - return Bounded(value op other.value, unsafe); \ - } -#define COMPARE_OP(op) \ - template \ - inline constexpr bool operator op(const Bounded& other) const { \ - return value op other.value; \ - } - - OP(+, (boundedAdd())) - OP(*, (boundedMul())) - OP(/, maxN) - OP(%, otherMax - 1) - - // operator- is intentionally omitted because we mostly use this with unsigned types, and - // subtraction requires proof that subtrahend is not greater than the minuend. - - COMPARE_OP(==) - COMPARE_OP(!=) - COMPARE_OP(< ) - COMPARE_OP(> ) - COMPARE_OP(<=) - COMPARE_OP(>=) - -#undef OP -#undef COMPARE_OP - - template - inline Bounded assertMax(ErrorFunc&& func) const { - // Assert that the number is no more than `newMax`. Otherwise, call `func`. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - if (KJ_UNLIKELY(value > newMax)) func(); - return Bounded(value, unsafe); - } - - template - inline Bounded subtractChecked( - const Bounded& other, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - if (KJ_UNLIKELY(value < other.value)) func(); - return Bounded(value - other.value, unsafe); - } - - template - inline Bounded subtractChecked( - BoundedConst, ErrorFunc&& func) const { - // Subtract a number, calling func() if the result would underflow. - static_assert(otherValue <= maxN, "underflow detected"); - if (KJ_UNLIKELY(value < otherValue)) func(); - return Bounded(value - otherValue, unsafe); - } - - template - inline Maybe> trySubtract( - const Bounded& other) const { - // Subtract a number, calling func() if the result would underflow. - if (value < other.value) { - return nullptr; - } else { - return Bounded(value - other.value, unsafe); - } - } - - template - inline Maybe> trySubtract(BoundedConst) const { - // Subtract a number, calling func() if the result would underflow. - if (value < otherValue) { - return nullptr; - } else { - return Bounded(value - otherValue, unsafe); - } - } - - inline constexpr Bounded(T value, decltype(unsafe)): value(value) {} - template - inline constexpr Bounded(Bounded value, decltype(unsafe)) - : value(value.value) {} - // Mainly for internal use. - // - // Only use these as a last resort, with ample commentary on why you think it's safe. - -private: - T value; - - template - friend class Bounded; -}; - -template -inline constexpr Bounded bounded(Number value) { - return Bounded(value, unsafe); -} - -inline constexpr Bounded<1, uint8_t> bounded(bool value) { - return Bounded<1, uint8_t>(value, unsafe); -} - -template -inline constexpr Bounded(), Number> assumeBits(Number value) { - return Bounded(), Number>(value, unsafe); -} - -template -inline constexpr Bounded(), T> assumeBits(Bounded value) { - return Bounded(), T>(value, unsafe); -} - -template -inline constexpr auto assumeBits(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeBits(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(Number value) { - return Bounded(value, unsafe); -} - -template -inline constexpr Bounded assumeMax(Bounded value) { - return Bounded(value, unsafe); -} - -template -inline constexpr auto assumeMax(Quantity value) - -> Quantity(value / unit>())), Unit> { - return Quantity(value / unit>())), Unit>( - assumeMax(value / unit>()), unsafe); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Number value) { - return assumeMax(value); -} - -template -inline constexpr Bounded assumeMax(BoundedConst, Bounded value) { - return assumeMax(value); -} - -template -inline constexpr auto assumeMax(Quantity, Unit>, Quantity value) - -> decltype(assumeMax(value)) { - return assumeMax(value); -} - -template -inline Bounded assertMax(Bounded value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return value.template assertMax(kj::fwd(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit> value, ErrorFunc&& errorFunc) { - // Assert that the bounded value is less than or equal to the given maximum, calling errorFunc() - // if not. - static_assert(newMax < maxN, "this bounded size assertion is redundant"); - return (value / unit()).template assertMax( - kj::fwd(errorFunc)) * unit(); -} - -template -inline Bounded assertMax( - BoundedConst, Bounded value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Quantity, Unit> assertMax( - Quantity, Unit>, - Quantity, Unit> value, ErrorFunc&& errorFunc) { - return assertMax(value, kj::mv(errorFunc)); -} - -template -inline Bounded(), T> assertMaxBits( - Bounded value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline Quantity(), T>, Unit> assertMaxBits( - Quantity, Unit> value, ErrorFunc&& errorFunc = ErrorFunc()) { - // Assert that the bounded value requires no more than the given number of bits, calling - // errorFunc() if not. - return assertMax()>(value, kj::fwd(errorFunc)); -} - -template -inline constexpr Bounded upgradeBound(Bounded value) { - return value; -} - -template -inline constexpr Quantity, Unit> upgradeBound( - Quantity, Unit> value) { - return value; -} - -template -inline auto subtractChecked(Bounded value, Other other, ErrorFunc&& errorFunc) - -> decltype(value.subtractChecked(other, kj::fwd(errorFunc))) { - return value.subtractChecked(other, kj::fwd(errorFunc)); -} - -template -inline auto subtractChecked(Quantity value, Quantity other, ErrorFunc&& errorFunc) - -> Quantity(errorFunc))), Unit> { - return subtractChecked(value / unit>(), - other / unit>(), - kj::fwd(errorFunc)) - * unit>(); -} - -template -inline auto trySubtract(Bounded value, Other other) - -> decltype(value.trySubtract(other)) { - return value.trySubtract(other); -} - -template -inline auto trySubtract(Quantity value, Quantity other) - -> Maybe> { - return trySubtract(value / unit>(), - other / unit>()) - .map([](decltype(subtractChecked(T(), U(), int())) x) { - return x * unit>(); - }); -} - -template -inline constexpr Bounded> -min(Bounded a, Bounded b) { - return Bounded>(kj::min(a.unwrap(), b.unwrap()), unsafe); -} -template -inline constexpr Bounded> -max(Bounded a, Bounded b) { - return Bounded>(kj::max(a.unwrap(), b.unwrap()), unsafe); -} -// We need to override min() and max() because: -// 1) WiderType<> might not choose the correct bounds. -// 2) One of the two sides of the ternary operator in the default implementation would fail to -// typecheck even though it is OK in practice. - -// ------------------------------------------------------------------- -// Operators between Bounded and BoundedConst - -#define OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(T() op uint())> operator op( \ - Bounded value, BoundedConst) { \ - return Bounded<(newMax), decltype(T() op uint())>(value.unwrap() op cvalue, unsafe); \ -} - -#define REVERSE_OP(op, newMax) \ -template \ -inline constexpr Bounded<(newMax), decltype(uint() op T())> operator op( \ - BoundedConst, Bounded value) { \ - return Bounded<(newMax), decltype(uint() op T())>(cvalue op value.unwrap(), unsafe); \ -} - -#define COMPARE_OP(op) \ -template \ -inline constexpr bool operator op(Bounded value, BoundedConst) { \ - return value.unwrap() op cvalue; \ -} \ -template \ -inline constexpr bool operator op(BoundedConst, Bounded value) { \ - return cvalue op value.unwrap(); \ -} - -OP(+, (boundedAdd())) -REVERSE_OP(+, (boundedAdd())) - -OP(*, (boundedMul())) -REVERSE_OP(*, (boundedAdd())) - -OP(/, maxN / cvalue) -REVERSE_OP(/, cvalue) // denominator could be 1 - -OP(%, cvalue - 1) -REVERSE_OP(%, maxN - 1) - -OP(<<, (boundedLShift())) -REVERSE_OP(<<, (boundedLShift())) - -OP(>>, maxN >> cvalue) -REVERSE_OP(>>, cvalue >> maxN) - -OP(&, maxValueForBits()>() & cvalue) -REVERSE_OP(&, maxValueForBits()>() & cvalue) - -OP(|, maxN | cvalue) -REVERSE_OP(|, maxN | cvalue) - -COMPARE_OP(==) -COMPARE_OP(!=) -COMPARE_OP(< ) -COMPARE_OP(> ) -COMPARE_OP(<=) -COMPARE_OP(>=) - -#undef OP -#undef REVERSE_OP -#undef COMPARE_OP - -template -inline constexpr Bounded - operator-(BoundedConst, Bounded value) { - // We allow subtraction of a variable from a constant only if the constant is greater than or - // equal to the maximum possible value of the variable. Since the variable could be zero, the - // result can be as large as the constant. - // - // We do not allow subtraction of a constant from a variable because there's never a guarantee it - // won't underflow (unless the constant is zero, which is silly). - static_assert(cvalue >= maxN, "possible underflow detected"); - return Bounded(cvalue - value.unwrap(), unsafe); -} - -template -inline constexpr Bounded min(Bounded a, BoundedConst) { - return Bounded(kj::min(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded min(BoundedConst, Bounded a) { - return Bounded(kj::min(a.unwrap(), b), unsafe); -} -template -inline constexpr Bounded max(Bounded a, BoundedConst) { - return Bounded(kj::max(b, a.unwrap()), unsafe); -} -template -inline constexpr Bounded max(BoundedConst, Bounded a) { - return Bounded(kj::max(a.unwrap(), b), unsafe); -} -// We need to override min() between a Bounded and a constant since: -// 1) WiderType<> might choose BoundedConst over a 1-byte Bounded, which is wrong. -// 2) To clamp the bounds of the output type. -// 3) Same ternary operator typechecking issues. - -// ------------------------------------------------------------------- - -template -class SafeUnwrapper { -public: - inline explicit constexpr SafeUnwrapper(Bounded value): value(value.unwrap()) {} - - template ()>> - inline constexpr operator U() const { - static_assert(maxN <= U(maxValue), "possible truncation detected"); - return value; - } - - inline constexpr operator bool() const { - static_assert(maxN <= 1, "possible truncation detected"); - return value; - } - -private: - T value; -}; - -template -inline constexpr SafeUnwrapper unbound(Bounded bounded) { - // Unwraps the bounded value, returning a value that can be implicitly cast to any integer type. - // If this implicit cast could truncate, a compile-time error will be raised. - return SafeUnwrapper(bounded); -} - -template -class SafeConstUnwrapper { -public: - template ()>> - inline constexpr operator T() const { - static_assert(value <= T(maxValue), "this operation will truncate"); - return value; - } - - inline constexpr operator bool() const { - static_assert(value <= 1, "this operation will truncate"); - return value; - } -}; - -template -inline constexpr SafeConstUnwrapper unbound(BoundedConst) { - return SafeConstUnwrapper(); -} - -template -inline constexpr T unboundAs(U value) { - return unbound(value); -} - -template -inline constexpr T unboundMax(Bounded value) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(maxN <= requestedMax, "possible overflow detected"); - return value.unwrap(); -} - -template -inline constexpr uint unboundMax(BoundedConst) { - // Explicitly ungaurd expecting a value that is at most `maxN`. - static_assert(value <= requestedMax, "overflow detected"); - return value; -} - -template -inline constexpr auto unboundMaxBits(T value) -> - decltype(unboundMax()>(value)) { - // Explicitly ungaurd expecting a value that fits into `bits` bits. - return unboundMax()>(value); -} - -#define OP(op) \ -template \ -inline constexpr auto operator op(T a, SafeUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} \ -template \ -inline constexpr auto operator op(T a, SafeConstUnwrapper b) -> decltype(a op (T)b) { \ - return a op (AtLeastUInt)b; \ -} \ -template \ -inline constexpr auto operator op(SafeConstUnwrapper b, T a) -> decltype((T)b op a) { \ - return (AtLeastUInt)b op a; \ -} - -OP(+) -OP(-) -OP(*) -OP(/) -OP(%) -OP(<<) -OP(>>) -OP(&) -OP(|) -OP(==) -OP(!=) -OP(<=) -OP(>=) -OP(<) -OP(>) - -#undef OP - -// ------------------------------------------------------------------- - -template -class Range> { -public: - inline constexpr Range(Bounded begin, Bounded end) - : inner(unbound(begin), unbound(end)) {} - inline explicit constexpr Range(Bounded end) - : inner(unbound(end)) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Bounded operator* () const { return Bounded(*inner, unsafe); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -class Range> { -public: - inline constexpr Range(Quantity begin, Quantity end) - : inner(begin / unit>(), end / unit>()) {} - inline explicit constexpr Range(Quantity end) - : inner(end / unit>()) {} - - class Iterator { - public: - Iterator() = default; - inline explicit Iterator(typename Range::Iterator inner): inner(inner) {} - - inline Quantity operator* () const { return *inner * unit>(); } - inline Iterator& operator++() { ++inner; return *this; } - - inline bool operator==(const Iterator& other) const { return inner == other.inner; } - inline bool operator!=(const Iterator& other) const { return inner != other.inner; } - - private: - typename Range::Iterator inner; - }; - - inline Iterator begin() const { return Iterator(inner.begin()); } - inline Iterator end() const { return Iterator(inner.end()); } - -private: - Range inner; -}; - -template -inline constexpr Range> zeroTo(BoundedConst end) { - return Range>(end); -} - -template -inline constexpr Range, Unit>> - zeroTo(Quantity, Unit> end) { - return Range, Unit>>(end); -} - -} // namespace kj - -#endif // KJ_UNITS_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/vector.h b/phonelibs/capnp-cpp/mac/include/kj/vector.h deleted file mode 100644 index 44613f3331..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/vector.h +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_VECTOR_H_ -#define KJ_VECTOR_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#include "array.h" - -namespace kj { - -template -class Vector { - // Similar to std::vector, but based on KJ framework. - // - // This implementation always uses move constructors when growing the backing array. If the - // move constructor throws, the Vector is left in an inconsistent state. This is acceptable - // under KJ exception theory which assumes that exceptions leave things in inconsistent states. - - // TODO(someday): Allow specifying a custom allocator. - -public: - inline Vector() = default; - inline explicit Vector(size_t capacity): builder(heapArrayBuilder(capacity)) {} - - inline operator ArrayPtr() { return builder; } - inline operator ArrayPtr() const { return builder; } - inline ArrayPtr asPtr() { return builder.asPtr(); } - inline ArrayPtr asPtr() const { return builder.asPtr(); } - - inline size_t size() const { return builder.size(); } - inline bool empty() const { return size() == 0; } - inline size_t capacity() const { return builder.capacity(); } - inline T& operator[](size_t index) const { return builder[index]; } - - inline const T* begin() const { return builder.begin(); } - inline const T* end() const { return builder.end(); } - inline const T& front() const { return builder.front(); } - inline const T& back() const { return builder.back(); } - inline T* begin() { return builder.begin(); } - inline T* end() { return builder.end(); } - inline T& front() { return builder.front(); } - inline T& back() { return builder.back(); } - - inline Array releaseAsArray() { - // TODO(perf): Avoid a copy/move by allowing Array to point to incomplete space? - if (!builder.isFull()) { - setCapacity(size()); - } - return builder.finish(); - } - - template - inline T& add(Params&&... params) { - if (builder.isFull()) grow(); - return builder.add(kj::fwd(params)...); - } - - template - inline void addAll(Iterator begin, Iterator end) { - size_t needed = builder.size() + (end - begin); - if (needed > builder.capacity()) grow(needed); - builder.addAll(begin, end); - } - - template - inline void addAll(Container&& container) { - addAll(container.begin(), container.end()); - } - - inline void removeLast() { - builder.removeLast(); - } - - inline void resize(size_t size) { - if (size > builder.capacity()) grow(size); - builder.resize(size); - } - - inline void operator=(decltype(nullptr)) { - builder = nullptr; - } - - inline void clear() { - while (builder.size() > 0) { - builder.removeLast(); - } - } - - inline void truncate(size_t size) { - builder.truncate(size); - } - - inline void reserve(size_t size) { - if (size > builder.capacity()) { - setCapacity(size); - } - } - -private: - ArrayBuilder builder; - - void grow(size_t minCapacity = 0) { - setCapacity(kj::max(minCapacity, capacity() == 0 ? 4 : capacity() * 2)); - } - void setCapacity(size_t newSize) { - if (builder.size() > newSize) { - builder.truncate(newSize); - } - ArrayBuilder newBuilder = heapArrayBuilder(newSize); - newBuilder.addAll(kj::mv(builder)); - builder = kj::mv(newBuilder); - } -}; - -template -inline auto KJ_STRINGIFY(const Vector& v) -> decltype(toCharSequence(v.asPtr())) { - return toCharSequence(v.asPtr()); -} - -} // namespace kj - -#endif // KJ_VECTOR_H_ diff --git a/phonelibs/capnp-cpp/mac/include/kj/windows-sanity.h b/phonelibs/capnp-cpp/mac/include/kj/windows-sanity.h deleted file mode 100644 index 766ba2cbd6..0000000000 --- a/phonelibs/capnp-cpp/mac/include/kj/windows-sanity.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef KJ_WINDOWS_SANITY_H_ -#define KJ_WINDOWS_SANITY_H_ - -#if defined(__GNUC__) && !KJ_HEADER_WARNINGS -#pragma GCC system_header -#endif - -#ifndef _INC_WINDOWS -#error "windows.h needs to be included before kj/windows-sanity.h (or perhaps you don't need either?)" -#endif - -namespace win32 { - const auto ERROR_ = ERROR; -#undef ERROR - const auto ERROR = ERROR_; -} - -using win32::ERROR; - -#endif // KJ_WINDOWS_SANITY_H_ diff --git a/phonelibs/capnp-cpp/mac/lib/libcapnp.a b/phonelibs/capnp-cpp/mac/lib/libcapnp.a deleted file mode 100644 index b780b39a45..0000000000 Binary files a/phonelibs/capnp-cpp/mac/lib/libcapnp.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/mac/lib/libcapnpc.a b/phonelibs/capnp-cpp/mac/lib/libcapnpc.a deleted file mode 100644 index 30a8361670..0000000000 Binary files a/phonelibs/capnp-cpp/mac/lib/libcapnpc.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/mac/lib/libkj.a b/phonelibs/capnp-cpp/mac/lib/libkj.a deleted file mode 100644 index a122e54808..0000000000 Binary files a/phonelibs/capnp-cpp/mac/lib/libkj.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libcapnp-0.6.1.so deleted file mode 100755 index a40f0c0921..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-json-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libcapnp-json-0.6.1.so deleted file mode 100755 index 14d7adf587..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp-json-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.a b/phonelibs/capnp-cpp/x64/lib/libcapnp-json.a deleted file mode 100644 index 92fcf16c98..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.la b/phonelibs/capnp-cpp/x64/lib/libcapnp-json.la deleted file mode 100755 index eee173d304..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-json.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-json-0.6.1.so' - -# Names of this library. -library_names='libcapnp-json-0.6.1.so libcapnp-json-0.6.1.so libcapnp-json.so' - -# The name of the static archive. -old_library='libcapnp-json.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libcapnp.la /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-json. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.so b/phonelibs/capnp-cpp/x64/lib/libcapnp-json.so deleted file mode 120000 index 439f29db8e..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp-json.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-json-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc-0.6.1.so deleted file mode 100755 index 87f6305849..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.a b/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.a deleted file mode 100644 index a2550875b2..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.la b/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.la deleted file mode 100755 index f5ef88958b..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp-rpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-rpc-0.6.1.so' - -# Names of this library. -library_names='libcapnp-rpc-0.6.1.so libcapnp-rpc-0.6.1.so libcapnp-rpc.so' - -# The name of the static archive. -old_library='libcapnp-rpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libcapnp.la /home/batman/one/external/capnp/lib/libkj-async.la /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp-rpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.so b/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.so deleted file mode 120000 index a4f0e19500..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp-rpc.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-rpc-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp.a b/phonelibs/capnp-cpp/x64/lib/libcapnp.a deleted file mode 100644 index ac1f1c31d7..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnp.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp.la b/phonelibs/capnp-cpp/x64/lib/libcapnp.la deleted file mode 100755 index 6d468c6e43..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnp.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnp-0.6.1.so' - -# Names of this library. -library_names='libcapnp-0.6.1.so libcapnp-0.6.1.so libcapnp.so' - -# The name of the static archive. -old_library='libcapnp.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnp. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnp.so b/phonelibs/capnp-cpp/x64/lib/libcapnp.so deleted file mode 120000 index a14cdcee7b..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnp.so +++ /dev/null @@ -1 +0,0 @@ -libcapnp-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnpc-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libcapnpc-0.6.1.so deleted file mode 100755 index 855de1cf5e..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnpc-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnpc.a b/phonelibs/capnp-cpp/x64/lib/libcapnpc.a deleted file mode 100644 index 0ef348cefe..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libcapnpc.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnpc.la b/phonelibs/capnp-cpp/x64/lib/libcapnpc.la deleted file mode 100755 index 11cc569000..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnpc.la +++ /dev/null @@ -1,41 +0,0 @@ -# libcapnpc.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libcapnpc-0.6.1.so' - -# Names of this library. -library_names='libcapnpc-0.6.1.so libcapnpc-0.6.1.so libcapnpc.so' - -# The name of the static archive. -old_library='libcapnpc.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libcapnp.la /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libcapnpc. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libcapnpc.so b/phonelibs/capnp-cpp/x64/lib/libcapnpc.so deleted file mode 120000 index e1be5626dd..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libcapnpc.so +++ /dev/null @@ -1 +0,0 @@ -libcapnpc-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libkj-0.6.1.so deleted file mode 100755 index 1e62479525..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-async-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libkj-async-0.6.1.so deleted file mode 100755 index a64156dc93..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-async-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-async.a b/phonelibs/capnp-cpp/x64/lib/libkj-async.a deleted file mode 100644 index a6e0f2a442..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-async.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-async.la b/phonelibs/capnp-cpp/x64/lib/libkj-async.la deleted file mode 100755 index 1f012fc97b..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-async.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-async.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-async-0.6.1.so' - -# Names of this library. -library_names='libkj-async-0.6.1.so libkj-async-0.6.1.so libkj-async.so' - -# The name of the static archive. -old_library='libkj-async.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-async. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-async.so b/phonelibs/capnp-cpp/x64/lib/libkj-async.so deleted file mode 120000 index 415bd24bee..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-async.so +++ /dev/null @@ -1 +0,0 @@ -libkj-async-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-http-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libkj-http-0.6.1.so deleted file mode 100755 index 2c12300955..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-http-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-http.a b/phonelibs/capnp-cpp/x64/lib/libkj-http.a deleted file mode 100644 index a60a5bd88e..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-http.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-http.la b/phonelibs/capnp-cpp/x64/lib/libkj-http.la deleted file mode 100755 index d4a89b0bf9..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-http.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-http.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-http-0.6.1.so' - -# Names of this library. -library_names='libkj-http-0.6.1.so libkj-http-0.6.1.so libkj-http.so' - -# The name of the static archive. -old_library='libkj-http.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libkj-async.la /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-http. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-http.so b/phonelibs/capnp-cpp/x64/lib/libkj-http.so deleted file mode 120000 index f66c52a3f5..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-http.so +++ /dev/null @@ -1 +0,0 @@ -libkj-http-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-test-0.6.1.so b/phonelibs/capnp-cpp/x64/lib/libkj-test-0.6.1.so deleted file mode 100755 index 7f802f1058..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-test-0.6.1.so and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-test.a b/phonelibs/capnp-cpp/x64/lib/libkj-test.a deleted file mode 100644 index e021dd2a49..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj-test.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-test.la b/phonelibs/capnp-cpp/x64/lib/libkj-test.la deleted file mode 100755 index d752d7c416..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-test.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj-test.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-test-0.6.1.so' - -# Names of this library. -library_names='libkj-test-0.6.1.so libkj-test-0.6.1.so libkj-test.so' - -# The name of the static archive. -old_library='libkj-test.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' /home/batman/one/external/capnp/lib/libkj.la -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj-test. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libkj-test.so b/phonelibs/capnp-cpp/x64/lib/libkj-test.so deleted file mode 120000 index 8474e67019..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj-test.so +++ /dev/null @@ -1 +0,0 @@ -libkj-test-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/libkj.a b/phonelibs/capnp-cpp/x64/lib/libkj.a deleted file mode 100644 index fe95068584..0000000000 Binary files a/phonelibs/capnp-cpp/x64/lib/libkj.a and /dev/null differ diff --git a/phonelibs/capnp-cpp/x64/lib/libkj.la b/phonelibs/capnp-cpp/x64/lib/libkj.la deleted file mode 100755 index 2391f4092d..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj.la +++ /dev/null @@ -1,41 +0,0 @@ -# libkj.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libkj-0.6.1.so' - -# Names of this library. -library_names='libkj-0.6.1.so libkj-0.6.1.so libkj.so' - -# The name of the static archive. -old_library='libkj.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libkj. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/capnp/lib' diff --git a/phonelibs/capnp-cpp/x64/lib/libkj.so b/phonelibs/capnp-cpp/x64/lib/libkj.so deleted file mode 120000 index 07c6d3bb08..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/libkj.so +++ /dev/null @@ -1 +0,0 @@ -libkj-0.6.1.so \ No newline at end of file diff --git a/phonelibs/capnp-cpp/x64/lib/pkgconfig/c-capnproto.pc b/phonelibs/capnp-cpp/x64/lib/pkgconfig/c-capnproto.pc deleted file mode 100644 index 4c7b5b3629..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/pkgconfig/c-capnproto.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/batman/one/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -bindir=${exec_prefix}/bin -includedir=${prefix}/include -codegen=${bindir}/capnpc-c - -Name: c-capnproto -Description: Cap'n Proto C bindings -Version: 0.2 -Libs: -L${libdir} -lcapnp_c -Cflags: -I${includedir} diff --git a/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp-rpc.pc b/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp-rpc.pc deleted file mode 100644 index 3fa1054010..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp-rpc.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/batman/one/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto RPC -Description: Fast object-oriented RPC system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp-rpc -Requires: capnp = 0.6.1 kj-async = 0.6.1 -Cflags: -I${includedir} diff --git a/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp.pc b/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp.pc deleted file mode 100644 index 18a6ba83bc..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/pkgconfig/capnp.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/home/batman/one/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Cap'n Proto -Description: Insanely fast serialization system -Version: 0.6.1 -Libs: -L${libdir} -lcapnp -pthread -lpthread -Libs.private: -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj-async.pc b/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj-async.pc deleted file mode 100644 index f0f63f7c83..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj-async.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/batman/one/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Async Framework Library -Description: Basic utility library called KJ (async part) -Version: 0.6.1 -Libs: -L${libdir} -lkj-async -pthread -lpthread -Requires: kj = 0.6.1 -Cflags: -I${includedir} -pthread diff --git a/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj.pc b/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj.pc deleted file mode 100644 index d2a501b476..0000000000 --- a/phonelibs/capnp-cpp/x64/lib/pkgconfig/kj.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/batman/one/external/capnp -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: KJ Framework Library -Description: Basic utility library called KJ -Version: 0.6.1 -Libs: -L${libdir} -lkj -pthread -lpthread -Cflags: -I${includedir} -pthread diff --git a/phonelibs/fastcv/aarch64/include/fastcv.h b/phonelibs/fastcv/aarch64/include/fastcv.h deleted file mode 100644 index 4827b2b6f9..0000000000 --- a/phonelibs/fastcv/aarch64/include/fastcv.h +++ /dev/null @@ -1,34089 +0,0 @@ -#ifndef FASTCV_H -#define FASTCV_H - -/**============================================================================= - -@file - fastcv.h - -@brief - Public API - - -Copyright (c) 2011-2015 Qualcomm Technologies, Inc. -All Rights Reserved. -Confidential and Proprietary - Qualcomm Technologies, Inc. - -=============================================================================**/ - -/**============================================================================= -@mainpage FastCV Public API Documentation - -@version 1.7.1 - -@section Overview Overview - -FastCV provides two main features to computer vision application developers: - - First, it provides a library of frequently used computer vision (CV) - functions, optimized to run efficiently on mobile devices. - - Second, it provides a clean processor-agnostic hardware acceleration API, - under which chipset vendors can hardware accelerate FastCV functions on - their hardware. - -FastCV 1.7.1 supports Android and Windows mobile developers. -FastCV 1.7.1 is available for download for free from developer.qualcomm.com. - -FastCV 1.7.1 is released as a unified binary, a single binary containing two -implementations of the library. - - The first implementation runs on ARM processor, and is referred to as - the "FastCV for ARM." - - The second implementation runs only on Qualcomm Snapdragon - chipsets, and is called "FastCV for Snapdragon." - -Releases are generally motivated for the following reasons: - - Changes to previously released APIs - - Addition of new functions - - Performance improvements and/or bug fixes - also known as implementation - modifications - - Each motivation has a varying degree of impact on the user of the library. - The general release numbering scheme captures this variety of motivations. - - Given release ID: A.B.C - - An increase in "A" indicates that a previously released API has changed, - so a developer may encounter compilation issues which require modification - of their code in order to adhear to the modified API. Qualcomm will make - every effort to minimize these changes. Additionally, new functions and - implementation modifications may be present. - - An increase in "B" indicates that new functions have been added to the - library, so additional functionality is available, however existing APIs - have not changed. Additionally, implementation modifications may be - present. - - An increase in "C" indicates that implementation modifications only have - been made. - -@defgroup math_vector Math / Vector Operations -@details Commonly used vector & math functions - -@defgroup image_processing Image processing -@details Image filtering, convolution and scaling operations - -@defgroup image_transform Image transformation -@details Warp perspective, affine transformations - -@defgroup feature_detection Feature detection -@details Fast corner detection, harris corner detection, canny edge detection, etc. - -@defgroup object_detection Object detection -@details Object detection functions such as NCC template match, etc. - -@defgroup 3D_reconstruction 3D reconstruction -@details Homography, pose evaluation functions - -@defgroup color_conversion Color conversion -@details Commonly used formats supported: e.g., YUV, RGB, YCrCb, etc. - -@defgroup clustering_and_search Clustering and search -@details K clusters best fitting of a set of input points - -@defgroup Motion_and_Object_Tracking Motion and object tracking -@details Supports and tracking functions - -@defgroup Structural_Analysis_and_Drawing Shape and drawing -@details Contour and polygon drawing functions - -@defgroup mem_management Memory Management -@details Functions to allocate and deallocate memory for use with fastCV. - -@defgroup misc Miscellaneous -@details Support functions - -@defgroup machine_learning Machine Learning -@details Machine learning functions such as SVM prediction, etc. - -**/ - -//============================================================================== -// Defines -//============================================================================== - -#ifdef __GNUC__ - /// Macro to align memory at 4-bytes (32-bits) for GNU-based compilers. - #define FASTCV_ALIGN32( VAR ) (VAR) __attribute__ ((aligned(4))) - /// Macro to align memory at 8-bytes (64-bits) for GNU-based compilers. - #define FASTCV_ALIGN64( VAR ) (VAR) __attribute__ ((aligned(8))) - /// Macro to align memory at 16-bytes (128-bits) for GNU-based compilers. - #define FASTCV_ALIGN128( VAR ) (VAR) __attribute__ ((aligned(16))) - #ifdef BUILDING_SO - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __attribute__ ((visibility ("default"))) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#else - /// Macro to align memory at 4-bytes (32-bits) for MSVC compiler. - #define FASTCV_ALIGN32( VAR ) __declspec(align(4)) (VAR) - /// Macro to align memory at 8-bytes (64-bits) for MSVC compiler. - #define FASTCV_ALIGN64( VAR ) __declspec(align(8)) (VAR) - /// Macro to align memory at 16-bytes (128-bits) for MSVC compiler. - #define FASTCV_ALIGN128( VAR ) __declspec(align(16)) (VAR) - #ifdef BUILDING_DLL - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __declspec(dllexport) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#endif - -//============================================================================== -// Included modules -//============================================================================== - -#include -#include -typedef float float32_t; -typedef double float64_t; - -//============================================================================== -// Declarations -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines operational mode of interface to allow the end developer to -/// dictate how the target optimized implementation should behave. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Target-optimized implementation uses lowest power consuming - /// implementation. - FASTCV_OP_LOW_POWER = 0, - - /// Target-optimized implementation uses highest performance implementation. - FASTCV_OP_PERFORMANCE = 1, - - /// Target-optimized implementation offloads as much of the CPU as possible. - FASTCV_OP_CPU_OFFLOAD = 2, - - /// Target-optimized implementation uses CPU highest performance implementation. - FASTCV_OP_CPU_PERFORMANCE = 3, - - /// Values >= 0x80000000 are reserved - FASTCV_OP_RESERVED = 0x80000000 - -} fcvOperationMode; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the flip directions for matrix flip functions. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Flip horizontally. - FASTCV_FLIP_HORIZ = 1, - - /// Flip vertically. - FASTCV_FLIP_VERT = 2, - - /// Flip horizontally and vertically. - FASTCV_FLIP_BOTH = 3 - -} fcvFlipDir; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the clockwise rotation degrees for image rotation functions. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Rotate 90 degrees clockwise. - FASTCV_ROTATE_90 = 1, - - /// Rotate 180 degrees clockwise. - FASTCV_ROTATE_180 = 2, - - /// Rotate 270 degrees clockwise. - FASTCV_ROTATE_270 = 3 - -} fcvRotateDegree; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the interpolation types. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Nearest neighbor interpolation - FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR = 0, - - /// Bilinear interpolation - FASTCV_INTERPOLATION_TYPE_BILINEAR, - - /// Interpolation by area - FASTCV_INTERPOLATION_TYPE_AREA - -} fcvInterpolationType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the policy to handle integer overflow. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Do nothing to the overflow. - /// Let the overflowed number wrap around. - /// May save runtime if overflow unlikely to occur, - /// or users do not care about overflow. - FASTCV_CONVERT_POLICY_WRAP = 0, - - /// Clamped to the maximum interger if overflow, - /// clamped to the minimum integer if underflow. - /// May require more runtime than FASTCV_CONVERT_POLICY_WRAP. - FASTCV_CONVERT_POLICY_SATURATE - -} fcvConvertPolicy; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the border types. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Border behavior undefined, left to the implementation. - FASTCV_BORDER_UNDEFINED = 0, - - /// For out-of-bound pixels, apply a user-specified constant value. - FASTCV_BORDER_CONSTANT, - - /// For out-of-bound pixels, apply values from the nearest edge pixels. - FASTCV_BORDER_REPLICATE - -} fcvBorderType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the norm for a vector. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// L1 norm. The norm is the sum of absolute values of every component in a vector. - FASTCV_NORM_L1, - - /// L2 norm, i.e., the Euclidean norm of a vector. - FASTCV_NORM_L2 - -} fcvNormType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines all supported channel indices -//------------------------------------------------------------------------------ - -typedef enum -{ - /// The first channel of the image. - FASTCV_CHANNEL_0, - - /// The second channel of the image. - FASTCV_CHANNEL_1, - - /// The third channel of the image. - FASTCV_CHANNEL_2, - - /// The fourth channel of the image. - FASTCV_CHANNEL_3, - - /// The RED channel of the image. - FASTCV_CHANNEL_R, - - /// The GREEN channel of the image. - FASTCV_CHANNEL_G, - - /// The BLUE channel of the image. - FASTCV_CHANNEL_B, - - /// The ALPHA channel of the image. - FASTCV_CHANNEL_A, - - /// The LUMA channel of the image. - FASTCV_CHANNEL_Y, - - /// The Cb/U channel of the image. - FASTCV_CHANNEL_U, - - /// The Cr/V/Value channel of the image. - FASTCV_CHANNEL_V - -} fcvChannelType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines all supported image formats based on the FOURCC definition -//------------------------------------------------------------------------------ - -typedef enum -{ - /// A single plane of 24 bit pixel as 3 interleaved 8 bit units of R then G then B data. - FASTCV_RGB, - - /// A single plane of 32 bit pixel as 4 interleaved 8 bit units of R then G then B data, then a ”don’t care?byte. - FASTCV_RGBX, - - /// A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling. - /// For a frame of width W and height H, Y plane has the size of W * H, while the UV plane has the size of W * H/2. - /// The extracted U or V plane is then expected to be W/2 * H/2. - FASTCV_NV12, - - /// A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling. - /// For a frame of width W and height H, Y plane has the size of W * H, while the VU plane has the size of W * H/2. - /// The extracted U or V plane is then expected to be W/2 * H/2. - FASTCV_NV21, - - /// A single plane of 32 bit macro pixel of U0, Y0, V0, Y1 bytes. - /// For a frame of width W and height H, its buffer size is at least 2*W * H. - /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. - FASTCV_UYVY, - - /// A single plane of 32 bit macro pixel of Y0, U0, Y1, V0 bytes. - /// For a frame of width W and height H, its buffer size is at least 2*W * H. - /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. - FASTCV_YUYV, - - /// A 3 plane of 8 bit 4:2:0 sampled Y, U, V planes. - /// For a frame of width W and height H, Y plane has the size of W * H, while the U or I plane each has a size of W/2 * H/2. - FASTCV_IYUV, - - /// A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes. - /// For a frame of width W and height H, Y or U or V plane each has the size of W * H. - FASTCV_YUV4 - -} fcvImageFormat; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the status returned by a function. -//------------------------------------------------------------------------------ -typedef enum -{ - //// Success - FASTCV_SUCCESS = 0, - - /// General failure - FASTCV_EFAIL, - - /// Unaligned pointer parameter - FASTCV_EUNALIGNPARAM, - - /// Bad parameters - FASTCV_EBADPARAM, - - /// Called at invalid state - FASTCV_EINVALSTATE, - - /// Insufficient resources, memory, thread... - FASTCV_ENORES, - - /// Unsupported feature - FASTCV_EUNSUPPORTED, - - /// Hardware QDSP failed to respond - FASTCV_EHWQDSP, - - /// Hardware GPU failed to respond - FASTCV_EHWGPU - -} fcvStatus; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the kernel functions of SVM prediction. -//------------------------------------------------------------------------------ -typedef enum -{ - FASTCV_SVM_LINEAR, - FASTCV_SVM_POLY, - FASTCV_SVM_RBF, - FASTCV_SVM_SIGMOID -} fcvSVMKernelType; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the different scaling options for the pyramid -//------------------------------------------------------------------------------ -typedef enum -{ - FASTCV_PYRAMID_SCALE_HALF, - FASTCV_PYRAMID_SCALE_ORB -} fcvPyramidScale; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the termination criteria list. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Indicates a termination after a set number of iterations - FASTCV_TERM_CRITERIA_ITERATIONS, - - /// Indicates a termination after matching against the value of eplison provided to the function - FASTCV_TERM_CRITERIA_EPSILON, - - /// Indicates that both an iterations and eplison method are employed. Whichever one matches first causes the termination. - FASTCV_TERM_CRITERIA_BOTH, -} fcvTerminationCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the normalization method in the HOG extraction process -//------------------------------------------------------------------------------ -typedef enum -{ - /// Do the regular normalization method - FASTCV_HOG_NORM_REGULAR = 0, - - /// Do re-normalization - FASTCV_HOG_NORM_RENORMALIZATION = 1, - - /// Use F-HOG method - FASTCV_HOG_NORM_FHOG = 2, - -} fcvHOGNormMethod; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the vaiance estimator type -//------------------------------------------------------------------------------ -typedef enum -{ - /// Sums the squared deviation and devides by (n-1) - /// As known as sample variance - FASTCV_UNBIASED_VARIANCE_ESTIMATOR = 0, - - /// Sums the squared deviation and devides by n - /// As known as population variance - FASTCV_BIASED_VARIANCE_ESTIMATOR = 1, - -} fcvVarianceEstimator; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a structure to contain points correspondence data. -//------------------------------------------------------------------------------ -typedef struct -{ - /// Tuples of 3 values: xFrom,yFrom,zFrom. Float array which this points to - /// must be greater than or equal to 3 * numCorrespondences. - const float32_t* from; - /*~ FIELD fcvCorrespondences.from - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.fromStride ? fcvCorrespondences.fromStride : 3) ) */ - - /// Tuples of 2 values: xTo,yTo. Float array which this points to - /// must be greater than or equal to 2 * numCorrespondences. - const float32_t* to; - /*~ FIELD fcvCorrespondences.to - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.toStride ? fcvCorrespondences.toStride : 2) ) */ - - /// Distance in bytes between two coordinates in the from array. - /// If this parameter is set to 2 or 3, a dense array is assume (stride will - /// be sizeof(float) times 2 or 3). The minimum value of fromStride - /// should be 2. - uint32_t fromStride; - - /// Distance in bytes between two coordinates in the to array. - /// If this parameter is set to 2, a dense array is assume (stride will - /// be 2 * sizeof(float)). The minimum value of toStride - /// should be 2. - uint32_t toStride; - - /// Number of points in points correspondences. - uint32_t numCorrespondences; - - /// Array of inlier indices for corrs array. Processing will only occur on - /// the indices supplied in this array. Array which this points to must be - /// at least numIndices long. - const uint16_t* indices; - /*~ FIELD fcvCorrespondences.indices VARRAY LENGTH (fcvCorrespondences.numIndices) */ - - /// Length of indices array. - uint32_t numIndices; -} fcvCorrespondences; - - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; -} fcvPyramidLevel ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level (version2 with stride) -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; - unsigned int stride; -} fcvPyramidLevel_v2 ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure describing node of a tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodef32 -{ - /// the split value at the node - float32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodef32; - -// ----------------------------------------------------------------------------- -/// @brief -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchf32 -{ - /// square of minimal distance from query for all nodes below - float32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchf32; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8f32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const float32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indice of root nodes of trees - int32_t* trees; - - /// array of nodes of all trees - fcvKDTreeNodef32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchf32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8f32; - - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure describing node of tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodes32 -{ - /// the split value at the node - int32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodes32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchs32 -{ - /// square of minimal distance from query for all nodes below - int32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchs32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8s32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const int32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indices of root nodes of all trees - int32_t* trees; - - /// number of trees used - int32_t numTrees; - - /// array of nodes of all trees - fcvKDTreeNodes32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchs32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8s32; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of rectangle -//------------------------------------------------------------------------------ -typedef struct -{ - ///x-coordinate of the top-left corner - int32_t x; - ///y-coordinate of the top-left corner - int32_t y; - ///width of the rectangle - uint32_t width; - ///height of the rectangle - uint32_t height; -} fcvRectangleInt; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of termination criteria -//------------------------------------------------------------------------------ -typedef struct -{ - /// Maxmimum number of iteration - int32_t max_iter; - /// - float32_t epsilon; -}fcvTermCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of 2D box used for tracking -//------------------------------------------------------------------------------ -typedef struct -{ - // Center of the box - ///x-coordinate of the 2D point - int32_t x; - ///y-coordinate of the 2D point - int32_t y; - // The box size - int32_t columns; - int32_t rows; - // The orientation of the principal axis - int32_t orientation; -}fcvBox2D; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of image moments -//------------------------------------------------------------------------------ -typedef struct { - // spatial moments - float32_t m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; - // central moments - float32_t mu20, mu11, mu02, mu30, mu21, mu12, mu03; - // m00 != 0 ? 1/sqrt(m00) : 0 - float32_t inv_sqrt_m00; -} fcvMoments; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of code word -//------------------------------------------------------------------------------ -typedef struct fcvBGCodeWord -{ - /// Pointer to next codebook element - struct fcvBGCodeWord* next; - - /// Last update time - int32_t tLastUpdate; - - /// Longest period of inactivity - int32_t stale; - /// Min value of pixel for each channel - uint8_t min0, min1, min2; - - /// Max value of pixel for each channel - uint8_t max0, max1, max2; - - /// Min value of learning boundary for each channel - uint8_t learnLow0, learnLow1, learnLow2; - - /// Max value of learning boundary for each channel - uint8_t learnHigh0, learnHigh1, learnHigh2; -} fcvBGCodeWord; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for circle -//------------------------------------------------------------------------------ -typedef struct fcvCircle -{ - int32_t x; - int32_t y; - int32_t radius; -} fcvCircle; - - -typedef struct fcvPoint2D -{ - float x; - float y; -} fcvPoint2D; - -typedef struct fcvLine -{ - fcvPoint2D start; - fcvPoint2D end; -} fcvLine; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for parameters for line segment detection -//------------------------------------------------------------------------------ -typedef struct fcvLineSegment { - fcvPoint2D start, end; ///< Two ending points - float32_t normal[2]; ///< Orientation, average of the gradient direction - uint32_t nPoints; ///< (Optional) Number of pixels in pointsList - int32_t pointsStartIndex; ///< (Optional) Starting index of the pixel positions contributed to line segment fitting stored in indexBuffer - uint32_t sumMag; ///< Sum of all pixels gradient magnitude -} fcvLineSegment; - - -//------------------------------------------------------------------------------ -/// @brief -/// Parameters for fusing a depth map into a cuboid fusion block -/// -/// @details -/// This structure describes a single cuboid block that shall be fused -/// with data from a depth map. All coordinates must be pre-transformed -/// into the coordinate frame of the depth frame. -/// -//------------------------------------------------------------------------------ -typedef struct fcvDepthFusionBlockConfig { - uint32_t flags; ///< Option specified as a bit field - 0x0000:N/A, 0x0001:run clipping - float32_t ramp; ///< Fusion ramp: maximum allowed distance between volume sample position and depth map sample position - float32_t p0[3], ///< Location of the 1st sample in the volume - dX[3], ///< One sample step in X-direction in the volume - dY[3], ///< One sample step in Y-direction in the volume - dZ[3]; ///< One sample step in Z-direction in the volume - uint32_t volumeIndex; ///< Index of the volume to be updated -} fcvDepthFusionBlockConfig; - -//============================================================================== -// UTILITY FUNCTIONS -//============================================================================== - -#ifdef __cplusplus -extern "C" -{ -#endif - -//------------------------------------------------------------------------------ -/// @brief -/// Retrieves version of FastCV library. -/// -/// @param version -/// Pointer to location to put string. -/// -/// @param versionLength -/// Length of storage for version string. -/// -/// @ingroup misc -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGetVersion( char* version, - unsigned int versionLength ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Selects HW units for all routines at run-time. -/// \n\b WARNING: Should be called once at the very beginning to update mode -/// -/// @param mode -/// See enum for details. -/// -/// @return -/// 0 if successful. -/// 999 if minmum HW requirement not met. -/// other #'s if unsuccessful. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvSetOperationMode( fcvOperationMode mode ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Clean up FastCV resources. Must be called before the program exits. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCleanUp( void ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidAllocate_v2(). In the 2.0.0 release, -/// fcvPyramidAllocate_v2 will be renamed to fcvPyramidAllocate -/// and the signature of fcvPyramidAllocate as it appears now, -/// will be removed. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate( fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidAllocate() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidAllocate, -/// \a fcvPyramidAllocate_v2 will be removed, and the current signature -/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel_v2 -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param baseStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// Stride of the base level: the value assigned to pyr[0].stride -/// \n \b NOTE: stride of non-base pyramid image is the same as -/// width*bytesPerPixel of the non-base pyramid image -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate_v2( fcvPyramidLevel_v2* pyr, - uint32_t baseWidth, - uint32_t baseHeight, - uint32_t baseStride, - uint32_t bytesPerPixel, - uint32_t numLevels, - int32_t allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidAllocate_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidAllocate, -/// \a fcvPyramidAllocate_v3 will be removed, and the current signature -/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel_v2 -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param baseStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// Stride of the base level: the value assigned to pyr[0].stride -/// \n \b NOTE: stride of non-base pyramid image is the same as -/// width*bytesPerPixel of the non-base pyramid image -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param alignment -/// Used to specify the alignment of each pyramid level other than the base. Must be a multiple -/// of 8. If set to 0, the alignment will be set as 8 bits. -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param scale -/// Defines the type of scaling used for each pyramid level. -/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. -/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), -/// which is approximated as 0.8408964f -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete_v2 for details. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPyramidAllocate_v3(fcvPyramidLevel_v2* __restrict pyr, - uint32_t baseWidth, - uint32_t baseHeight, - uint32_t baseStride, - uint32_t bytesPerPixel, - uint32_t alignment, - uint32_t numLevels, - fcvPyramidScale scale, - int32_t allocateBase); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidDelete_v2(). In the 2.0.0 release, -/// fcvPyramidDelete_v2 will be renamed to fcvPyramidDelete -/// and the signature of fcvPyramidDelete as it appears now, -/// will be removed. -/// \n\n -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete( fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidDelete() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidDelete, -/// \a fcvPyramidDelete_v2 will be removed, and the current signature -/// for \a fcvPyramidDelete will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidDelete when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete_v2 has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete_v2( fcvPyramidLevel_v2* pyr, - uint32_t numLevels, - uint32_t startLevel ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates aligned memory. -/// -/// @param nBytes -/// Number of bytes. -/// -/// @param byteAlignment -/// Alignment specified in bytes (e.g., 16 = 128-bit alignment). -/// \n\b WARNING: must be < 255 bytes -/// -/// @return -/// SUCCESS: pointer to aligned memory -/// FAILURE: 0 -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void* -fcvMemAlloc( unsigned int nBytes, - unsigned int byteAlignment ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Frees memory allocated by fcvMemAlloc(). -/// -/// @param ptr -/// Pointer to memory. -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvMemFree( void* ptr ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Initialize the Memory sub-system in FastCV. The sub-system handles -/// temporary/scratch memory requirements from several FastCV functions -/// that do not have parameters to have this supplied by the users of those -/// functions. -/// -/// \b Important: -/// \n 1. Every call to this function should be followed by a call to -/// fcvMemDeInit(). -/// \n 2. This function (and the fcvMemDeInit) only needs to called once per -/// process. -/// \n 3. Any call to FastCV functions that uses internal temporary memory -/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory -/// allocation. -/// \n 4. A call to this function without a corresponding call to fcvMemDeInit -/// can result in memory leak. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemInit(void); - -// ----------------------------------------------------------------------------- -/// @brief -/// Initialize the Memory sub-system in FastCV with pre-allocated buffer. -/// The sub-system handles temporary/scratch memory requirements from several -/// FastCV functions that do not have parameters to have this supplied by the -/// users of those functions. -/// -/// \b Important: -/// \n 1. Every call to this function should be followed by a call to -/// fcvMemDeInit(). -/// \n 2. This function (and the fcvMemDeInit) only needs to called once per -/// process. -/// \n 3. Any call to FastCV functions that uses internal temporary memory -/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory -/// allocation. -/// \n 4. A call to this function without a corresponding call to fcvMemDeInit -/// can result in memory leak. -/// -/// @param preAllocBytes -/// Number of bytes for the pre-allocated buffer. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemInitPreAlloc( uint32_t preAllocBytes ); - -// ----------------------------------------------------------------------------- -/// @brief -/// De-Initialize the Memory sub-system initialized by fcvMemInit() function. -/// -/// \b Important: -/// \n 1. Call to this function without a corresponding call to fcvMemInit will -/// result in no-op. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemDeInit(void); - -//End - Utility functions - - -//============================================================================== -// FUNCTIONS -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterMedian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterMedian3x3u8_v2 will be renamed to fcvFilterMedian3x3u8 -/// and the signature of fcvFilterMedian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dstImg ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian3x3u8_v2 will be renamed to fcvFilterGaussian3x3u8 -/// and the signature of fcvFilterGaussian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Destination buffer size is srcWidth*srcHeight. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5u8_v2 will be renamed to fcvFilterGaussian5x5u8 -/// and the signature of fcvFilterGaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5u8, -/// \a fcvFilterGaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian11x11u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian11x11u8_v2 will be renamed to fcvFilterGaussian11x11u8 -/// and the signature of fcvFilterGaussian11x11u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian11x11u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian11x11u8, -/// \a fcvFilterGaussian11x11u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian11x11u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian11x11u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved) to RGB 8888. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorYCrCb420PseudoPlanarToRGB8888u8. In the 2.0.0 release, -/// the signature of fcvColorYUV420toRGB8888u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R is at LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved CrCb) to RGB 888. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV picture. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcYStride -/// Stride (in bytes) of input image Y component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2). -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param srcCStride -/// Stride (in bytes) of input image Chroma component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2) -/// \n\b WARNING: should be multiple of 4 (4 * 1-byte values). -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R in LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output RGB image (i.e., number of bytes between column 0 of -/// row 1 and column 0 of row 2) -/// \n\b WARNING: should be multiple of 32 (8 * 4-byte values). -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCbCr) 4:2:0 PesudoPlanar (Interleaved CbCr) to RGB 565. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CbCr plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cb0 Cr0 Cb1 Cr1 ... -/// -/// @param dst -/// 16-bit image of output RGB 565 values. R in LSBs. -/// 2 pixels are packed into one 32-bit output -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 4 -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB565u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V1 (YCbCr 4:4:4 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit image of input values. Stored as YCbCr H1V1 planar format in 8x8 blocks for Y,Cb,Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V2 (YCbCr 4:2:0 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H2V2 planar format in 16x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V2toRGB888u8( const uint8_t* __restrict ysrc, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V1 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit input values. Stored as YCbCr H2V1 planar format in 16x8 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V2 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H1V2 planar format in 8x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V2toRGB888u8( const uint8_t* __restrict ysrc, - - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorRGB888toYCrCbu8_v2(). In the 2.0.0 release, -/// fcvColorRGB888toYCrCbu8_v2 will be renamed to fcvColorRGB888toYCrCbu8 -/// and the signature of fcvColorRGB888toYCrCbu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb 4:4:4 (Full interleaved, similar to -/// 3-channel RGB). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvColorRGB888toYCrCbu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvColorRGB888toYCrCbu8, -/// \a fcvColorRGB888toYCrCbu8_v2 will be removed, and the current signature -/// for \a fcvColorRGB888toYCrCbu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvColorRGB888toYCrCbu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Create a 36-dimension gradient based descriptor on 17x17 patch. -/// -/// @details -/// -/// @param patch -/// Input luminance data for 17x17 patch to describe. -/// -/// @param descriptorChar -/// Output descriptor vector. 36 x 8-bit vector. Normalized and quantized to range [-127, 127] -/// -/// @param descriptorNormSq -/// Output squared norm (L2 norm) of the descriptor vector. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector A. -/// -/// @param b -/// Vector B. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct36x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct36x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct64x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct128x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct128x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with several (n) 8x8 squares -/// along a line of pixels in an image. -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the source image. -/// -/// @param imgH -/// Height in pixels of the source image. -/// -/// @param nX -/// X location on image of starting search pixel. -/// -/// @param nY -/// Y location on image of starting search pixel. -/// -/// @param nNum -/// Number of pixels (in X direction) on image to sweep. -/// -/// @param dotProducts -/// Output dot product values of nNum pixels. -/// \n\b WARNING: array size must be a multiple of 4 (e.g., 4, 8, 12, ...) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct8x8u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int nX, - int nY, - unsigned int nNum, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with 8x8 squares in 11x12 -/// rectangle around the center search pixel (iX,iY). -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the image. -/// -/// @param imgH -/// Height in pixels of the image. -/// -/// @param iX -/// X location on image of the center of the search window. -/// -/// @param iY -/// Y location on image of the center of the search window. -/// -/// @param dotProducts -/// Output 11x12 dot product values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct11x12u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int iX, - int iY, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterSobel3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterSobel3x3u8_v2 will be renamed to fcvFilterSobel3x3u8 -/// and the signature of fcvFilterSobel3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image of |dx|+|dy|. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterSobel3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterSobel3x3u8, -/// \a fcvFilterSobel3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterSobel3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterSobel3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image of |dx|+|dy|. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCanny3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterCanny3x3u8_v2 will be renamed to fcvFilterCanny3x3u8 -/// and the signature of fcvFilterCanny3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// is set to 3. This function will output the edge, since its working with a -/// 3x3 window, it leaves one row/col of pixels at the corners -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is in the extension lib. -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v3 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gx -/// gradient in X direction. -/// \n\b NOTE: use NULL if do not need the gradient output. -/// -/// @param gy -/// gradient in Y direction. -/// \n\b NOTE: use NULL if do not need the gradient output. -/// -/// @param gradStride -/// Output stride for gx and gy. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFilterCanny3x3u8_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int16_t* __restrict gx, - int16_t* __restrict gy, - unsigned int gradStride, - int lowThresh, - int highThresh ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageDiffu8_v2(). In the 2.0.0 release, -/// fcvImageDiffu8_v2 will be renamed to fcvImageDiffu8 -/// and the signature of fcvImageDiffu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Destination. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageDiffu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageDiffu8, -/// \a fcvImageDiffu8_v2 will be removed, and the current signature -/// for \a fcvImageDiffu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageDiffu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//-------------------------------------------------------------------------- -/// @brief -/// Compute image difference src1-src2 -/// -/// @param src1 -/// Input image1 of int16 type. Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image2, must have same size as src1 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output image, saturated for int16 type. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -////------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by promoting both src1 and src 2 to -/// floating point values and then subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Destination image in float type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. -/// dst = ( src1 >> 1) - ( src2 >> 1). -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Destination image in int8 type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleaveds16_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleaveds16_v2 will be renamed to fcvImageGradientInterleaveds16 -/// and the signature of fcvImageGradientInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientInterleaveds16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleaveds16, -/// \a fcvImageGradientInterleaveds16_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleaveds16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @param gradStride -/// Stride in bytes of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as 4*(srcWidth-2). -/// \n\b WARNING: should be multiple of 16 ( 8 * 2-byte values ), and at least as much as 4*(srcWidth-2) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize MSER. To invoke MSER functionality, 3 functions have to be called: -/// fcvMserInit, fcvMseru8, fcvMserRelease. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMseru8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param width -/// Width of the image for which MSER has to be done. -/// -/// @param height -/// Height of the image for which MSER has to be done. -/// -/// @param delta -/// Delta to be used in MSER algorithm (the difference in grayscale values -/// within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// -/// @param minArea -/// Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// -/// @param maxArea -/// Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// -/// @param maxVariation -/// Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// -/// @param minDiversity -/// Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// -/// @param mserHandle -/// Output. the mserHandle to be used in subsequent calls. -/// -/// @return -/// 1 if successful. -/// 0 if unsuccessful, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea, - unsigned int maxArea, - float maxVariation, - float minDiversity, - void ** mserHandle ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to release MSER resources. -/// -/// @param mserHandle -/// Handle to be used to free up MSER resources. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserRelease(void *mserHandle); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMseru8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMseru8_v2(). In the 2.0.0 release, -/// fcvMseru8_v2 will be renamed to fcvMseru8. -/// and the signature of fcvMseru8 as it appears now, will be removed. -/// \n\n -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up for the -/// first (*numContours) values. This memory has to be allocated by the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, - unsigned int * __restrict numPointsInContour, - unsigned int pointsArraySize, - unsigned int * __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER, with additional outputs for each contour. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMserExtu8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMserExtu8_v2(). In the 2.0.0 release, -/// fcvMserExtu8_v2 will be renamed to fcvMserExtu8. -/// and the signature of fcvMserExtu8 as it appears now, will be removed. -/// \n\n -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// Application dependent. OCR usually requires 100-1000 contours. -/// Segmentation usually requires 50-100 -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image)*30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region; -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, - unsigned int * __restrict numPointsInContour, - unsigned int * __restrict pointsArray, - unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint and the (optional) output of contour bound boxes. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMseru8_v2 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMseru8_v2( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint, -/// the (optional) output of contour bound boxes, and additional information. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtu8_v2 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtu8_v2( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint, -/// the (optional) output of contour bound boxes, and additional information. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtu8_v3 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param staPointsInPath -/// Output. Return the index of contour starting points in pathArray. -/// This memory has to be allocated by the caller. The allocated size should be maxContours*sizeof(uint32_t). -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pathArraySize -/// Input. The size of output pathArray in terms of how many uint16_t numbers. Must be srcWidth*srcHeight*4. -/// Note: this parameter is not measured in terms of bytes. -/// -/// @param pathArray -/// Output. This is the compressed representation of points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pathArraySize*sizeof(uint16_t). -/// For example: -/// pathArray[ staPointsInPath[0] ] : x coord of the FIRST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 1 ] : y coord of the FIRST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 2 ] : x coord of the SECOND point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 3 ] : y coord of the SECOND point in the FIRST mser region. -/// . . . -/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 2 ] : x coord of the LAST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 1 ] : y coord of the LAST point in the FIRST mser region. -/// and -/// pathArray[ staPointsInPath[1] ] : x coord of the FIRST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 1 ] : y coord of the FIRST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 2 ] : x coord of the SECOND point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 3 ] : y coord of the SECOND point in the SECOND mser region. -/// . . . -/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 2 ] : x coord of the LAST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 1 ] : y coord of the LAST point in the SECOND mser region. -/// . . . -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtu8_v3( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict staPointsInPath, - uint32_t* __restrict numPointsInContour, - uint32_t pathArraySize, - uint16_t* __restrict pathArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize 8-neighbor MSER. To invoke 8-neighbor MSER functionality, 3 functions have to be called: -/// fcvMserNN8Init, fcvMserNN8u8, fcvMserRelease. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param width -/// Width of the image for which MSER has to be done. -/// -/// @param height -/// Height of the image for which MSER has to be done. -/// -/// @param delta -/// Delta to be used in MSER algorithm (the difference in grayscale values -/// within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// -/// @param minArea -/// Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// -/// @param maxArea -/// Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// -/// @param maxVariation -/// Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// -/// @param minDiversity -/// Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// -/// @param mserHandle -/// Output. the mserHandle to be used in subsequent calls. -/// -/// @return -/// 1 if successful. -/// 0 if unsuccessful, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserNN8Init(const uint32_t width, - const uint32_t height, - uint32_t delta, - uint32_t minArea , - uint32_t maxArea , - float32_t maxVariation , - float32_t minDiversity , - void **mserHandle ); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke 8-neighbor MSER. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up for the -/// first (*numContours) values. This memory has to be allocated by the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserNN8u8 ( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke 8-neighbor MSER, , with additional outputs for each contour. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtNN8u8(void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleavedf32_v2 will be renamed to fcvImageGradientInterleavedf32 -/// and the signature of fcvImageGradientInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleavedf32, -/// \a fcvImageGradientInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: should be multiple of 32 ( 8 * 4-byte values ), and at least as much as 8 * srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanars16_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanars16_v2 will be renamed to fcvImageGradientPlanars16 -/// and the signature of fcvImageGradientPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientPlanars16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanars16, -/// \a fcvImageGradientPlanars16_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanars16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanarf32_v2 will be renamed to fcvImageGradientPlanarf32 -/// and the signature of fcvImageGradientPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanarf32, -/// \a fcvImageGradientPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride of Gradient values ('dx' and 'dy' arrays) measured in bytes. -/// \n\b NOTE: if 0, srcStride is set as 4*srcWidth. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value), and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold ); - -//------------------------------------------------------------------------------ -/// @brief -/// Local Harris Max applies the Harris Corner algorithm on an 11x11 patch -/// within an image to determine if a corner is present. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If srcStride == 0, then will use srcWidth. -/// -/// @param posX -/// Center X coordinate of the search window -/// -/// @param posY -/// Center Y coordinate of the search window -/// -/// @param maxX -/// pointer to the X coordinate identified as a corner -/// -/// @param maxY -/// pointer to the Y coordinate identified as a corner -/// -/// @param maxScore -/// pointer to the Harris score associated with the corner -/// -/// @return -/// 0 if no corner is found (maxX, maxY, and maxScore are invalid) -/// or if posX and/or posY position the patch outside of the range of -/// the source image. -/// 1 if a corner is found (maxX, maxY, and maxScore are valid) -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API unsigned int -fcvLocalHarrisMaxu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Respose" of a pixel for it to be -/// regarded as a corner. -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisInMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). It is an improved version -/// which is more robust to low contrast images. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisAdaptiveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t border, - float32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - int32_t threshold); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. -/// \n\b ATTENTION: Compared to fcvCornerHarrisu8, this API gives more accurate results -/// in exchange for slower execution time.\n\n -/// -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// @details -/// This function extracts Harris Corner features from the image. The input is -/// an unsigned 8 bit image. Based on the values of the kernel size, the block size, -/// the sensitivity, the function generates a Harris Response map (Harris Score). -/// This map is then thresholded using the threshold parameter to locate local maxima. -/// Additionally, if the Non Maximum Suppression flag is enabled, the function performs -/// non maximum suppression of the thresholded response using the min distance parameter -/// to calculate the neighborhood. -/// -/// @param src -/// Input unsigned 8 bit image from which corner features are to be detected -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input Image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param harrisResp -/// The computed Harris Response Map of the image. If the @param normalizeResponse flag is set, -/// then all values in the map are normalized between 0 and 255. If the @param normalizeResponse flag -/// is not set, then the map is not normalized to this range. -/// This buffer MUST be allocated as srcWidth*srcHeight*sizeof(float32_t). -/// -/// @param respStride -/// Harris response stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If respStride is equal to 0, -/// it will be set to srcWidth * sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y positions of the -/// detected corners. -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners that should be detected. The function exits when the -/// maximum number of corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. If the @param normalizeResponse flag is set, then this parameter MUST be a value between -/// 0 and 255. If the @param normalizeResponse flag is not set, then this parameter can be any value in the range of -/// int32_t. This parameter is used to threshold @param harrisResp to detect corner features. -/// -/// @param sensitivity -/// This parameter represents the sensitivity threshold from the Harris Stephens -/// equation. Typical values are between 0.04 and 0.06 -/// -/// @param kernelSize -/// Size of the Sobel Kernel used to compute the gradients from the input image -/// MUST be 3,5 or 7. -/// -/// @param blockSize -/// Size of an average block for computing a derivative covariation matrix over each -/// pixel neighborhood. -/// -/// @param nmsEnabled -/// A flag to enable or disable non maximum suppression. Set flag to 1 to enable it and -/// 0 to disable. -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param minDistance -/// The radial euclidean distance to perform non-maximum suppression. -/// -/// @param normalizeResponse -/// This parameter is a flag to enable or disable normalization of the harris response. -/// If it is set, then it enables normalization of the response to the range between 0 and 255. If it -/// is not set, then the response is NOT normalized to this range. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvCornerHarrisScoreu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict harrisResp, - uint32_t respStride, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - float32_t threshold, - float32_t sensitivity, - uint32_t kernelSize, - uint32_t blockSize, - uint32_t nmsEnabled, - float32_t minDistance, - uint32_t normalizeResponse); - - -//--------------------------------------------------------------------------- -/// @brief -/// Computes affine trans. for a given set of corresponding features points -/// using a linear least square colver based on Cholkesky decomposition. -/// -/// @param corrs -/// Correspondence data struct containing coords of points in two frames -/// -/// @param affine -/// 3 x 3 affine matrix (computed best fit affine transformation) -/// -/// @ingroup 3D_reconstruction -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified affine transformation against provided points -/// correspondences. Checks which correspondence members have a projection -/// error that is smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param affine -/// Affine matrix representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 if successfull -/// -1 if error value square is >= maxsqerr -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky homography fitting on specified points correspondences. -/// \n -/// \n [x_to] [ a11 a12 a13 ] [ x_from ] -/// \n [y_to] = [ a21 a22 a23 ] * [ y_from ] -/// \n [ 1 ] [ a31 a32 a33 ] [ 1 ] -/// \n note that all the correspondences are considered, if correspondence pairs -/// are smaller than 4, the API returns. If correspondence pairs are larger than -/// 4, the API takes all the correspondences into consideration using least -/// squared method. -/// -/// @details -/// Output precision is within 3e-3 -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// 3x3 floating point matrix formatted as @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvGeomHomographyEvaluatef32_v2(). In the 2.0.0 release, -/// fcvGeomHomographyEvaluatef32_v2 will be renamed to fcvGeomHomographyEvaluatef32 -/// and the signature of fcvGeomHomographyEvaluatef32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvGeomHomographyEvaluatef32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvGeomHomographyEvaluatef32, -/// \a fcvGeomHomographyEvaluatef32_v2 will be removed, and the current signature -/// for \a fcvGeomHomographyEvaluatef32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvGeomHomographyEvaluatef32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param errinliers -/// Output array for the error of indices of correspondences that passed -/// the test. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32_v2( const fcvCorrespondences* __restrict corrs, - float32_t* __restrict homography, - float32_t maxsqerr, - uint16_t* __restrict inliers, - float32_t*__restrict errinliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky pose fitting on specified points correspondences. -/// Takes a pose and uses the correspondences to refine it using iterative -/// Gauss-Newton optimization. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param minIterations -/// Minimum number of iterations to refine. -/// -/// @param maxIterations -/// Maximum number of iterations to refine. -/// -/// @param stopCriteria -/// Improvement threshold, iterations stop if improvement is less than this -/// value. -/// -/// @param initpose -/// Pose representing initial pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param refinedpose -/// Pose representing refined pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// Final reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update and compute the differential pose based on the specified points correspondences -/// This function and fcvGeomPoseOptimizeGNf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing differential pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update the pose based on the specified points correspondences -/// using Gauss-Newton optimization. This function and fcvGeomPoseEvaluateErrorf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseOptimizeGNf32( const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the reprojection error based on the input pose. -/// This function and fcvGeomPoseOptimizef32 can be used iteratively -/// to perform poseRefine (GN or LM).. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @return -/// Reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseEvaluateErrorf32( const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Checks which members have a projection error that is smaller than the -/// given one. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing relationship between ptTo and ptFrom -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param maxSquErr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numInliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Estimates a 6DOF pose -/// \n\b NOTE: Given the coordinates of three 3D points (in world reference frame), -/// and their corresponding perspective projections in an image, -/// this algorithm determines the position and orientation of the camera in -/// the world reference frame. The function provides up to four solutions -/// that can be disambiguated using a fourth point. -/// When used in conjunction with RANSAC, this function can perform efficient outlier rejection. -/// Two degenerate cases should be avoided when using this function: -/// - Indeterminate configuration: -/// When the three points are collinear in space, there will be a family of poses mapping the -/// three points to the same image points. -/// - Unstable configuration: -/// The camera center is located on a circular cylinder passing through the three points and -/// the camera optical axis is perpendicular to the plane derived by the three points. -/// With this configuration, a small change in the position of the three points will -/// result in a large change of the estimated pose.. -/// -/// @param corrs -/// 2D-3D correspondence points -/// -/// @param pose -/// computed pose (numPoses * 12 data) -/// -/// @param numPoses (max = 4) -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorr3x3s8_v2(). In the 2.0.0 release, -/// fcvFilterCorr3x3s8_v2 will be renamed to fcvFilterCorr3x3s8 -/// and the signature of fcvFilterCorr3x3s8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param dst -/// Output convolution. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorr3x3s8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorr3x3s8, -/// \a fcvFilterCorr3x3s8_v2 will be removed, and the current signature -/// for \a fcvFilterCorr3x3s8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorr3x3s8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output convolution. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. Border values are ignored in this function. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of float32_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth*sizeof(float32_t) if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8f32( const float32_t* __restrict kernel, - uint32_t N, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of int8_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param shift -/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(int16_t) bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int16_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth*sizeof(int16_t) if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8s16( const int8_t* __restrict kernel, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of int8_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param shift -/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8( const int8_t* __restrict kernel, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// 9x9 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep9x9s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep9x9s16_v2 will be renamed to fcvFilterCorrSep9x9s16 -/// and the signature of fcvFilterCorrSep9x9s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel in Q15. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmp -/// Temporary image buffer used internally. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep9x9s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmp, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 9x9 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep9x9s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep9x9s16, -/// \a fcvFilterCorrSep9x9s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep9x9s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep9x9s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Size = width * heigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 11x11 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep11x11s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep11x11s16_v2 will be renamed to fcvFilterCorrSep11x11s16 -/// and the signature of fcvFilterCorrSep11x11s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be >=12 elements with kernel[11]=0 -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Normalized to Q1.15 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep11x11s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 11x11 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep11x11s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep11x11s16, -/// \a fcvFilterCorrSep11x11s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep11x11s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep11x11s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 13x13 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep13x13s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep13x13s16_v2 will be renamed to fcvFilterCorrSep13x13s16 -/// and the signature of fcvFilterCorrSep13x13s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep13x13s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 13x13 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep13x13s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep13x13s16, -/// \a fcvFilterCorrSep13x13s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep13x13s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep13x13s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 15x15 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep15x15s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep15x15s16_v2 will be renamed to fcvFilterCorrSep15x15s16 -/// and the signature of fcvFilterCorrSep15x15s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep15x15s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 15x15 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep15x15s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep15x15s16, -/// \a fcvFilterCorrSep15x15s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep15x15s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep15x15s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 17x17 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep17x17s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep17x17s16_v2 will be renamed to fcvFilterCorrSep17x17s16 -/// and the signature of fcvFilterCorrSep17x17s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation.. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep17x17s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// 17x17 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep17x17s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep17x17s16, -/// \a fcvFilterCorrSep17x17s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep17x17s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep17x17s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// NxN correlation with separable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSize -/// Seperable kernel size. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterCorrSepNxNs16( const int16_t* __restrict kernel, - int knlSize, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// MxN correlation with separable kernel. -/// -/// @param kernelX -/// 1-D kernel of int8_t. The kernel is first applied to rows. -/// kernelX has Q factor equal to shift. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSizeX -/// Seperable kernel size of kernelX. -/// \n\b NOTE: kenrelX must be <= 32. -/// -/// @param kernelY -/// 1-D kernel of int8_t. The kernel is applied to columns after kernelX -/// is applied. It could be the same buffer as kernelX which makes it a -/// NxN symetric kernel. -/// kernelY has Q factor equal to shift. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSizeY -/// Seperable kernel size of kernelY. -/// -/// @param shift -/// The Q factor of kernels. Output is right-shifted by 2*shift to compensate for two rounds of filtering -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output correlation. Can do in-place filtering (i.e. dstImg=srcImg). -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterCorrSepMxNu8( const int8_t* kernelX, - uint32_t knlSizeX, - const int8_t* kernelY, - uint32_t knlSizeY, - int8_t shift, - const uint8_t* srcImg, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dstImg, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageIntensityStats_v2(). In the 2.0.0 release, -/// fcvImageIntensityStats_v2 will be renamed to fcvImageIntensityStats -/// and the signature of fcvImageIntensityStats as it appears now, -/// will be removed. -/// This API is the same as fcvImageIntensityStats_v2 with -/// FASTCV_UNBIASED_VARIANCE_ESTIMATOR -/// \n\n -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// @param varianceEstimator -/// variance estimator -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageIntensityStats_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - uint32_t recWidth, - uint32_t recHeight, - float32_t* mean, - float32_t* variance, - fcvVarianceEstimator varianceEstimator); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a histogram of intensities for a rectangular region of a grayscale -/// image. Bins each pixel into a histogram of size 256, depending on the -/// intensity of the pixel (in the range 0 to 255). -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// Width of rectangular region -/// -/// @param recHeight -/// Height of rectangular region -/// -/// @param histogram -/// Array of size 256 for storing the histogram -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit image and adds an -/// unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatchu8_v2(). In the 2.0.0 release, -/// fcvIntegratePatchu8_v2 will be renamed to fcvIntegratePatchu8 -/// and the signature of fcvIntegratePatchu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatchu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatchu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatchu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatchu8() and fcvIntegratePatchu8_v2() with the addition of -/// extra parameters. This function has been added to allow for backward -/// compatibility with the original function. When the 2.0.0 release of this -/// library is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 and fcvIntegratePatchu8_v3 will be removed, and -/// the current signature for \a fcvIntegratePatchu8 and fcvIntegratePatchu8_v2 -/// will be removed. Until 2.0.0, the developer should use this implementation -/// with the expectation of renaming it to \a fcvIntegratePatchu8 when -/// transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlStride -/// Stride in bytes of the Integral Image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdStride -/// Stride in bytes of the Squared Integral Image -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvIntegratePatchu8_v3(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchX, - uint32_t patchY, - uint32_t patchW, - uint32_t patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t intgrlStride, - uint32_t* __restrict intgrlSqrdImgOut, - uint32_t intgrlSqrdStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch12x12u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch12x12u8_v2 will be renamed to fcvIntegratePatch12x12u8 -/// and the signature of fcvIntegratePatch12x12u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatch12x12u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch12x12u8, -/// \a fcvIntegratePatch12x12u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch12x12u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch12x12u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch18x18u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch18x18u8_v2 will be renamed to fcvIntegratePatch18x18u8 -/// and the signature of fcvIntegratePatch18x18u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatch18x18u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch18x18u8, -/// \a fcvIntegratePatch18x18u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch18x18u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch18x18u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Integrates one line of an image or any portion of an image that is -/// contiguous in memory. -/// -/// @param src -/// Input image. Size of buffer is srcWidth bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Number of pixels. -/// \n NOTE: bit width enforces numPxls < 2^16 -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegrateImageLineu8( const uint8_t* __restrict src, - uint16_t srcWidth, - uint32_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integrates 64 contiguous pixels of an image. -/// -/// @param src -/// Input image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageLine64u8( const uint8_t* __restrict src, - uint16_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// compute approximate mean and variance for the range of NFT4 float -/// descriptors where descriptor elements along dimension are treated -/// as random vars -/// -/// @param src -/// contiguous block of descriptors of dimension 36 -/// -/// @param first -/// index of the first descriptor in range array vind for computing mean and var -/// -/// @param last -/// index of the last descriptor in range array vind for computing mean and range -/// -/// @param vind -/// array of randomized indexes of descriptors -/// -/// @param means -/// buffer for approximate means, must be 36 long -/// -/// @param vars -/// buffer for approximate variances, must be 36 long -/// -/// @param temp -/// bufffer, must be 46 long -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @remark -/// If descriptor range is > 100 then only -/// 100 samples are drawn from the range to compute -/// approximate means and variances. -/// -/// Variances computed here do not have to be true variances because their -/// values do not matter in kdtrees. The only thing that matters is that -/// the ordering relation of variances is preserved -/// -/// -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvDescriptorSampledMeanAndVar36f32( const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnCircle8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnCircle8x8u8_v2 will be renamed to fcvNCCPatchOnCircle8x8u8 -/// and the signature of fcvNCCPatchOnCircle8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvNCCPatchOnCircle8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnCircle8x8u8, -/// \a fcvNCCPatchOnCircle8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnCircle8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnCircle8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnSquare8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnSquare8x8u8_v2 will be renamed to fcvNCCPatchOnSquare8x8u8 -/// and the signature of fcvNCCPatchOnSquare8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvNCCPatchOnSquare8x8u8 with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnSquare8x8u8, -/// \a fcvNCCPatchOnSquare8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnSquare8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnSquare8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvSumOfAbsoluteDiffs8x8u8_v2(). In the 2.0.0 release, -/// fcvSumOfAbsoluteDiffs8x8u8_v2 will be renamed to fcvSumOfAbsoluteDiffs8x8u8 -/// and the signature of fcvSumOfAbsoluteDiffs8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// The dst buffer shall be width X height bytes in length. -/// Output of SAD(A,B). dst[4][4] correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvSumOfAbsoluteDiffs8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvSumOfAbsoluteDiffs8x8u8, -/// \a fcvSumOfAbsoluteDiffs8x8u8_v2 will be removed, and the current signature -/// for \a fcvSumOfAbsoluteDiffs8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvSumOfAbsoluteDiffs8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param patchStride -/// Stride of the 8x8 template buffer -/// -/// @param dstStride -/// Stride of the patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param dst -/// The dst buffer shall be at least ( width x height ) values in length. -/// Output of SAD(A,B). dst[4][4]correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2u8_v2 will be renamed to fcvScaleDownBy2u8 -/// and the signature of fcvScaleDownBy2u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy2u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2u8, -/// \a fcvScaleDownBy2u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2Gaussian5x5u8_v2 will be renamed to fcvScaleDownBy2Gaussian5x5u8 -/// and the signature of fcvScaleDownBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2Gaussian5x5u8, -/// \a fcvScaleDownBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy4u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy4u8_v2 will be renamed to fcvScaleDownBy4u8 -/// and the signature of fcvScaleDownBy4u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/16 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy4u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy4u8_v2, -/// \a fcvScaleDownBy4u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy4u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy4u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/4 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/4. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/4 if not 0. -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to 2/3 width and height by averaging 3x3 pixels -/// into one.. -/// -/// @details -/// A 3x3 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// Memory must be pre-allocated at least srcWidth * srcHeight * 2 / 3 -/// dstWidth = srcWidth/3*2 -/// dstHeight = srcHeight/3*2 -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return -/// 0 if successful -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// @details -/// Uses Nearest Neighbor method -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return -/// 0 if successful -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownu8_v2(). In the 2.0.0 release, -/// fcvScaleDownu8_v2 will be renamed to fcvScaleDownu8 -/// and the signature of fcvScaleDownu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension. -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownu8, -/// \a fcvScaleDownu8_v2 will be removed, and the current signature -/// for \a fcvScaleDownu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleUpBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleUpBy2Gaussian5x5u8_v2 will be renamed to fcvScaleUpBy2Gaussian5x5u8 -/// and the signature of fcvScaleUpBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*width) x (2*height). -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleUpBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleUpBy2Gaussian5x5u8, -/// \a fcvScaleUpBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleUpBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleUpBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*dstStride) x (2*srcHeight). -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Translate to float and normalize 36 8-bit elements -/// -/// @param src -/// Pointer to the first input vector -/// -/// @param invLen -/// Pointer to inverse length of the first input vector -/// located right after each 36 element vector -/// -/// @param numVecs -/// Number of vectors to translate -/// -/// @param reqNorm -/// Required norm -/// -/// @param srcStride -/// Step in bytes to data of the next vector -/// Each vector has 36 8-bit elements and 1 float invLen -/// -/// @param dst -/// Pointer to contiguous block for output vectors -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param stopBuild -/// Allows other threads to break this function in the middle of processing. -/// When set to 1, the function will exit on the next iteration. -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @ingroup math_vector -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against 4 others. -/// -/// @details -/// SSD of one vector (a) against 4 others (b0,b1,b2,b3) using their given -/// inverse lengths for normalization. -/// \n\n SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenB -/// Inverse of vectors b0...b3 = 1/|b0|,... 1/|b3| -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param distances -/// Output of the 4 results { SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: array should be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict a, - float invLenA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - const float* __restrict invLenB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other 36-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict a, - float invLenA, - const int8_t* const * __restrict b, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sorting of 8 float numbers -/// -/// @details -/// Perform sorting of 8 scores in ascending order (output of SumOfSquaredDiffs) -/// -/// @param inScores -/// Input 8 element float array -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param outScores -/// Output is 8 element sorted float array -/// \n\b WARNING: array should be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSort8Scoresf32( float* __restrict inScores, float* __restrict outScores ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdu8_v2 will be renamed to fcvFilterThresholdu8 -/// and the signature of fcvFilterThresholdu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is srcWidth*srcHeight bytes. -/// If src equals to dst, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFilterThresholdu8( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* dst, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8_v2( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* dst, - unsigned int dstStride, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// The binarized image will be in the two values selected by user. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v3 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @param trueValue -/// The value in type of uint8_t assigned to the destination pixel if the source is larger than threshold -/// -/// @param falseValue -/// The value in type of uint8_t assigned to the destination pixel if the source is smaller than or equal to threshold -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdu8_v3( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* dst, - unsigned int dstStride, - unsigned int threshold, - uint8_t trueValue, - uint8_t falseValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a pair of threshold values. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdRangeu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdRangeu8_v2 will be renamed to fcvFilterThresholdRangeu8 -/// and the signature of fcvFilterThresholdRangeu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to min(0) if it's value is greater than the higher threshold -/// or smaller than the lower threshold; -/// else, set the pixel to max(255). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// The lower threshold value for binarization. -/// -/// @param highThresh -/// The higher threshold value for binarization. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdRangeu8( const uint8_t* src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dst, - uint32_t dstStride, - uint8_t lowThresh, - uint8_t highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a pair of threshold values. -/// The binarized image will be in the two values selected by user. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdRangeu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdRangeu8, -/// \a fcvFilterThresholdRangeu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdRangeu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdRangeu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to min(0) if it's value is greater than the higher threshold -/// or smaller than the lower threshold; -/// else, set the pixel to max(255). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// The lower threshold value for binarization. -/// -/// @param highThresh -/// The higher threshold value for binarization. -/// -/// @param trueValue -/// The value in type of uint8_t assigned to the destination pixel if the source is -/// within the range inclusively defined by the pair of threshold values -/// -/// @param falseValue -/// The value in type of uint8_t assigned to the destination pixel if the source is -/// out of the range defined by the pair of threshold values -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdRangeu8_v2( const uint8_t* src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dst, - uint32_t dstStride, - uint8_t lowThresh, - uint8_t highThresh, - uint8_t trueValue, - uint8_t falseValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterDilate3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterDilate3x3u8_v2 will be renamed to fcvFilterDilate3x3u8 -/// and the signature of fcvFilterDilate3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterDilate3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterErode3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterErode3x3u8_v2 will be renamed to fcvFilterErode3x3u8 -/// and the signature of fcvFilterErode3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterErode3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffine8x8u8_v2(). In the 2.0.0 release, -/// fcvTransformAffine8x8u8_v2 will be renamed to fcvTransformAffine8x8u8 -/// and the signature of fcvTransformAffine8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param nPatch -/// Transformed patch. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTransformAffine8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffine8x8u8, -/// \a fcvTransformAffine8x8u8_v2 will be removed, and the current signature -/// for \a fcvTransformAffine8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffine8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as 8. -/// \n\b WARNING: must be at least as much as 8 if not 0. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcvWarpPerspectiveu8_v2 will be renamed to fcvWarpPerspectiveu8 -/// and the signature of fcvWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection matrix using -/// bilinear interpolation. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcv3ChannelWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcv3ChannelWarpPerspectiveu8_v2 will be renamed to fcv3ChannelWarpPerspectiveu8 -/// and the signature of fcv3ChannelWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight*3 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight*3 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection -/// matrix using bilinear interpolation. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcv3ChannelWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcv3ChannelWarpPerspectiveu8, -/// \a fcv3ChannelWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcv3ChannelWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcv3ChannelWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth*3. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*3 if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth*3. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth*3 if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension dim. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surface of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension 36. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * 36. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surphace of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s16_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s16_v2 will be renamed to fcvFilterGaussian5x5s16 -/// and the signature of fcvFilterGaussian5x5s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// \n\b NOTE: Size of buffer is srcWidth*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s16, -/// \a fcvFilterGaussian5x5s16_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s32_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s32_v2 will be renamed to fcvFilterGaussian5x5s32 -/// and the signature of fcvFilterGaussian5x5s32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int32_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5s32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s32, -/// \a fcvFilterGaussian5x5s32_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s32 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Input Image stride in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*sizeof(int32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output Image stride in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Segments an image (3 or 1 channel) into meaningful regions, -/// depending on the color or gray scale uniformity of the neighborhood pixels. -/// -/// @param src -/// Pointer to 8-bit color (3-channel) or grayscale (1-channel) image. -/// -/// @param srcWidth -/// Width of src image, measured by pixels. -/// -/// @param srcHeight -/// Height of src image, measured by pixels. -/// -/// @param srcStride -/// Stride of src image, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. -/// -/// @param numChannel -/// Number of channels of src image. 1 for gray scale and 3 for color image. -/// -/// @param thresholdSplit -/// Threshold for region split. Higher value: larger uniform region segmented. -/// Range of 3-channel image segmentation 20~500: 20~50 for heavy over-segmentation, 50~100 for median over-segmentation, 100~150 for light over-segmentation, 150~250 for normal segmentation, 250~400 for light under-segmentation, 400~500 for heavy under-segmentation. -/// Range of 1-channel image segmentation 3~150: 3~10 for heavy over-segmentation, 10~15 for median over-segmentation, 15~25 for light over-segmentation, 25~50 for normal segmentation, 50~75 for light under-segmentation, 75~150 for heavy under-segmentation. -/// -/// @param thresholdMerge -/// Threshold for region merge, measured by the region area (pixels). Higher value: larger uniform region segmented. Range 10~1000 for VGA size image. -/// Range of 3-channel image segmentation 10~1000: 10~30 for heavy over-segmentation, 30~60 for median over-segmentation, 60~150 for light over-segmentation, 150~400 for normal segmentation, 400~600 for light under-segmentation, 600~1000 for heavy under-segmentation. -/// Same for the 1-channel image. -/// For other image size, please tune the thresholdMerge value proportional to the VGA size. -/// -/// @param segLabel -/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. -/// -/// @param segLabelStride -/// Stride of segmented labels, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. -/// -/// @param data -/// data buffer for inner function buffer allocation. The buffer size is recommended below, -/// for 3-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*18*sizeof(uint8_t) ); -/// for 1-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*16*sizeof(uint8_t) ); -/// -/// @return -/// 0 if successful. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API uint32_t -fcvImageSegmentationRegionGrow( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numChannel, - uint32_t thresholdSplit, - uint32_t thresholdMerge, - uint32_t* __restrict segLabel, - uint32_t segLabelStride, - uint8_t* __restrict data ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffineu8_v2(). In the 2.0.0 release, -/// fcvTransformAffineu8_v2 will be renamed to fcvTransformAffineu8 -/// and the signature of fcvTransformAffineu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTransformAffineu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffineu8, -/// \a fcvTransformAffineu8_v2 will be removed, and the current signature -/// for \a fcvTransformAffineu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffineu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, patchStride is set as patchWidth. -/// \n\b WARNING: must be at least as much as patchWidth if not 0. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts a 17x17 rotation corrected patch from a 25x25 image. -/// -/// @param src -/// 25x25 input image in continuous memory. -/// -/// @param dst -/// 17x17 output patch. -/// -/// @param orientation -/// Rotation angle of patch relative to src. -/// \n 10-bit fixed-point angle around unit circle. -/// \n NOTE: 0 = 0 degrees and 1024 = 360 degrees. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCopyRotated17x17u8( const uint8_t* __restrict src, - uint8_t* __restrict dst, - int orientation ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied vector. -/// -/// @param src -/// Pointer to vector to count bits that are 1. -/// -/// @param srcLength -/// Length of the vector to count bits. Assumed that the remainder of bits modulo 8 -/// will be set to 0 a priori. -/// -/// @return -/// total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu8( const uint8_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied 32-byte vector. -/// -/// @param src -/// Pointer to 32-byte vector(s) to count bits that are 1. -/// -/// @return -/// total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to count bits. -/// -/// @param b -/// Pointer to 32-byte vector to count bits. -/// -/// @param c -/// Pointer to 32-byte vector to count bits. -/// -/// @param d -/// Pointer to 32-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount32x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 64-byte vector. -/// -/// @param src -/// Pointer to 64-byte vector(s) to count bits. -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to count bits. -/// -/// @param b -/// Pointer to 64-byte vector to count bits. -/// -/// @param c -/// Pointer to 64-byte vector to count bits. -/// -/// @param d -/// Pointer to 64-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied vector of unsigned intergers. -/// -/// @param src -/// Pointer to vector(s) to count bits. -/// -/// @param srcLength -/// Number of elements in vector -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu32( const uint32_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied arbitrary length -/// vectors. -/// -/// @param a -/// Pointer to vector to compute distance. -/// -/// @param b -/// Pointer to vector to compute distance. -/// -/// @param abLength -/// Length in bits of each of the vectors. Assumed that the remainder of -/// bits modulo 8 will be set to 0 a priori. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte -/// vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// 8-bit image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// \n\b NOTE: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// Grayscale image with one byte per pixel -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvCornerFast9Scoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9Scoreu8, -/// \a fcvCornerFast9Scoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9Scoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9Scoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvCornerFast9InMaskScoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9InMaskScoreu8, -/// \a fcvCornerFast9InMaskScoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9InMaskScoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9InMaskScoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight. The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. Bitwidth optimized implementation -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTrackLKOpticalFlowu8_v2(). In the 2.0.0 release, -/// fcvTrackLKOpticalFlowu8_v2 will be renamed to fcvTrackLKOpticalFlowu8 -/// and the signature of fcvTrackLKOpticalFlowu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int srcWidth, - int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow (with stride so ROI can be supported) -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, -/// \a fcvTrackLKOpticalFlowu8_v2 will be removed, and the current signature -/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a ffcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input image width. -/// -/// @param height -/// Input image height. -/// -/// @param stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. -/// NOTE: should be a multiple of 8. -/// -/// @param src1Pyr -/// Image Pyramid of src1 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t width, - uint32_t height, - uint32_t stride, - const fcvPyramidLevel_v2 *src1Pyr, - const fcvPyramidLevel_v2 *src2Pyr, - const float32_t* featureXY, - float32_t* featureXY_out, - int32_t* featureStatus, - int32_t featureLen, - int32_t windowWidth, - int32_t windowHeight, - int32_t maxIterations, - int32_t nPyramidLevels); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. -/// -/// \n\b ATTENTION: This function will be removed when the 2.0.0 release of this library -/// is made. Until 2.0.0, the developer should use this implementation with the expectation of -/// using \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// \n\b NOTE: Possible status are : -/// \n TRACKED 1 -/// \n NOT_FOUND -1 -/// \n SMALL_DET -2 -/// \n MAX_ITERATIONS -3 -/// \n OUT_OF_BOUNDS -4 -/// \n LARGE_RESIDUE -5 -/// \n SMALL_EIGVAL -6 -/// \n INVALID -99 -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE : Suggest that be set to between 0.1 and 0.2, say 0.15 -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of float32 arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidCreatef32_v2(). In the 2.0.0 release, -/// fcvPyramidCreatef32_v2 will be renamed to fcvPyramidCreatef32 -/// and the signature of fcvPyramidCreatef32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param srcHeight -/// Height of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32( const float* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid (with stride). -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete_v2 -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreatef32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreatef32, -/// \a fcvPyramidCreatef32_v2 will be removed, and the current signature -/// for \a fcvPyramidCreatef32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreatef32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// width of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevel -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// \n\b NOTE: If left at 0, pyramid (non-base) image stride is the same as its srcWidth*sizeof(float32_t) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param fcvPyramidLevel_v2 -/// output pyramid (with stride) of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32_v2( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidLevel_v2* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of uint8_t arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidCreateu8_v2(). In the 2.0.0 release, -/// fcvPyramidCreateu8_v2 will be renamed to fcvPyramidCreateu8 -/// and the signature of fcvPyramidCreateu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^(numLevels-1) -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: must be a multiple of 2^(numLevels-1) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid (with stride). -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreateu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreateu8, -/// \a fcvPyramidCreateu8_v2 will be removed, and the current signature -/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// width of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevel -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// \n\b NOTE: Pyramid (non-base) image stride is the same as its width -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param fcvPyramidLevel_v2 -/// output pyramid (with stride) of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8_v2( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidLevel_v2* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds a Gaussian image pyramid. -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// @details -/// This function builds a Gaussian image Pyramid given an input image. Each level -/// of the pyramid is computed by first applying a gaussian filter on the previous level, -/// and then scaling the image based on the type of scale factor selected. The memory for -/// the pyramid must be allocated using fcvPyramidAllocate_v3(), and should be -/// deallocated using fcvPyramidDelete_v2() -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreateu8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreateu8, -/// \a fcvPyramidCreateu8_v3 will be removed, and the current signature -/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// Width of base image -/// -/// @param srcHeight -/// Height of base image -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: The stride of pyramid levels other than the base are set to be the same as their width -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param scale -/// Defines the type of scaling used for each pyramid level. -/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. -/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), -/// which is approximated as 0.8408964f -/// -/// @param pyramidGaussian -/// output pyramid of "numLevels" images of the same type as src . -/// pyramidGaussian[0] will be the same as src . pyramidGaussian[1] is the next -/// pyramid layer, a smoothed and scaled src, and so on. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPyramidCreateu8_v3(const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidScale scale, - fcvPyramidLevel_v2* __restrict pyramidGaussian); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of int16_t from an image pyramid of uint8_t -/// -/// @param imgPyr -/// Input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of float32 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatef32( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of integer8 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei8( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16_v2 and -/// fcvImageGradientSobelPlanars16_v3 as it appears now, will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as (srcWidth*sizeof(int16_t)). -/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes central differences on 3x3 neighborhood and then convolves -/// the result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanars16_v2() with a change in behavior: no normalization -/// at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars16, -/// \a fcvImageGradientSobelPlanars16_v2 and fcvImageGradientSobelPlanars16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelPlanars16 -/// and fcvImageGradientSobelPlanars16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 and -/// fcvImageGradientSobelInterleaveds16_v2 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(int16_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// \n Compared to the original and v2 functions, this v3 functions does not normalize -/// \n the gradients (divide by 8). It just returns the actual dx, dy values. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelInterleaveds16_v2() with a change in behavior: no -/// normalization at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleaveds16, -/// \a fcvImageGradientSobelInterleaveds16_v2 and fcvImageGradientSobelInterleaveds16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelInterleaveds16 -/// and fcvImageGradientSobelInterleaveds16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the interleaved gradients array. If left at 0 gradStride is default to 4 * (srcWidth-2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleavedf32_v2 will be renamed to fcvImageGradientSobelInterleavedf32 -/// and the signature of fcvImageGradientSobelInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 floats in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleavedf32, -/// \a fcvImageGradientSobelInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: should be multiple of 8, and at least as much as (srcWidth-2)*2*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars8_v2 will be renamed to fcvImageGradientSobelPlanars8 -/// and the signature of fcvImageGradientSobelPlanars8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanars8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars8, -/// \a fcvImageGradientSobelPlanars8_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanars8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32_v2 will be renamed to fcvImageGradientSobelPlanarf32 -/// and the signature of fcvImageGradientSobelPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32, -/// \a fcvImageGradientSobelPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as 4*srcWidth. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value),and at least as much as srcWidth*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32f32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32f32_v2 will be renamed to fcvImageGradientSobelPlanarf32f32 -/// and the signature of fcvImageGradientSobelPlanarf32f32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels (not bytes) between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanarf32f32()() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32f32(), -/// \a fcvImageGradientSobelPlanarf32f32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32f32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32f32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride (in bytes) of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*4. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value). -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, dxyStride is set as srcWidth*4. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Block Optical Flow 16x16 - Tracks all 16x16 blocks in the Region of Interest -/// (ROI) from Source-1 to Source-2. Generates Motion Vectors for blocks where -/// motion is detected. -/// -/// @details -/// -/// @param[in] src1 -/// Pointer to source image where the original blocks are present. -/// \n Dimensions should be same as \a src2, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: should be 128-bit aligned. Buffer size is srcStride*srcHeight bytes. -/// -/// @param[in] src2 -/// Pointer to second source image where motion vectors for blocks in \a img1 -/// are to be located. -/// \n Dimensions should be same as \a src1, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param[in] srcWidth -/// Width of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcHeight -/// Height of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcStride -/// Stride of source images pointed by \a src1 and \a src2. -/// -/// @param[in] roiLeft -/// Left co-ordinate (x0) of Region-of-Interest (ROI). -/// -/// @param[in] roiTop -/// Top co-orgdinate (y0) of Region-of-Interest (ROI). -/// -/// @param[in] roiRight -/// Right co-ordinate (x1) of Region-of-Interest (ROI). -/// -/// @param[in] roiBottom -/// Bottom co-ordinate (y1) of Region-of-Interest (ROI). -/// -/// @param[in] shiftSize -/// Distance in number of pixels (both horizontally and vertically) between -/// consecutive blocks for which motion vector is searched. -/// \n\b NOTE: Larger the value, less number of blocks will be tracked, and -/// hence the function will run faster. -/// -/// @param[in] searchWidth -/// Numbers of pixels horizontally on left and right of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchHeight -/// Numbers of pixels vertically on top and bottom of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchStep -/// Distance in number of pixels between consecutive search targets within -/// the above search window. -/// \n\b NOTE: Larger the value, more coarse the search will be and thus -/// will make the fucntion run faster. Smaller the value, more dense the -/// search will be, making the funciton run slower. -/// -/// @param[in] usePrevious -/// Indicates if the function should use the existing motion vectors in -/// locX and locY as the starting point for motion vector search. -/// \n\b NOTE: This parameter is redundant at the moment. -/// -/// @param[out] numMv -/// Pointer to variable that will store the count of Motion Vectors -/// generated by the function. -/// \n\b WARNING: This pointer should be Non-NULL. -/// -/// @param[out] locX -/// Pointer to an array which will store the X co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] locY -/// Pointer to an array which will store the Y co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvX -/// Pointer to an array which will store the X co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvX[i]-\a locX[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvY -/// Pointer to an array which will store the Y co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvY[i]-\a locY[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @return -/// 0 - Success, Failure otherwise. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY); - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a set of patches within the source image for the max NCCs. The search -/// regions are corresponding to the patches in the search list. -/// -/// @param patches -/// Pointer to a set of 8-bit patches, each patch takes patchWidth *patchHeight pixel -/// values which are linearly laid out in memory. -/// \n\b WARNING: patchWidth * patchHeight must be <= 256 -/// -/// @param patchWidth -/// Width in pixels of the patch. -/// -/// @param patchHeight -/// Height in pixels of the patch. -/// -/// @param src -/// Pointer to 8-bit image for search. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param srcStride -/// The stride of the imge. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param searchCenterX -/// The list of Center X coordinate of each search window -/// -/// @param searchCenterY -/// The list of Center Y coordinate of each search window -/// -/// @param searchWidth -/// Width of search range in pixels -/// \n\b WARNING: must be odd number. -/// -/// @param searchHeight -/// Height of search range in pixels -/// \n\b WARNING: must be odd number. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// the block of src or patch. -/// -/// @param bestX -/// The list of Center X location on the image of the best NCC matches. -/// The center X has (patchWidth/2) pixels to the left and -/// (patchWidth - (patchWidth/2) - 1) to the right. -/// -/// @param bestY -/// The list of Center Y location on the image of the best NCC matches. -/// The center Y has (patchWidth/2) pixels above and -/// (patchWidth - (patchWidth/2) - 1) below. -/// -/// @param bestNCC -/// NCC value of the best match blocks. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to bestX. -/// \n e.g., float x = (float)bestX + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to bestY. -/// -/// @param numSearches -/// number of patch searches in the image. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNCCPatchesOnRectu8 ( const uint8_t* __restrict patches, - uint32_t patchWidth, - uint32_t patchHeight, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint32_t * __restrict searchCenterX, - const uint32_t * __restrict searchCenterY, - uint32_t searchWidth, - uint32_t searchHeight, - int32_t filterLowVariance, - uint32_t* __restrict bestX, - uint32_t* __restrict bestY, - uint32_t* __restrict bestNCC, - int32_t findSubPixel, - float32_t* __restrict subX, - float32_t* __restrict subY, - uint32_t numSearches ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 8-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 8-bit source image 1. -/// -/// @param src2 -/// Pointer to the 8-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOru8(const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 32-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 32-bit source image 1. -/// -/// @param src2 -/// Pointer to the 32-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOrs32(const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to grayscale -/// -/// @details -/// -/// @param src -/// Source 8-bit image, BGR888 format (R is lowest byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Destination 8-bit gray-scale image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcStride as default -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API void -fcvColorRGB888ToGrayu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integral of the image tilted by 45 degrees -/// -/// @details -/// Calculates the tilted integral image of an input image -/// and adds an zero-filled border on top. Left border not zero. -/// dst[i,j]=sum (src[m,n]), where n according to -/// descDBTargetId. -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param descDBOldIdx -/// A pointer to uint32_t [numDescDB], -/// which stores the old index of the desc before sorting -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvLinearSearchPrepare8x36s8( uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict descDBOldIdx, - uint32_t numDescDB ); - -//--------------------------------------------------------------------------- -/// @brief -/// Perform linear search of descriptor in a database -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @param srcDesc -/// A pointer to int8_t [numSrcDesc][36], -/// which stores descriptors. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param srcDescInvLenQ38 -/// A pointer to uint32_t [numSrcDec], -/// which stores the inverse length of srcDesc. -/// The value is in Q38 format. -/// -/// @param srcDescIdx -/// A pointer to the dbLUT data -/// -/// @param numSrcDesc -/// Number of source descriptor -/// -/// @param targetsToIgnore -/// A list of target IDs to be ignored -/// -/// @param numTargetsToIgnore -/// Number of targets to be ignored -/// -/// @param maxDistanceQ31 -/// Maximum distance for correspondences. -/// In Q31 format. -/// -/// @param correspondenceDBIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of featuresDB -/// as a part of correspondences. -/// -/// @param correspondenceSrcDescIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of descriptors -/// as a part of correspondences. -/// -/// @param correspondenceDistanceQ31 -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output the distances -/// as a part of correspondences. -/// In Q31 format. -/// -/// @param maxNumCorrespondences -/// Maximum number of correspondences allowed -/// -/// @param numCorrespondences -/// Number of correspondences returned by this function -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondenceSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds only extreme outer contours in a binary image. There is no nesting -/// relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 -/// for all the contours. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image without any hierarchical relationships. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and organizes them into a two-level -/// hierarchy. At the top level, there are external boundaries of the -/// components. At the second level, there are boundaries of the holes. -/// If there is another contour inside a hole of a connected component, -/// it is still put at the top level. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and reconstructs a full hierarchy of -/// nested contours -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates assistant and intermediate data for contour -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @return -/// Pointer to allocated data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void* -fcvFindContoursAllocate( uint32_t srcStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Deallocates assistant and intermediate data for contour -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursDelete( void* contourHandle ); - -//------------------------------------------------------------------------------ -/// @brief -/// Solve linear equation system -/// Ax = b -/// -/// @details -/// -/// -/// @param A -/// The matrix contains coefficients of the linear equation system -/// -/// @param numRows -/// The number of rows for the matrix A -/// -/// @param numCols -/// The number of columns for the matrix A -/// -/// @param b -/// The right side value -/// -/// @param x -/// The solution vector -/// -/// -/// @return -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates a perspective transform from four pairs of the corresponding -/// points. -/// NOTE: in order to guarantee a valid output transform, any three points -/// in src1 or src2 cannot be collinear. -/// -/// @param src1 -/// Coordinates of quadrangle vertices in the source image -/// -/// @param src2 -/// Coordinates of the corresponding quadrangle vertices in the destination -/// image -/// -/// @param transformCoefficient -/// 3x3 matrix of a perspective transform -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ -FASTCV_API void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input uint8_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for the mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSetElementsu8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input int32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementss32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input float32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsf32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param value4 -/// Fourth uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param value4 -/// Fourth int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param value4 -/// Fourth float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines an enumeration to list threshold types used in fcvAdaptiveThreshold -//------------------------------------------------------------------------------ - -typedef enum { - FCV_THRESH_BINARY = 0, // value = value > threshold ? max_value : 0 - FCV_THRESH_BINARY_INV // value = value > threshold ? 0 : max_value -} fcvThreshType; - - -//--------------------------------------------------------------------------- -/// @brief -/// Binarizes a grayscale image based on an adaptive threshold value calculated from 3x3 Gaussian kernel. -/// -/// @details -/// For each pixel, the threshold is computed adaptively based on cross-correlation with a -/// 3x3 Gaussian kernel minus value (parameter). The standard deviation is used for Gaussian kernel. -/// For FCV_THRESH_BINARY threshold type, the pixel is set as maxValue if it's value is greater than the threshold; -/// else, it is set as zero. For FCV_THRESH_BINARY_INV threshold type, the pixel is set as zero if it's value is greater than the threshold; -/// else, it is set as maxValue. -/// -/// @param src -/// Pointer to the 8-bit input image. -/// -/// @param srcWidth -/// Width of source images pointed by src. -/// -/// @param srcHeight -/// Height of source images pointed by src. -/// -/// @param srcStride -/// Stride of source image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// -/// @param maxValue -/// The maximum integer value to be used. 0>1+8) *sizeof(uint32_t) -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param integralCrStride -/// The stride of integralCr. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 integralCrStride is default to (srcWidth>>1+8) *sizeof(uint32_t) -/// \n\b NOTE: should be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function finds the foreground. -/// -/// @details -/// This function tries to find a forgound in the current image (represented by: fgIntegralY, -/// fgIntegralCb, fgIntegralCr) based on the current background model (represented by: bgIntegralY, -/// bgIntegralCb, bgIntegralCr). For example, the tuple (bgIntegralY, bgIntegralCb, bgIntegralCr) may be -/// from a picture shooting a wall. Then the tuple (fgIntegralY, fgIntegralCb, fgIntegralCr) may be -/// the wall with a paint on it. Note that all the first six parameters are indicating integral images -/// that's computed from a YUV420 image, which maybe computed from the function: -/// fcvIntegrateImageYCbCr420PseudoPlanaru8. Generally the size of fgIntegralY and bgIntegralY are -/// (srcWidth+1)*(srcHeight+1). And the size of fgIntegralU, fgIntegralV, bgIntegralU and bgIntegralV -/// are (srcWidth/2+1)*(srcHeight/2+1). The value of the outputWidth and outputHeight are usually indicating -/// the desired block size. For example, if the user wants a 20x15 blocks on a 800x480 image. Then -/// outputWidth=800/20 and outputHeight=480/15. After return, if the value in the outputMask image is -/// 255, then a moving block is indicated, otherwise a non-moving block is indicated. -/// -/// @param bgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the background image. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param bgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the background image. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param bgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the background image. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. See the details. -/// \n\b NOTE: must be a multiple of 16. -/// -/// @param srcHeight -/// The height of the source image. See the details. -/// \n\b NOTE: must be a multiple of 2. -/// -/// @param srcYStride -/// The stride of the input source image's Y channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcCbStride -/// The stride of the input source image's Cb channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcCrStride -/// The stride of the input source image's Cr channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param outputMask -/// The output mask image. Each pixel represent the motion condition for a block in the original image. -/// Size of buffer is outputMaskStride*outputHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param outputWidth -/// The width of the output mask image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param outputHeight -/// The height of the output mask image. -/// -/// @param outputMaskStride -/// The stride of the output mask image. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 outputMaskStride is default to outputWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param threshold -/// The threshold that's used to decide if a block is moving or not. (recommend the value of 20). -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t * __restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// The input image/patch. Must be 32 bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// The actually number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShifts32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracku8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracks32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTrackf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - -//------------------------------------------------------------------------------ -/// @brief -/// Compute a singular value decomposition of a matrix of a float type -/// A = U*diag[w]*Vt; -/// It is used for solving problems like least-squares, under-determined linear systems, matrix -/// inversion and so forth. The algorithm used here does not compute the full U and V matrices -/// however it computes a condensed version of U and V described below which is sufficient to solve -/// most problems which use SVD. -/// -/// @details -/// -/// -/// @param A -/// The input matrix of dimensions m x n -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param m -/// The number of rows of matrix A -/// -/// @param n -/// The number of columns of matrix A -/// -/// @param w -/// The pointer to the buffer that holds n singular values. When m>n it -/// contains n singular values while when m 0 and less than or equal to 8. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. -/// The dimensions of the image are dstWidth = srcWidth - 2*radius, -/// and dstHeight = srcHeight - 2*radius. - -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: dstWidth = srcWidth - 2*radius, dstHeight = srcHeight - 2*radius. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvGLBPu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t radius, - uint32_t neighbors, - uint8_t *__restrict dst, - uint32_t dstStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Refine corner location -/// -/// @details -/// Refine the detected corners location into sub-Pixels which is more precise than integer pixels -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param blockWidth -/// Width of the location search window. -/// -/// @param blockHeight -/// Height of the location search window. -/// -/// @param maxIterations -/// Maximum number of iteration to refine -/// -/// @param stopCriteria -/// Improvement threshold, iteration stop if the corner position moves less by this value -/// -/// @param xyInitial -/// Pointer to the initial input array containing the interleaved x,y position of the corner -/// -/// @param nCorners -/// Number of the corners -/// -/// @param xyOut -/// Pointer to the output array containing the refined interleaved x,y position of the corner -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvCornerRefineSubPixu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t maxIterations, - float32_t stopCriteria, - const uint32_t*__restrict xyInitial, - uint32_t nCorners, - float32_t * __restrict xyOut); - -//--------------------------------------------------------------------------- -/// @brief -/// Extract strong corners from image to track -/// -/// @details -/// Extract strong corners from image to track based on the according paper "Good Feature to Track" by J.Shi and C.Tomasi -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param distanceMin -/// Minimum Euclidean distance between the found corners -/// -/// @param border -/// Number for pixels to ignore from top,bottom -/// -/// @param barrier -/// Quality threshold -/// -/// @param xy -/// Pointer to the output array containing the interleaved x,y position of the detected features -/// -/// @maxnumcorners -/// Maximum number of features to detect -/// -/// @numcorners -/// Pointer to integer of actual detected features number -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvGoodFeatureToTracku8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t distanceMin, - uint32_t border, - float32_t barrier, - uint32_t * __restrict xy, - uint32_t maxnumcorners, - uint32_t * __restrict numcorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Find multiple maxima along the normal direction of the line -/// -/// @param src -/// 8-bit input image -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride -/// -/// @param pos -/// 2D position to start searching maximas in the input image -/// -/// @param normal -/// Normalized line normal at pos -/// -/// @param maxDistance -/// Search distance along the normal direction; [-normal*maxDistance, normal*maxDistance] -/// -/// @param maxNumMaxima -/// Maximum maxima to find, e.g., 5 -/// -/// @param minGradient -/// Minimum 1D gradient of the pixels on the search line (normal direction) -/// -/// @param maxAngleDiff -/// Cosine value threshold to filter the pixels that have large angle difference -/// -/// @param maxima -/// List of found maxima 1D positions; Actuall 2D position of maxima = (normal * 1D position) + pos -/// -/// @param numMaxima -/// Number of found maxima -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFindMultipleMaximau8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict pos, - const float32_t* __restrict normal, - uint32_t maxDistance, - uint32_t maxNumMaxima, - int32_t minGradient, - float32_t maxAngleDiff, - float32_t* __restrict maxima, - uint32_t* __restrict numMaxima); - -//------------------------------------------------------------------------------ -/// @brief -/// Extract the straight line segments from the image -/// -/// @param srcPyr -/// Pointer to an array of fcvPyramidLevel_v2. Only 2 levels at max will be used -/// to extract the straight line segments. -/// -/// @param pyrLevel -/// Image pyramid level, if it is set to 1, then do not use multi-scale approach. -/// pyrLevel should be greater than or equal to 1. -/// -/// @param doBlurImage -/// Do image-blurring inside the function (if the image is not blurred) -/// -/// @param maxLineAngle -/// Cosine threshold to stop following (extending) pixels, e.g., cos(22.5 deg) -/// maxLineAngle should be between [0.5 - 1.0] -/// -/// @param minLineLength -/// Minimum line segment length in pixels -/// -/// @param minMagnitude -/// Minimum pixel gradient magnitude, e.g., 10 -/// -/// @param maxLineNum -/// Maximum line segments from the image -/// -/// @param indexBuffer -/// Optionally store the index(:= y * image_width + x) of the pixels consisting of the line segments -/// into pointsList in fcvLineSegment structure. e.g., One can provide the buffer[maxLineNum*(image width + height)] -/// Pass NULL if it is not necessary. -/// -/// @param lineSegments -/// List of the detected line segments -/// -/// @param numLineSegments -/// Number of found line segments -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageDetectLineSegmentsu8(const fcvPyramidLevel_v2* __restrict srcPyr, - uint32_t pyrLevel, - uint32_t doBlurImage, - float32_t maxLineAngle, - uint32_t minLineLength, - uint32_t minMagnitude, - uint32_t maxLineNum, - uint32_t* __restrict indexBuffer, - fcvLineSegment* __restrict lineSegments, - uint32_t* __restrict numLineSegments); - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one L-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffsu8( const uint8_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const uint8_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one floating vector of L-elements against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-elements vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffsf32( const float32_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const float32_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * pointStride. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param numPointsUsed -/// Total number of points used for clustering, {0,1,...(numPointsUsed-1)} -/// -/// @param numClusters -/// Number of clusters -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param newClusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numPointsUsed long. -/// -/// @param sumOfClusterDistances -/// the sum of distances between each cluster center to its belonging points. The -/// size should be numClusterCenters*sizeof(float_32) -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanu8( const uint8_t* __restrict points, - int32_t numPoints, - int32_t dim, - int32_t pointStride, - int32_t numPointsUsed, - int32_t numClusters, - float32_t* __restrict clusterCenters, - int32_t clusterCenterStride, - float32_t* __restrict newClusterCenters, - uint32_t* __restrict clusterMemberCounts, - uint32_t* __restrict clusterBindings, - float32_t* sumOfClusterDistances ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one uint8_t type matrix. -/// -/// @param src -/// Source matrix.The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposeu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one uint16_t type matrix. -/// -/// @param src -/// Source matrix. The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposeu16( const uint16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one float32_t type matrix. -/// -/// @param src -/// Source matrix. The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposef32( const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Flip one uint8_t type matrix. If src and dst point to the same address -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix. If src equals to dst and srcStride equals to dstStride, -/// it will do in-place flip. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFlipu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvFlipDir dir ); - -//--------------------------------------------------------------------------- -/// @brief -/// Flip one uint16_t type matrix. If src and dst point to the same address, -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix. If src equals to dst and srcStride equals to dstStride, -/// it will do in-place flip. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFlipu16( const uint16_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t * dst, - uint32_t dstStride, - fcvFlipDir dir ); - -//------------------------------------------------------------------------------ -/// @brief -/// Flips an interleaved RGB image -/// -/// @details -/// Flips one uint8_t type interleaved RGB image . If src and dst point to the same address -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the image. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride of the Image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride,it will do in-place flip. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, dstStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvFlipRGB888u8(const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvFlipDir dir); - -//--------------------------------------------------------------------------- -/// @brief -/// Rotate one uint8_t type image. -/// -/// @param src -/// Source image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source image. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth -/// (FASTCV_ROTATE_180) or srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param degree -/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRotateImageu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvRotateDegree degree ); - -//--------------------------------------------------------------------------- -/// @brief -/// Rotate one interleaved uint8_t type image (e.g. UV channel in NV21). -/// -/// @param src -/// Source image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Number of interleaved pairs in one row. -/// For example, srcWidth = 4 in UVUVUVUV image row. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 2*srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to 2*srcWidth -/// (FASTCV_ROTATE_180) or 2*srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param degree -/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRotateImageInterleavedu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvRotateDegree degree ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvElementMultiplyu8u16( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (float32_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvElementMultiplyf32( const float32_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const float32_t * src2, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix multiplication of two int8_t type matrices. -/// -/// @param src1 -/// First source matrix. The size of src1 is src1Stride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src1Width -/// Width of the first source matrix. -/// \n\b NOTE: src1Width should not be larger than 131072 -/// -/// @param src1Height -/// Height of the first source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. The size of src2 is src2Stride*src1Width. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Width -/// Width of the second source matrix. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvMatrixMultiplys8s32( const int8_t * __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int8_t * __restrict src2, - uint32_t src2Width, - uint32_t src2Stride, - int32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix multiplication of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. The size of src1 is src1Stride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src1Width -/// Width of the first source matrix. -/// -/// @param src1Height -/// Height of the first source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. The size of src2 is src2Stride*src1Width. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Width -/// Width of the second source matrix. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvMatrixMultiplyf32( const float32_t * __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Width, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two uint8_t type blocks. -/// -/// @param src1 -/// First source block. -/// -/// @param blockWidth -/// Width of the source block. -/// -/// @param blockHeight -/// Height of the source block. -/// \n\b NOTE: blockWidth*blockHeight should not be larger than 65536 -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source block. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// Block dot product (uint32_t). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API uint32_t -fcvBlockDotProductu8( const uint8_t * __restrict src1, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two float32_t type blocks. -/// -/// @param src1 -/// First source block. -/// -/// @param blockWidth -/// Width of the source block. -/// -/// @param blockHeight -/// Height of the source block. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source block. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// Block dot product (float32_t). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API float32_t -fcvBlockDotProductf32( const float32_t * __restrict src1, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Stride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two uint8_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAddu8u16( const uint8_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two int16_t type matrices with saturation. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). The result will be saturated to -/// int16_t. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAdds16( const int16_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - int16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (float32_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAddf32( const float32_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares. This function supports bigger size patch with u64 for squared -/// integral output. -/// \n\b NOTE: No extra border lines, the integral output buffer size is the same -/// as input image buffer size. -/// -/// @details -/// sum (X,Y) = sum_{x<=X,y<=Y} I(x,y) -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param dstIntgrl -/// Integral image. -/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*4 bytes -/// -/// @param dstIntgrlSqrd -/// Integral image of squared values. -/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*8 bytes -/// -/// @param dstIntgrlStride -/// dstIntgrl Image stride (in bytes). -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*4. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param dstIntgrlSqrdStride -/// dstIntgrlSqrd Image stride (in bytes). -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*8. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageu8u64( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t* __restrict dstIntgrl, - uint64_t* __restrict dstIntgrlSqrd, - uint32_t dstIntgrlStride, - uint32_t dstIntgrlSqrdStride); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalize the image according to histogram value of the pixel intensity. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Pointer to output image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - - -FASTCV_API void -fcvImageHistogramEqualizeu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate histogram at image patches. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageSpatialHistogramu8_v2(). In the 2.0.0 release, -/// fcvImageSpatialHistogramu8_v2 will be renamed to fcvImageSpatialHistogramu8 -/// and the signature of fcvImageSpatialHistogramu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param numPatterns -/// Number of patterns to be computed in the histogram -/// -/// @param grid_x -/// The number of grids along x dimension -/// -/// @param grid_y -/// The number of grids along y dimension -/// -/// @param histogram -/// Output histogram -/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageSpatialHistogramu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numPatterns, - uint32_t grid_x, - uint32_t grid_y, - float32_t*__restrict histogram); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 3x3 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// NOTE: it will replace the fcvFilterSobel3x3u8 in fastCV 2.0.0. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel3x3u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 5x5 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel5x5u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 7x7 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel7x7u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge detection with more controls to configurate the algorithm. -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. -/// The results are stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of the input image in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param kernelSize -/// The Sobel kernel size for calculating gradient. Supported sizes are 3, 5 and 7. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the norm of the -/// gradient at the pixel locations should be greater than 'lowThresh'. -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the norm of the gradient at the pixel should be -/// greater than 'highThresh'. -/// -/// @param normType -/// The norm definition to calculate the gradient magnitude. See fcvNormType. -/// -/// @param dst -/// Output 8-bit binarized image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// Edges are marked with pixels of 0xFF. The rest pixels have values of 0. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gx -/// Buffer to store horizontal gradient. Must be (gradStride)*(srcHeight) bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gy -/// Buffer to store vertical gradient. Must be (gradStride)*(srcHeight) bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of 'gx' and 'gy' gradient arrays, -/// is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. -/// If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCannyu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t kernelSize, - int32_t lowThresh, - int32_t highThresh, - fcvNormType normType, - uint8_t* __restrict dst, - uint32_t dstStride, - int16_t* __restrict gx, - int16_t* __restrict gy, - uint32_t gradStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Converts the bit depth of a single-channel uint8 image to int16_t type -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param shift -/// The number of bits to be right-shifted to adjust the output -/// \n\b NOTE: range from 0 to 8 -/// -/// @param dst -/// Output image which has the same dimension as the input image in int16_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth*2 -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvConvertDepthu8s16(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t shift, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Converts the bit depth of a single-channel int16_t image to uint8_t type -/// -/// @param src -/// Input int16_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth*2 -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param shift -/// The number of bits to be left-shifted to adjust the output -/// \n\b NOTE: range from 0 to 15 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// Output image which has the same dimension as the input image in uint8_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvConvertDepths16u8(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t shift, - fcvConvertPolicy policy, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Recursive Bilateral Filtering -/// -/// @details -/// The algorithm is described in paper Recursive Bilateral Filtering, ECCV2012 by Prof Yang Qingxiong -/// Different from traditional bilateral filtering, the bilateral filtering in this algorithm is actually performed in gradient domain. -/// The results are ususally better than tradition bilateral filters. Filtering is carried out in a recursive way, and it is efficient. -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Output uint8_t image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// \n\b WARNING: should be multiple of 8. -/// -/// @param sigmaColor -/// Filter sigma in the color space. Typical value 0.03f. Increasing this value means increasing the influence of the neighboring -///pixels of more different Color to the smoothing result. -/// -/// @param sigmaSpace -/// Filter sigma in the coordinate space. Typical value 0.1f. Increasing this value means increasing the influence of farther -/// pixels to the smoothing result. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBilateralFilterRecursiveu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - float32_t sigmaColor, - float32_t sigmaSpace ); - -//--------------------------------------------------------------------------- -/// @brief -/// Grow the seeds within the image to meaningful regions, -/// depending on the color or gray scale uniformity of the neighborhood pixels from the seeds. -/// -/// @param src -/// Pointer to 16-bit color (3-channel) or grayscale (1-channel) image. -/// -/// @param srcWidth -/// Width of src image, measured by pixels. -/// -/// @param srcHeight -/// Height of src image, measured by pixels. -/// -/// @param srcStride -/// Stride of src image, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. -/// -/// @param numChannel -/// Number of channels of src image. 1 for gray scale and 3 for color image. -/// -/// @param threshGrow -/// Threshold to grow the seed into a region. Higher value: larger uniform region grown. -/// Range of 3-channel image segmentation: 10~150. -/// Range of 1-channel image segmentation: 3~25. -/// -/// @param pointVector -/// A 2D point vector of seeds (provided by user) within the image. For N seeds, it is saved as [x0,y0,x1,y1,...,xN-1,yN-1]. -/// -/// @param numSeed -/// Number of seed points, equal to N used in pointVector. -/// -/// @param mode -/// Mode of seed grow. 0: distance measured with neighborhood pixel. 1: distance measured with seed pixel only. -/// -/// @param segLabel -/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. Pixels not grown from any seeds are labeled 0. -/// -/// @param segLabelStride -/// Stride of segmented labels, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. -/// -/// @return -/// 0 if successful. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvImageSegmentationSeedRegionGrows16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numChannel, - uint32_t threshGrow, - const uint32_t* __restrict pointVector, - uint32_t numSeed, - uint8_t mode, - uint32_t* __restrict segLabel, - uint32_t segLabelStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the local subtractive and contrastive normalization of the image. -/// For each pixel of the image, the mean and optionally standard deviation -/// is calculated for the patch centered around the pixel. Then the pixel is -/// normalized by the local mean and optionally standard deviation. -/// -/// @param src -/// The input image. Must be 8 bit grayscale image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of src image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param patchWidth -/// Width in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param patchHeight -/// Height in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param useStdDev (0 or 1) -/// if 1, the dst will be normalized with standard deviation. -/// -/// @param dst -/// The output image. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param dstStride -/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNormalizeLocalBoxu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchWidth, - uint32_t patchHeight, - uint32_t useStdDev, - int8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the local subtractive and contrastive normalization of the image. -/// For each pixel of the image, the mean and optionally standard deviation -/// is calculated for the patch centered around the pixel. Then the pixel is -/// normalized by the local mean and optionally standard deviation. -/// -/// @param src -/// The input image. Must be 32-bit float image. Size of buffer is -/// srcStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of src image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// -/// @param patchWidth -/// Width in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param patchHeight -/// Height in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param useStdDev (0 or 1) -/// if 1, the dst will be normalized with standard deviation. -/// -/// @param dst -/// The output image. -/// Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param dstStride -/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth*sizeof(float32_t). -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNormalizeLocalBoxf32( const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchWidth, - uint32_t patchHeight, - uint32_t useStdDev, - float32_t * __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine two channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1 and src2 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Results in dst [d0 t0 d1 t1 d2 t2 d3 t3...] -/// \n\b NOTE: Perform the same functionality as fcvInterleaveu8. -/// -/// @param src1 -/// One of the input images ( For example, Cb or Cr component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, Cb or Cr component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine2Planesu8( const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine three channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1, src2 and src3 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Data in src3 [s0 s1 s2 s3...] -/// Results in dst [d0 t0 s0 d1 t1 s1 d2 t2 s2 d3 t3 s3...] -/// -/// @param src1 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*3. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine3Planesu8(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine four channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1, src2, src3 and src4 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Data in src3 [s0 s1 s2 s3...] -/// Data in src3 [r0 r1 r2 r3...] -/// Results in dst [d0 t0 s0 r0 d1 t1 s1 r1 d2 t2 s2 r2 d3 t3 s3 r3...] -/// -/// @param src1 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src4 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src4Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src4Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine4Planesu8(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - const uint8_t *__restrict src4, - uint32_t src4Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extract channel as a single uint8_t type plane from an interleaved or multi-planar image format -/// -/// @details -/// -/// -/// @param src1 -/// The first plane in source image. For example, an intervealved RGB/RGBA plane or the Y plane. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 src1Stride is default to the size required by corresponding image format. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The second plane in souce image if available; otherwise, left at 0. -/// For example, the intervealved CbCr plane in FASTCV_NV12/FASTCV_NV21; or the Cb plane in FASTCV_IYUV/FASTCV_YUV4. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0, src2Stride is default to width for FASTCV_NV12/FASTCV_NV21/FASTCV_YUV4 and width/2 for FASTCV_IYUV. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// The third plane in souce image if available; otherwise, left at 0. -/// For example, the Cr plane in FASTCV_IYUV/FASTCV_YUV4. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 src3Stride is default to width for FASTCV_YUV4, and width/2 for FASTCV_IYUV. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcChannel -/// The index of the image channel to be extracted. Refer to fcvChannelType for details. -/// -/// @param srcFormat -/// The format of the source image. Different image formats require different src -/// and dst size. Refer to fcvImageFormat for details. -/// -/// @param dst -/// The result image (a uint8_t type plane). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0, dstStride is default to the size required by corresponding image format. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelExtractu8( const uint8_t *__restrict src1, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - fcvChannelType srcChannel, - fcvImageFormat srcFormat, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with MxN median filter (M,N have to be odd numbers) -/// -/// @details -/// Borders of m pixels in horizontal direction and n in vertical direction -/// are replaced with the source pixels, where m = (M-1)/2, n = (N-1)/2 -/// The NxN median filter applies on the image area -/// | a(n,m) , a(n,m+1), ..., a(n,srcWidth-m-1) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-n-1,m), ..., ..., a(srcHeight-n-1,srcWidth-m-1) |\n -/// -/// @param src -/// Input 16-bit signed image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth * 2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param M -/// Filter kernel width -/// \n\b NOTE: kernel width should be an odd number -/// -/// @param N -/// Filter kernel height -/// \n\b NOTE: kernel height should be an odd number -/// -/// @param dst -/// Output 16-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth * 2 -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterMedianMxNs16( const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t M, - uint32_t N, - int16_t* __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the convolution of an image with an M x N Kernel -/// -/// @details -/// The function computes the convolution of an unsigned char input image -/// with an M x N kernel of type short. The output is of type short -/// and is of the same size as the input image. The convolution is computed -/// based on the type of Border handling selected. -/// -/// -/// @param kernel -/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes -/// The kernel can be normalized before passing in by making use of the shift parameter. -/// -/// -/// @param M -/// Width of the kernel -/// -/// @param N -/// Height of the kernel -/// -/// @param shift -/// This parameter can be used to normalize the input kernel by converting the data into -/// fixed point values. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param dst -/// Output image which has the same dimensions as the input matrix. -/// The output is of type short, and must be allocated as dstStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If dstStride is equal to 0, -/// it will be set to srcWidth * sizeof(int16_t). -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 to 255. -/// -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterConvolveMxNu8s16( const int16_t* __restrict kernel, - uint32_t M, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue ); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the convolution of a image with an M x N Kernel -/// -/// @details -/// The function computes the convolution of an unsigned char input image -/// with an M x N kernel of type short. The output is of type unsigned char -/// and is of the same size as the input image. The convolution is computed -/// based on the type of Border handling selected. -/// -/// -/// @param kernel -/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes -/// The kernel can be normalized before passing in by making use of the shift parameter. -/// -/// -/// @param M -/// Width of the kernel -/// -/// @param N -/// Height of the kernel -/// -/// @param shift -/// This parameter can be used to normalize the input kernel by converting the data into -/// fixed point values. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param dst -/// Output image which has the same dimensions as the input matrix. -/// The output is of type unsigned char, and must be allocated as dstStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If dstStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterConvolveMxNu8(const int16_t* __restrict kernel, - uint32_t M, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - - -//--------------------------------------------------------------------------- -/// @brief -/// Smooth a uint8_t image with a 3x3 box filter with border handling scheme specified by user -/// -/// @details -/// smooth with 3x3 box kernel and normalize: -/// \n[ 1 1 1 -/// \n 1 1 1 -/// \n 1 1 1 ]/9 -/// -/// @param src -/// Input uint8_t image. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param dst -/// Output image which has the same type, and size as the input image. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBoxFilter3x3u8_v2( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterErode3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 255. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterErode3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of NxN neighborhood window. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param N -/// Dimension of the neighborhood window. -/// \n\b WARNING: must be an odd number -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterErodeNxNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t N, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterDilate3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterDilate3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of NxN neighborhood window. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param N -/// Dimension of the neighborhood window. -/// \n\b WARNING: must be an odd number -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param tmp -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * height -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterDilateNxNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t N, - uint8_t* __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border is blurred by 0-padding adjacent values. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterGaussian3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are extrapolated according to borderType. -/// The 3x3 mask convolves with the whole image area. -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values are ignored. The 3x3 mask convolves with the following image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterMedian3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate histogram at image patches. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageSpatialHistogramu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageSpatialHistogramu8, -/// \a fcvImageSpatialHistogramu8_v2 will be removed, and the current signature -/// for \a fcvImageSpatialHistogramu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageSpatialHistogramu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param numPatterns -/// Number of patterns to be computed in the histogram -/// -/// @param grid_x -/// The number of grids along x dimension -/// -/// @param grid_y -/// The number of grids along y dimension -/// -/// @param histogram -/// Output histogram -/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) -/// -/// @param normalize_factor -/// Scale factor with float32_t type to normalize result. When set to 0, the result is -/// normalized by (srcWidth/grid_x) * (srcHeight/grid_y) -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageSpatialHistogramu8_v2( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numPatterns, - uint32_t grid_x, - uint32_t grid_y, - float32_t*__restrict histogram, - float32_t normalize_factor); - -//------------------------------------------------------------------------------ -/// @brief -/// Image downscaling using bilinear method -/// -/// @param src -/// Input image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// If left at 0, srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width -/// -/// @param dstHeight -/// Output image height -/// -/// @param dstStride -/// Stride of image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// If left at 0, dstStride is default to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBLu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a Table Look-up transformation to a single-channel uint8 image -/// -/// @details -/// Each pixel in the input image is used to index into a look-up table and the indexed look-up table -/// value is then put into the output image -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param lut -/// The Look-up Table given as a 256-element array of type uint8_t -/// -/// @param dst -/// Output image which has the same dimension as the input image in uint8_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvTableLookupu8( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t *__restrict lut, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v3 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @interpolation -/// Specifies the interpolation method to be used. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvWarpPerspectiveu8_v3( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float *__restrict projectionMatrix, - fcvInterpolationType interpolation ); - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v4 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @interpolation -/// Specifies the interpolation method to be used. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvWarpPerspectiveu8_v4( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float *__restrict projectionMatrix, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue -); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a generic geometrical transformation to a greyscale uint8 image. -/// The interpolation method is specified through a parameter. -/// -/// @details -/// The greyscale of each pixel in the destination image is obtained from a location of the source image -/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, -/// thus interpolations are involved. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// -/// @param dstHeight -/// Output image height. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param mapX -/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapX(i,j) =jj. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapY -/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapY(i,j) =ii. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapStride -/// the stride of the mapX and mapY -/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param interpolation -/// the interpolation method to derive the dst pixel value. -/// supported methods are nearest neighbor, bilinear and area. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRemapu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride, - fcvInterpolationType interpolation -); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a generic geometrical transformation to a greyscale uint8 image. -/// The interpolation method is specified through a parameter. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvRemapu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvRemapu8, -/// \a fcvRemapu8_v2 will be removed, and the current signature -/// for \a fcvRemapu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvRemapu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// The greyscale of each pixel in the destination image is obtained from a location of the source image -/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, -/// thus interpolations are involved. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// -/// @param dstHeight -/// Output image height. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param mapX -/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapX(i,j) =jj. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapY -/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapY(i,j) =ii. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapStride -/// the stride of the mapX and mapY -/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param interpolation -/// the interpolation method to derive the dst pixel value. -/// supported methods are nearest neighbor, bilinear and area. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRemapu8_v2(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue -); - -//--------------------------------------------------------------------------- -/// @brief -/// Gradient Magnitude Computation from two int16_t type matrices. -/// -/// @details -/// The function takes two gradient matrices in int16_t and computes the -/// magnitude in int16_t. -/// \n\b NOTE: Saturation is used when computed magnitude value is larger than max limit of int16_t. -/// -/// @param src1 -/// The gradient matrix in X direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The gradient matrix in Y direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvMagnitudes16( const int16_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t *__restrict src2, - uint32_t src2Stride, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Gradient Phase Computation from two int16_t type matrices. -/// -/// @details -/// The function takes two gradient matrices in int16_t and computes the -/// phase for each pixel, storing results in a uint8_t matrix. The phase angle is translated -/// to [0, 2*PI) and then mapped to range [0, 255). -/// -/// @param src1 -/// The gradient matrix in X direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The gradient matrix in Y direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPhases16 ( const int16_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t *__restrict src2, - uint32_t src2Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//-------------------------------------------------------------------------------- -/// Computes the 1D or 2D Fast Fourier Transform of a matrix. -/// -/// @details -/// Computes the 1D or 2D Fast Fourier Transform of a real valued matrix. For the -/// 2D case, The width and height of the input and output matrix must be powers of 2. -/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. -/// -/// @param src -/// An 8 bit unsigned real valued input matrix. The dimensions of the matrix must be powers -/// of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be -/// a power of 2. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// \n\b NOTE: Must be a power of 2 -/// -/// @param srcHeight -/// Height of the source matrix. -/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case -/// -/// @param srcStride -/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The computed FFT matrix. The FFT coefficients are stored in interleaved fashion, i.e., -/// Re1 Im1 Re2 Im2 and so on. Hence the dimensions of the dst are (2 x srcWidth, srcHeight) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0, dstStride is set to 2 x srcWidth x sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFFTu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the 1D or 2D Inverse Fast Fourier Transform of a matrix. -/// -/// @details -/// Computes the 1D or 2D Inverse Fast Fourier Transform of a complex valued matrix. For the -/// 2D case, The width and height of the input and output matrix must be powers of 2. -/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. -/// -/// @param src -/// An 32 bit floating point complex valued input matrix. The data in the matrix must be stored -/// in an interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on. The dimensions of the matrix must -/// be powers of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be -/// a power of 2. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. The width here is the number of floating point units in the matrix. Since -/// the data is interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on, the width is the total number of real -/// and complex units in the matrix. For example, if the Matrix has data values Re1 Im1 Re2 Im2 Re3 Im3 Re4 Im4, -/// then the width here is 8 units. -/// \n\b NOTE: Must be a power of 2 -/// -/// @param srcHeight -/// Height of the source matrix. -/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case -/// -/// @param srcStride -/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth x sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The computed IFFT matrix. The matrix is real valued and has no imaginary components. -/// Hence the dimensions of the dst are (srcWidth / 2 , srcHeight) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0, dstStride is set to (srcWidth / 2). -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvIFFTf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. -/// The scaling ratios are automatically determined from the specified -/// source image size and destination image size. -/// -/// @details -/// Scale up or down the source image of size srcWidth-by-srcHeight -/// to the destination image of size dstWidth-by-dstHeight. -/// NOTE: dstWidth > 0 && dstHeight > 0. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=dstWidth as default -/// -/// @param interpolation -/// The interpolation method used for scaling. Please see fcvInterpolationType. -/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: -/// Nearest neighbor interpolation. -/// FASTCV_INTERPOLATION_TYPE_BILINEAR: -/// Bilinear interpolation. -/// FASTCV_INTERPOLATION_TYPE_AREA: -/// Interpolation by area. Output values are determined by weighted averages of -/// the source pixels covered by the destination pixel. The averaging weight -/// for each source pixel is proportional to its area overlapping with -/// the destination pixel. Interpolation by area may produce more precise -/// images for scale down operations. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other values otherwise. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - fcvInterpolationType interpolation); - -//--------------------------------------------------------------------------- -/// @brief -/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. -/// The scaling ratios are automatically determined from the specified -/// source image size and destination image size. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleu8, -/// \a fcvScaleu8_v2 will be removed, and the current signature -/// for \a fcvScaleu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Scale up or down the source image of size srcWidth-by-srcHeight -/// to the destination image of size dstWidth-by-dstHeight. -/// NOTE: dstWidth > 0 && dstHeight > 0. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=dstWidth as default -/// -/// @param interpolation -/// The interpolation method used for scaling. Please see fcvInterpolationType. -/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: -/// Nearest neighbor interpolation. -/// FASTCV_INTERPOLATION_TYPE_BILINEAR: -/// Bilinear interpolation. -/// FASTCV_INTERPOLATION_TYPE_AREA: -/// Interpolation by area. Output values are determined by weighted averages of -/// the source pixels covered by the destination pixel. The averaging weight -/// for each source pixel is proportional to its area overlapping with -/// the destination pixel. Interpolation by area may produce more precise -/// images for scale down operations. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED, FASTCV_BORDER_CONSTANT -/// and FASTCV_BORDER_REPLICATE. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other values otherwise. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleu8_v2( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Perspective warp two images using the same transformation. -/// Bi-linear interpolation is used where applicable. -/// -/// @details -/// Perspective warp two images (or buffer) using the same transformation in one function -/// call. This can be used, for example, to warp a grayscale image and an alpha image at -/// the same time, or warp two color channels (for example u and v de-interleaved for YUV). -/// -/// @param src1 -/// First input 8-bit image. Size of buffer is src1Stride*srcHeight bytes. -/// -/// @param src2 -/// Second input 8-bit image. Size of buffer is src2Stride*srcHeight bytes. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Stride -/// Input image 1 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// -/// @param src2Stride -/// Input image 2 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// -/// @param dst1 -/// First warped output image (correspond to src1). Size of buffer is dst1Stride*dstHeight bytes. -/// -/// @param dst2 -/// Second warped output image (correspond to src2). Size of buffer is dst2Stride*dstHeight bytes. -/// -/// @param dstWidth -/// Dst image width. -/// -/// @param dstHeight -/// Dst image height. -/// -/// @param dst1Stride -/// Output image 1 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to dstWidth. -/// -/// @param dst2Stride -/// Output image 2 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to dstWidth. -/// -/// @param warpmatrix -/// 3x3 perspective transformation matrix (generally a homography). -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcv2PlaneWarpPerspectiveu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - uint32_t src2Stride, - uint8_t* __restrict dst1, - uint8_t* __restrict dst2, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dst1Stride, - uint32_t dst2Stride, - float32_t* __restrict warpmatrix ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 3x3 Gaussian filter kernel -/// -/// @details -/// This function first blurs the input image using a 3x3 Gaussian kernel, and then downsamples -/// the image by selecting every other row and column. The dimensions of the destination image are -/// computed as follows : dstWidth = (srcWidth + 1)/2 , dstHeight = (srcHeight + 1)/2 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the input image. -/// -/// @param srcHeight -/// Height of the input image -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (srcWidth + 1) / 2 x (srcHeight + 1) / 2. -/// \n\b NOTE: border values have been taken care of w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as (srcWidth+1)/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as (srcWidth+1)/2 if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleDownBy2Gaussian3x3u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one L-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffss8( const int8_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const int8_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Adds a scalar value to every element of a Matrix. -/// -/// @details -/// Adds a floating point scalar value to each element of the source Matrix -/// and stores the result of the addition in the corresponding element -/// of the destination matrix. -/// -/// @param src -/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The floating point scalar to be added to the source matrix. -/// -/// @param dst -/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvAddScalarf32(const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t scalar, - float32_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Adds a scalar value to every element of a Matrix. -/// -/// @details -/// Adds a signed 16-bit integer scalar value to each element of the source Matrix -/// and stores the result of the addition in the corresponding element -/// of the destination matrix. -/// \n\b NOTE : If the sum of the scalar and matrix element exceeds the maximum value -/// of a signed 16-bit integer, the result is clipped to this maximum value, while -/// if the sum goes below the minimum value of a signed 16-bit integer, it is clipped -/// to this minimum value. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The signed 16-bit integer scalar to be added to the source matrix. -/// -/// @param dst -/// Output 16-bit signed integer matrix. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvAddScalars16(const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t scalar, - int16_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Multiplies a scalar value to every element of a Matrix. -/// -/// @details -/// Multiplies a floating point scalar value to each element of the source Matrix -/// and stores the result of the multiplication in the corresponding element -/// of the destination matrix. -/// -/// @param src -/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The floating point scalar to be multiplied to the source matrix. -/// -/// @param dst -/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMultiplyScalarf32(const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t scalar, - float32_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Multiplies a scalar value to every element of a Matrix. -/// -/// @details -/// Multiplies a signed 16-bit scalar value to each element of the source Matrix -/// and stores the result of the multiplication in the corresponding element -/// of the destination matrix. -/// \n\b NOTE : If the product of the scalar and matrix element exceeds the maximum value -/// of a signed 16-bit integer, the result is clipped to this maximum value, while -/// if the product goes below the minimum value of a signed 16-bit integer, it is clipped -/// to this minimum value. The API can also handle fractional scalars. Use fixed point conversion -/// and use the shift parameter to decide the number of bits by which the result is shifted by. This -/// affects the precision of the result. If you wish to perform pure integer multiplication, set the -/// shift parameter to 0. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The signed 8-bit integer scalar to be multiplied to the source matrix. -/// -/// @param shift -/// The number of bits that the result has to be shifted by. Used to handle fractional scalar multiplication. -/// If your input scalar is a pure integer, set shift to 0. -/// -/// @param dst -/// Output signed 16-bit integer matrix. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMultiplyScalars16( const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int8_t scalar, - int8_t shift, - int16_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 -/// and the signature of fcvMinMaxLocu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict minVal, - uint8_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 -/// and the signature of fcvMinMaxLocu16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu16(const uint16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t *__restrict minVal, - uint16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 -/// and the signature of fcvMinMaxLocs16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocs16(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t *__restrict minVal, - int16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 -/// and the signature of fcvMinMaxLocu32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu32(const uint32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t *__restrict minVal, - uint32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 -/// and the signature of fcvMinMaxLocs32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocs32(const int32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t *__restrict minVal, - int32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 -/// and the signature of fcvMinMaxLocf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocf32(const float32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t *__restrict minVal, - float32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 -/// and the signature of fcvMinMaxLocf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(float32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocf32_v2(const float32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t *__restrict minVal, - float32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 -/// and the signature of fcvMinMaxLocu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint8_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu8_v2(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict minVal, - uint8_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 -/// and the signature of fcvMinMaxLocu16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint16_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocu16_v2(const uint16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t *__restrict minVal, - uint16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 -/// and the signature of fcvMinMaxLocs16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int16_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocs16_v2(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t *__restrict minVal, - int16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 -/// and the signature of fcvMinMaxLocu32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocu32_v2(const uint32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t *__restrict minVal, - uint32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 -/// and the signature of fcvMinMaxLocs32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocs32_v2(const int32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t *__restrict minVal, - int32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Transposes an interleaved RGB image -/// -/// @details -/// Computes the transpose of an interleaved RGB image src, and stores the result in -/// dst -/// -/// @param src -/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Image. -/// -/// @param srcHeight -/// Height of the Image. -/// -/// @param srcStride -/// Stride of the Image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcWidth bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcHeight. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcHeight if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvTransposeRGB888u8(const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the cross-product of N pairs of 3x1 vectors -/// -/// @details -/// Computes the cross-product of N pairs of 3x1 vectors. For each pair of 3x1 vectors, -/// ai and bi, the output vector ci is given by ci = ai x bi -/// -/// @param a -/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is -/// as follows x0 y0 z0 x1 y1 z1 ....... -/// -/// @param b -/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is -/// as follows x0 y0 z0 x1 y1 z1 ....... -/// -/// @param c -/// Output buffer containing the resultant "N" 3x1 Vectors. Each 3 x 1 Vector in c is computed from the corresponding -/// 3 x 1 pairs in a & b. Must be of length N * 3. -/// -/// @param N -/// Number of vector pairs. For example if N = 10, then a, b and c will have to be 10 x 3 in length -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvCrossProduct3x1f32(const float32_t * __restrict a, - const float32_t * __restrict b, - float32_t * __restrict c, - uint32_t N); - -//------------------------------------------------------------------------------ -/// @brief -/// Solves a Linear System of Equations using LU-Decomposition -/// -/// @details -/// Solves a Linear System of Equations using LU Decomposition. Given -/// a system defined by A x = b, the function decomposes A into a lower -/// triangular matrix L and an upper triangular matrix U. It then computes x -/// by first solving L y = B by forward substitution for y, and then solving -/// the system of linear equations U x = y by backward substitution for x. -/// \n\b NOTE : Pivoting is used here to ensure that any non singular matrix -/// can be solved. This is because not all Matrices have a LU decomposition. -/// Pivoting helps to overcome this issue. -/// -/// @param A -/// Input coefficient matrix of the linear system of dimension N x N -/// \n\b WARNING: must be square. -/// -/// @param b -/// Component vector of the linear system of dimension N x 1 -/// -/// @param N -/// Dimension of the input Matrix A and component vector b -/// -/// @param pivot -/// An N x 1 pivot array which is populated as follows : For each k = 0, 1,...., N-1 -/// The ith element of pivot contains the row interchanged with row i when k = i. -/// Pivoting is used both for numerical stability and also ensuring that an LU factorization -/// exists for the input matrix A. -/// -/// @param x -/// The solution of the linear system, an N x 1 Vector. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvSolveLUf32(float32_t* __restrict A, - float32_t* __restrict b, - uint32_t N, - uint8_t* __restrict pivot, - float32_t* __restrict x); - - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise AND operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseAndu8(const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise Exclusive Or operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseXoru8( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise Not operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseNotu8(const uint8_t * src, - uint32_t width, - uint32_t height, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two uint8_t type matrices to one uint8_t matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddu8(const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two int16_t type matrices which allows in-place operation -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAdds16_v2( const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - int16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of one uint16_t type matrix and one uint8_t matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddu16u8u16 (const uint16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtractu8 ( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint16_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtracts16 (const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - int16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. - -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtractu8s16 ( const uint8_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - int16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two int16_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplys16( const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplyu8s16( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplyu8( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Calculate the weighted sum of two uint8_t type matrices -/// -/// @details -/// Specifically, when 0 <= alpha <= 1 and beta = 1-alpha, the function accumulates a weighted value from -/// an input image to an output image -/// \n\b NOTE: alpha and beta should be within the range of (-128.0, 127.996) and have up to three digits decimal precision -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param alpha -/// The weight value applied to src1 matrix, provided by float32_t type -/// -/// @param beta -/// The weight value applied to src2 matrix, provided by float32_t type -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddWeightedu8(const uint8_t * src1, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - float32_t alpha, - float32_t beta, - uint8_t * dst, - uint32_t dstStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Add a squared value of one type uint8 matrix to the other type uint16 type matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddSquaredu8u16(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint16_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - uint16_t * dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Swap Chroma component order. -/// -/// @details -/// This function swaps the interleaved Chroma component order from CbCr to -/// CrCb or from CrCb to CbCr. -/// -/// @param src -/// Pointer to the input image -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width in the number of CbCr or CrCb pairs. -/// -/// @param srcHeight -/// The Chroma component height. -/// -/// @param srcStride -/// Stride of input image in bytes (i.e., number of bytes between column 0 of row 0 -/// and column 0 of row 1). If left at 0, srcStride is default to srcWidth * 2. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Pointer to the output image -/// \n\b WARNING: size must match input image. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Stride of output image in bytes (i.e., number of bytes between column 0 of -/// row 0 and column 0 of row 1). If left at 0, dstStride is default to -/// srcWidth * 2. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorCbCrSwapu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to HSV space. -/// -/// @details -/// -/// @param src -/// Source 24-bit image, RGB888 format (R is MSB byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth*3 as default -/// -/// @param dst -/// Destination 24-bit image. HSV888 format (H is MSB byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcWidth*3 as default -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvColorRGB888ToHSV888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------/ -/// @brief -/// SVM prediction for two classes -/// -/// @details -/// The function returns the confidence scores for test vectors using the equation: -/// confidence(i) = sum_j( svCoef[j] * Kernel(vec_i, sv_j) - rho; -/// The SVM model(svCoef, sv, rho) can be obtained using the training function of libSVM or openCV. -/// -/// @param kernelType -/// kernelType options: 'FASTCV_SVM_LINEAR','FASTCV_SVM_POLY','FASTCV_SVM_RBF','FASTCV_SVM_SIGMOID'. -/// FASTCV_SVM_LINEAR: Kernel(xi, xj) = xi'*xj -/// FASTCV_SVM_POLY: Kernel(xi, xi) = (gamma * xi' * xj + coef0)^degree, (gamma>0 , degree is positive integer). -/// FASTCV_SVM_RBF: Kernel(xi,xj) = exp(-gamma*||xi-xj||^2), (gamma>0). -/// FASTCV_SVM_SIGMOID: Kernel(xi, xj) = tanh(gamma * xi' * xj + coef0) -/// -/// @param degree -/// Parameter degree of a kernel function (FASTCV_SVM_POLY). -/// \n\b NOTE: Degree should be positive integer. -/// -/// @param gamma -/// Parameter of a kernel function (FASTCV_SVM_POLY / FASTCV_SVM_RBF / FASTCV_SVM_SIGMOID). -/// \n\b NOTE: gamma > 0 for FASTCV_SVM_Ploy and FASTCV_SVM_RBF -/// -/// @param coef0 -/// Parameter coef0 of a kernel function (FASTCV_SVM_LINEAR / FASTCV_SVM_POLY / FASTCV_SVM_SIGMOID). -/// -/// @param sv -/// Support vectors. -/// -/// @param svLen -/// Feature length, (support vector length = feature length). -/// -/// @param svNum -/// Number of support vectors. -/// -/// @param svStride -/// support vector stride. -/// Stride of support vector 2D matrix (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, svStride is set as svLen*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. -/// -/// @param svCoef -/// Coefficent of support vectors, length equals to the Number of SV. -/// -/// @param rho -/// SVM bias. -/// -/// @param vec -/// Test vectors, it has same width as sv. -/// -/// @param vecNum -/// Number of test vectors. -/// -/// @param vecStride -/// Stride of test vectors. -/// Stride of test vector 2D matrix (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, vecStride is set as svLen*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. -/// -/// @param confidence -/// Output, store confidence value of each test vector. The length is vecNum. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup machine_learning -//------------------------------------------------------------------------------/ - -FASTCV_API fcvStatus -fcvSVMPredict2Classf32( fcvSVMKernelType kernelType, - uint32_t degree, - float32_t gamma, - float32_t coef0, - const float32_t* __restrict sv, - uint32_t svLen, - uint32_t svNum, - uint32_t svStride, - const float32_t* __restrict svCoef, - float32_t rho, - const float32_t* __restrict vec, - uint32_t vecNum, - uint32_t vecStride, - float32_t* __restrict confidence ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow (with stride so ROI can be supported) -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, -/// \a fcvTrackLKOpticalFlowu8_v3 will be removed, and the current signature -/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input image width. -/// -/// @param height -/// Input image height. -/// -/// @param stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. -/// NOTE: should be a multiple of 8. -/// -/// @param src1Pyr -/// Image Pyramid of src1 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_estimate -/// Pointer to X,Y floating point, sub-pixel coordinates for estimated features -/// on the new frame stored as X,Y tuples. featureXY array storage must -/// has the same length as featureXY -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param termCriteria -/// The enum parameter to specify termination criteria. See fcvTerminationCriteria for details -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level if -/// FASTCV_TERM_CRITERIA_ITERATIONS is set as the termCriteria -/// \n\b NOTE: will be saturated to range [1, 100]; suggested value 5 or 7 -/// -/// @param maxEpsilon -/// Epsilon value in float32_t for error measure to determine the iteration -/// \n\b NOTE: the value should be within [0, 10]; suggested value 0.03*0.03 -/// -/// @param use_initial_estimate -/// The flag indicatiing if to use initial estimations stored in featureXY_estimate -/// to start the search. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvTrackLKOpticalFlowu8_v3 ( const uint8_t *__restrict src1, - const uint8_t *__restrict src2, - uint32_t width, - uint32_t height, - uint32_t stride, - const fcvPyramidLevel_v2 * __restrict src1Pyr, - const fcvPyramidLevel_v2 * __restrict src2Pyr, - const float32_t * __restrict featureXY, - const float32_t * __restrict featureXY_estimate, - float32_t * __restrict featureXY_out, - int32_t * __restrict featureStatus, - int32_t featureLen, - int32_t windowWidth, - int32_t windowHeight, - int32_t nPyramidLevels, - fcvTerminationCriteria termCriteria, - int32_t maxIterations, - float32_t maxEpsilon, - int32_t use_initial_estimate); - -//------------------------------------------------------------------------------ -/// @brief -/// Undistort a disparity image and optionally convert the undistorted disparity image into a -/// depth image. -/// -/// @param src -/// Pointer to the disparity input image -/// -/// @param srcWidth -/// Width of the disparity input image in pixel. The number of pixels in a row. -/// -/// @param srcHeight -/// Height of the disparity input image in pixel. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @param mask -/// Pointer to the returned foreground mask image. -/// It's a 1-channel image, same width and height as src. -/// If an entry set to 1, there will be a valid undistorted dispartity or depth value. -/// If an entry set to 0, there will be no valid undistorted dispartity or depth value. -/// -/// @param maskStride -/// Stride of the foreground mask image. It's the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 MaskStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param pixelDistortion -/// Pointer to the pixel distortion value for each pixel in the image. It has the same dimensions -/// as the input image src. -/// -/// @param pixelDistortionStride -/// Stride of pixel distortion value for each pixel in the image. -/// It's the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 pixelDistortionStride is default to srcWidth*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param convertDepth -/// This parameter is a flag to enable or disable the conversion of disparity to depth. -/// If set to 1, then the undistorted disparity values will be converted to depth -/// and returned in the dst buffer. -/// If set to 0, then the undistorted disparity will be returned in the dst buffer. -/// -/// @param imageDistortion -/// ImageDistortion contains two elements. The First part contains the spatial distortion pattern, -/// and the second part contains the decay of the distortion effect. -/// -/// @param depthParam -/// Parameters used to transform disparity to depth values. -/// The equation is -/// undistortedDepthValue = 1 / (undistortedDisparityValue * depthParam[0] + depthParam[1]) -/// -/// @param dst -/// Output matrix which has the same width, length and channel number as src. -/// The buffer contains undistorted disparity values if convertDepth is set to 0 and -/// contains the undistorted depth values if convertDepth is set to 1 -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvUndistortDisparityConvertDepthf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict mask, - uint32_t maskStride, - const float32_t* __restrict pixelDistortion, - uint32_t pixelDistortionStride, - uint32_t convertDepth, - const float32_t* __restrict imageDistortion, - const float32_t* __restrict depthParam, - float32_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Registers an input Depth Image with an input Color Image -/// -/// @param src -/// Pointer to the input depth image -/// -/// @param srcWidth -/// The width of the input depth image. -/// -/// @param srcHeight -/// The height of the input depth image -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// \n\b NOTE: should be multiple of 8. -/// -/// @param Kdinv -/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix -/// arranged row wise. -/// -/// @param Kc -/// Kc is an array of 9 elements which represents the 3x3 color camera intrinsic parameters -/// arranged row wise -/// -/// @param Rd2c -/// Rd2c is an array of 9 element which represents the 3D Rotation (3x3) matrix from the Depth -/// Camera to the Color Camera arranged row wise -/// -/// @param Td2c -/// Td2c is an array of 3 element which represents the transform parameter from the Depth -/// Camera to the Color Camera. -/// -/// @param dst -/// Output matrix which has the same width, length and channel number as src -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvRegisterDepthImagef32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict Kdinv, - const float32_t* __restrict Kc, - const float32_t* __restrict Rd2c, - const float32_t* __restrict Td2c, - float32_t* __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Convert depth image into 3D point Cloud -/// -/// @param src -/// Pointer to the depth image -/// -/// @param srcWidth -/// Width of the depth image in pixel. The number of pixels in a row. -/// -/// @param srcHeight -/// Height of the depth image in pixel -/// -/// @param srcStride -/// Stride of depth image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// \n\b NOTE: should be multiple of 8. -/// -/// @param Kdinv -/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix -/// arranged row wise. -// -/// @param dst -/// Pointer to the 3D point cloud in an interleaved fashion x0,y0,z0,x1,y1,z1. -/// It has a width of 3*srcWidth and has the same height as the src buffer. -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 3*srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvConvertDepthImageToPointCloudf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict Kdinv, - float32_t* __restrict dst, - uint32_t dstStride); - -// ----------------------------------------------------------------------------- -/// @brief -/// Extract Histogram of Oriented Gradients (HOG) descriptor given an image's gradient strength -/// and orientation -/// -/// @param strength -/// The gradient strength at each pixel. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input window width. -/// -/// @param height -/// Input window height. -/// -/// @param strengthStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 strengthStride is default to width*2. -/// NOTE: should be a multiple of 8. -/// -/// @param orientation -/// Gradient orientation at each pixel. When normMethod is FASTCV_HOG_NORM_REGULAR or -/// FASTCV_HOG_NORM_RENORMALIZATION, orientation should be within range of [0, 179]; while -/// FASTCV_HOG_NORM_FHOG is used, orientation should be within [0, 359] to meet its contrast- -/// sensitive requirements. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param orientationStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 orientationStride is default to width*2. -/// NOTE: should be a multiple of 8. -/// -/// @param cellSize -/// The size of one cell in pixels. The typical cell size is 4. -/// -/// @param blockSize -/// Block size in pixels. It must be a multiple of cellSize. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockSize is by default equal to cellSize -/// -/// @param blockStep -/// Block step in pixels when sliding the block over the image. If the blockStep -/// is a multiple of cellSize, faster approach would be taken when normMethod -/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param binSize -/// Number of bins in the gradient histogram. Typical binSize is 9. -/// -/// @param normMethod -/// The enum parameter to specify the normalization method for HOG descriptor construction. See -/// fcvHOGNormMethod for details. -/// -/// @param hogVector -/// The output descriptor vector in uint16_t. The length of the vector is obtained by fcvGetHOGVectorLengthu32 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvExtractHOGu16(const uint16_t* __restrict strength, - uint32_t width, - uint32_t height, - uint32_t strengthStride, - const uint16_t* __restrict orientation, - uint32_t orientationStride, - uint32_t cellSize, - uint32_t blockSize, - uint32_t blockStep, - uint32_t binSize, - fcvHOGNormMethod normMethod, - uint16_t* __restrict hogVector, - uint32_t flen, - void* handle); - -// ----------------------------------------------------------------------------- -/// @brief -/// Calculate the length of the output vector for HOG extraction -/// -/// @param width -/// Input window width. -/// -/// @param height -/// Input window height. -/// -/// @param cellSize -/// The size of one cell in pixels. The typical cell size is 4. -/// -/// @param blockSize -/// Block size in pixels. It must be a multiple of cellSize. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param blockStep -/// Block step in pixels when sliding the block over the image. If the blockStep -/// is a multiple of cellSize, faster approach would be taken when normMethod -/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param binSize -/// Number of bins in the gradient histogram. Typical binSize is 9. -/// -/// @param normMethod -/// The enum parameter to specify the normalization method for HOG descriptor construction. See -/// fcvHOGNormMethod for details. -/// -/// @param -/// The length of HOG vector in uint32_t -/// -/// @param hogHandle -/// Output. the hogHandle to be used in subsequent calls. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvHOGInit(uint32_t width, - uint32_t height, - uint32_t cellSize, - uint32_t blockSize, - uint32_t blockStep, - uint32_t binSize, - fcvHOGNormMethod normMethod, - uint32_t *vecLength, - void **hogHandle - ); -//------------------------------------------------------------------------------ -/// @brief Function to release HOG resources. -/// @param hogHandle -/// Handle to be used to free up HOG resources. -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void fcvHOGDeInit(void* hogHandle); - - - -#ifdef __cplusplus -}//extern "C" -#endif - -#endif diff --git a/phonelibs/fastcv/aarch64/libfastcv.a b/phonelibs/fastcv/aarch64/libfastcv.a deleted file mode 100644 index 32729f8a95..0000000000 Binary files a/phonelibs/fastcv/aarch64/libfastcv.a and /dev/null differ diff --git a/phonelibs/fastcv/aarch64/libfastcvadsp_stub.so b/phonelibs/fastcv/aarch64/libfastcvadsp_stub.so deleted file mode 100644 index 0a1bdaf04b..0000000000 --- a/phonelibs/fastcv/aarch64/libfastcvadsp_stub.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0c4e14e2e3a56490d63db057f8a3cd7459736c1e19d5b63c0c19510c9f02885a -size 370408 diff --git a/phonelibs/fastcv/aarch64/libfastcvopt.so b/phonelibs/fastcv/aarch64/libfastcvopt.so deleted file mode 100644 index 1e81b92f08..0000000000 --- a/phonelibs/fastcv/aarch64/libfastcvopt.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:374f4475c8f66c0b90c47895773a6de1ba87b56bf3fc54c7be4f67fe8c791d5a -size 6188968 diff --git a/phonelibs/fastcv/x64/include/fastcv.h b/phonelibs/fastcv/x64/include/fastcv.h deleted file mode 100755 index 0bffaba27c..0000000000 --- a/phonelibs/fastcv/x64/include/fastcv.h +++ /dev/null @@ -1,23220 +0,0 @@ -#ifndef FASTCV_H -#define FASTCV_H - -/**============================================================================= - -@file - fastcv.h - -@brief - Public API - - -Copyright (c) 2011-2013 Qualcomm Technologies Incorporated. -All Rights Reserved Qualcomm Technologies Proprietary - -Export of this technology or software is regulated by the U.S. -Government. Diversion contrary to U.S. law prohibited. - -All ideas, data and information contained in or disclosed by -this document are confidential and proprietary information of -Qualcomm Technologies Incorporated and all rights therein are expressly reserved. -By accepting this material the recipient agrees that this material -and the information contained therein are held in confidence and in -trust and will not be used, copied, reproduced in whole or in part, -nor its contents revealed in any manner to others without the express -written permission of Qualcomm Technologies Incorporated. - -=============================================================================**/ - -/**============================================================================= -@mainpage FastCV Public API Documentation - -@version 1.2.2 - -@section Overview Overview - -FastCV provides two main features to computer vision application developers: - - First, it provides a library of frequently used computer vision (CV) - functions, optimized to run efficiently on mobile devices. - - Second, it provides a clean processor-agnostic hardware acceleration API, - under which chipset vendors can hardware accelerate FastCV functions on - their hardware. - -This initial release (FastCV 1.0) only supports Android mobile developers; -however, we intend to support iOS and Windows devices as soon as possible. -FastCV 1.0 is available for download for free from developer.qualcomm.com. - -FastCV 1.0 is released as a unified binary, a single binary containing two -implementations of the library. - - The first implementation runs on ARM processor, and is referred to as - the "FastCV for ARM." - - The second implementation runs only on Qualcomm Snapdragon - chipsets, and is called "FastCV for Snapdragon." - -Releases are generally motivated for the following reasons: - - Changes to previously released APIs - - Addition of new functions - - Performance improvements and/or bug fixes - also known as implementation - modifications - - Each motivation has a varying degree of impact on the user of the library. - The general release numbering scheme captures this variety of motivations. - - Given release ID: A.B.C - - An increase in "A" indicates that a previously released API has changed, - so a developer may encounter compilation issues which require modification - of their code in order to adhear to the modified API. Qualcomm will make - every effort to minimize these changes. Additionally, new functions and - implementation modifications may be present. - - An increase in "B" indicates that new functions have been added to the - library, so additional functionality is available, however existing APIs - have not changed. Additionally, implementation modifications may be - present. - - An increase in "C" indicates that implementation modifications only have - been made. - -@defgroup math_vector Math / Vector Operations -@details Commonly used vector & math functions - -@defgroup image_processing Image processing -@details Image filtering, convolution and scaling operations - -@defgroup image_transform Image transformation -@details Warp perspective, affine transformations - -@defgroup feature_detection Feature detection -@details Fast corner detection, harris corner detection, canny edge detection, etc. - -@defgroup object_detection Object detection -@details Object detection functions such as NCC template match, etc. - -@defgroup 3D_reconstruction 3D reconstruction -@details Homography, pose evaluation functions - -@defgroup color_conversion Color conversion -@details Commonly used formats supported: e.g., YUV, RGB, YCrCb, etc. - -@defgroup clustering_and_search Clustering and search -@details K clusters best fitting of a set of input points - -@defgroup Motion_and_Object_Tracking Motion and object tracking -@details Supports and tracking functions - -@defgroup Structural_Analysis_and_Drawing Shape and drawing -@details Contour and polygon drawing functions - -@defgroup mem_management Memory Management -@details Functions to allocate and deallocate memory for use with fastCV. - -@defgroup misc Miscellaneous -@details Support functions - -**/ - -//============================================================================== -// Defines -//============================================================================== - -#define FASTCV_VERSION 122 - -#ifdef __GNUC__ - /// Macro to align memory at 4-bytes (32-bits) for GNU-based compilers. - #define FASTCV_ALIGN32( VAR ) (VAR) __attribute__ ((aligned(4))) - /// Macro to align memory at 8-bytes (64-bits) for GNU-based compilers. - #define FASTCV_ALIGN64( VAR ) (VAR) __attribute__ ((aligned(8))) - /// Macro to align memory at 16-bytes (128-bits) for GNU-based compilers. - #define FASTCV_ALIGN128( VAR ) (VAR) __attribute__ ((aligned(16))) - #ifdef BUILDING_SO - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __attribute__ ((visibility ("default"))) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#else - /// Macro to align memory at 4-bytes (32-bits) for MSVC compiler. - #define FASTCV_ALIGN32( VAR ) __declspec(align(4)) (VAR) - /// Macro to align memory at 8-bytes (64-bits) for MSVC compiler. - #define FASTCV_ALIGN64( VAR ) __declspec(align(8)) (VAR) - /// Macro to align memory at 16-bytes (128-bits) for MSVC compiler. - #define FASTCV_ALIGN128( VAR ) __declspec(align(16)) (VAR) - #ifdef BUILDING_DLL - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __declspec(dllexport) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#endif - -//============================================================================== -// Included modules -//============================================================================== - -#include - -#ifndef FASTCV_STDINT -#define FASTCV_STDINT - #ifdef _MSC_VER - - #if _MSC_VER <= 1500 - // stdint.h support for VS2008 and older - #include "stdint_.h" - #else - #include - #endif - - typedef float float32_t; - typedef double float64_t; - - #else - - #ifdef __ARM_NEON__ - #include - #else - #include - typedef float float32_t; - typedef double float64_t; - #endif - - #endif -#endif - -//============================================================================== -// Declarations -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines operational mode of interface to allow the end developer to -/// dictate how the target optimized implementation should behave. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Target-optimized implementation uses lowest power consuming - /// implementation. - FASTCV_OP_LOW_POWER = 0, - - /// Target-optimized implementation uses higheset performance implementation. - FASTCV_OP_PERFORMANCE = 1, - - /// Target-optimized implementation offloads as much of the CPU as possible. - FASTCV_OP_CPU_OFFLOAD = 2, - - /// Values >= 0x80000000 are reserved - FASTCV_OP_RESERVED = 0x80000000 - -} fcvOperationMode; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a structure to contain points correspondence data. -//------------------------------------------------------------------------------ -typedef struct -{ - /// Tuples of 3 values: xFrom,yFrom,zFrom. Float array which this points to - /// must be greater than or equal to 3 * numCorrespondences. - const float32_t* from; - /*~ FIELD fcvCorrespondences.from - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.fromStride ? fcvCorrespondences.fromStride : 3) ) */ - - /// Tuples of 2 values: xTo,yTo. Float array which this points to - /// must be greater than or equal to 2 * numCorrespondences. - const float32_t* to; - /*~ FIELD fcvCorrespondences.to - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.toStride ? fcvCorrespondences.toStride : 2) ) */ - - /// Distance in bytes between two coordinates in the from array. - /// If this parameter is set to 2 or 3, a dense array is assume (stride will - /// be sizeof(float) times 2 or 3). The minimum value of fromStride - /// should be 2. - uint32_t fromStride; - - /// Distance in bytes between two coordinates in the to array. - /// If this parameter is set to 2, a dense array is assume (stride will - /// be 2 * sizeof(float)). The minimum value of toStride - /// should be 2. - uint32_t toStride; - - /// Number of points in points correspondences. - uint32_t numCorrespondences; - - /// Array of inlier indices for corrs array. Processing will only occur on - /// the indices supplied in this array. Array which this points to must be - /// at least numIndices long. - const uint16_t* indices; - /*~ FIELD fcvCorrespondences.indices VARRAY LENGTH (fcvCorrespondences.numIndices) */ - - /// Length of indices array. - uint32_t numIndices; -} fcvCorrespondences; - - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; -} fcvPyramidLevel ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure describing node of a tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodef32 -{ - /// the split value at the node - float32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodef32; - -// ----------------------------------------------------------------------------- -/// @brief -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchf32 -{ - /// square of minimal distance from query for all nodes below - float32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchf32; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8f32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const float32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indice of root nodes of trees - int32_t* trees; - - /// array of nodes of all trees - fcvKDTreeNodef32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchf32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8f32; - - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure describing node of tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodes32 -{ - /// the split value at the node - int32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodes32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchs32 -{ - /// square of minimal distance from query for all nodes below - int32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchs32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8s32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const int32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indices of root nodes of all trees - int32_t* trees; - - /// number of trees used - int32_t numTrees; - - /// array of nodes of all trees - fcvKDTreeNodes32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchs32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8s32; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of rectangle -//------------------------------------------------------------------------------ -typedef struct -{ - ///x-coordinate of the top-left corner - int32_t x; - ///y-coordinate of the top-left corner - int32_t y; - ///width of the rectangle - uint32_t width; - ///height of the rectangle - uint32_t height; -} fcvRectangleInt; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of termination criteria -//------------------------------------------------------------------------------ -typedef struct -{ - /// Maxmimum number of iteration - int32_t max_iter; - /// - float32_t epsilon; -}fcvTermCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of 2D box used for tracking -//------------------------------------------------------------------------------ -typedef struct -{ - // Center of the box - ///x-coordinate of the 2D point - int32_t x; - ///y-coordinate of the 2D point - int32_t y; - // The box size - int32_t columns; - int32_t rows; - // The orientation of the principal axis - int32_t orientation; -}fcvBox2D; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of code word -//------------------------------------------------------------------------------ -typedef struct fcvBGCodeWord -{ - /// Pointer to next codebook element - struct fcvBGCodeWord* next; - - /// Last update time - int32_t tLastUpdate; - - /// Longest period of inactivity - int32_t stale; - /// Min value of pixel for each channel - uint8_t min0, min1, min2; - - /// Max value of pixel for each channel - uint8_t max0, max1, max2; - - /// Min value of learning boundary for each channel - uint8_t learnLow0, learnLow1, learnLow2; - - /// Max value of learning boundary for each channel - uint8_t learnHigh0, learnHigh1, learnHigh2; -} fcvBGCodeWord; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for circle -//------------------------------------------------------------------------------ -typedef struct fcvCircle -{ - int32_t x; - int32_t y; - int32_t radius; -} fcvCircle; - -//============================================================================== -// UTILITY FUNCTIONS -//============================================================================== - -#ifdef __cplusplus -extern "C" -{ -#endif - -//------------------------------------------------------------------------------ -/// @brief -/// Retrieves version of FastCV library. -/// -/// @param version -/// Pointer to location to put string. -/// -/// @param versionLength -/// Length of storage for version string. -/// -/// @ingroup misc -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGetVersion( char* version, - unsigned int versionLength ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Selects HW units for all routines at run-time. Can be called anytime to -/// update choice. -/// -/// @param mode -/// See enum for details. -/// -/// @return -/// 0 if successful. -/// 999 if minmum HW requirement not met. -/// other #'s if unsuccessful. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvSetOperationMode( fcvOperationMode mode ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Clean up FastCV resources. Must be called before the program exits. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCleanUp( void ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// @param pyr -/// Pointer to an array of qcvaPyramidLevel -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate( fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete( fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates aligned memory. -/// -/// @param nBytes -/// Number of bytes. -/// -/// @param byteAlignment -/// Alignment specified in bytes (e.g., 16 = 128-bit alignment). -/// \n\b WARNING: must be < 255 bytes -/// -/// @return -/// SUCCESS: pointer to aligned memory -/// FAILURE: 0 -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void* -fcvMemAlloc( unsigned int nBytes, - unsigned int byteAlignment ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Frees memory allocated by fcvMemAlloc(). -/// -/// @param ptr -/// Pointer to memory. -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvMemFree( void* ptr ); - -#ifdef __cplusplus -}//extern "C" -#endif -//End - Utility functions - - -//============================================================================== -// FUNCTIONS -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterMedian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterMedian3x3u8_v2 will be renamed to fcvFilterMedian3x3u8 -/// and the signature of fcvFilterMedian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dstImg ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian3x3u8_v2 will be renamed to fcvFilterGaussian3x3u8 -/// and the signature of fcvFilterGaussian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Destination buffer size is srcWidth*srcHeight. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5u8_v2 will be renamed to fcvFilterGaussian5x5u8 -/// and the signature of fcvFilterGaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5u8, -/// \a fcvFilterGaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian11x11u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian11x11u8_v2 will be renamed to fcvFilterGaussian11x11u8 -/// and the signature of fcvFilterGaussian11x11u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian11x11u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian11x11u8, -/// \a fcvFilterGaussian11x11u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian11x11u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian11x11u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved) to RGB 8888. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorYCrCb420PseudoPlanarToRGB8888u8. In the 2.0.0 release, -/// the signature of fcvColorYUV420toRGB8888u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R is at LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved CrCb) to RGB 888. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV picture. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcYStride -/// Stride (in bytes) of input image Y component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2). -/// \n\b WARNING: Must be multiple of 8 (8 * 1-byte values). -/// -/// @param srcCStride -/// Stride (in bytes) of input image Chroma component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2) -/// \n\b WARNING: Must be multiple of 4 (4 * 1-byte values). -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R in LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output RGB image (i.e., number of bytes between column 0 of -/// row 1 and column 0 of row 2) -/// \n\b WARNING: Must be multiple of 32 (8 * 4-byte values). -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCbCr) 4:2:0 PesudoPlanar (Interleaved CbCr) to RGB 565. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CbCr plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cb0 Cr0 Cb1 Cr1 ... -/// -/// @param dst -/// 16-bit image of output RGB 565 values. R in LSBs. -/// 2 pixels are packed into one 32-bit output -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 4 -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB565u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V1 (YCbCr 4:4:4 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit image of input values. Stored as YCbCr H1V1 planar format in 8x8 blocks for Y,Cb,Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V2 (YCbCr 4:2:0 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H2V2 planar format in 16x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V2toRGB888u8( const uint8_t* __restrict ysrc, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V1 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit input values. Stored as YCbCr H2V1 planar format in 16x8 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V2 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H1V2 planar format in 8x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V2toRGB888u8( const uint8_t* __restrict ysrc, - - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorRGB888toYCrCbu8_v2(). In the 2.0.0 release, -/// fcvColorRGB888toYCrCbu8_v2 will be renamed to fcvColorRGB888toYCrCbu8 -/// and the signature of fcvColorRGB888toYCrCbu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb 4:4:4 (Full interleaved, similar to -/// 3-channel RGB). -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvColorRGB888toYCrCbu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvColorRGB888toYCrCbu8, -/// \a fcvColorRGB888toYCrCbu8_v2 will be removed, and the current signature -/// for \a fcvColorRGB888toYCrCbu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvColorRGB888toYCrCbu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Create a 36-dimension gradient based descriptor on 17x17 patch. -/// -/// @details -/// -/// @param patch -/// Input luminance data for 17x17 patch to describe. -/// -/// @param descriptorChar -/// Output descriptor vector. 36 x 8-bit vector. Normalized and quantized to range [-127, 127] -/// -/// @param descriptorNormSq -/// Output squared norm (L2 norm) of the descriptor vector. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector A. -/// -/// @param b -/// Vector B. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct36x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct36x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct64x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct128x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct128x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with several (n) 8x8 squares -/// along a line of pixels in an image. -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the source image. -/// -/// @param imgH -/// Height in pixels of the source image. -/// -/// @param nX -/// X location on image of starting search pixel. -/// -/// @param nY -/// Y location on image of starting search pixel. -/// -/// @param nNum -/// Number of pixels (in X direction) on image to sweep. -/// -/// @param dotProducts -/// Output dot product values of nNum pixels. -/// \n\b WARNING: array size must be a multiple of 4 (e.g., 4, 8, 12, ...) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct8x8u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int nX, - int nY, - unsigned int nNum, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with 8x8 squares in 11x12 -/// rectangle around the center search pixel (iX,iY). -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the image. -/// -/// @param imgH -/// Height in pixels of the image. -/// -/// @param iX -/// X location on image of the center of the search window. -/// -/// @param iY -/// Y location on image of the center of the search window. -/// -/// @param dotProducts -/// Output 11x12 dot product values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct11x12u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int iX, - int iY, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterSobel3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterSobel3x3u8_v2 will be renamed to fcvFilterSobel3x3u8 -/// and the signature of fcvFilterSobel3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterSobel3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterSobel3x3u8, -/// \a fcvFilterSobel3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterSobel3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterSobel3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCanny3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterCanny3x3u8_v2 will be renamed to fcvFilterCanny3x3u8 -/// and the signature of fcvFilterCanny3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// is set to 3. This function will output the edge, since its working with a -/// 3x3 window, it leaves one row/col of pixels at the corners -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageDiffu8_v2(). In the 2.0.0 release, -/// fcvImageDiffu8_v2 will be renamed to fcvImageDiffu8 -/// and the signature of fcvImageDiffu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Destination. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageDiffu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageDiffu8, -/// \a fcvImageDiffu8_v2 will be removed, and the current signature -/// for \a fcvImageDiffu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageDiffu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//-------------------------------------------------------------------------- -/// @brief -/// Compute image difference src1-src2 -/// -/// @param src1 -/// Input image1 of int16 type. Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image2, must have same size as src1 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output image, saturated for int16 type. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -////------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by promoting both src1 and src 2 to -/// floating point values and then subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Destination image in float type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. -/// dst = ( src1 >> 1) - ( src2 >> 1). -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Destination image in int8 type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleaveds16_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleaveds16_v2 will be renamed to fcvImageGradientInterleaveds16 -/// and the signature of fcvImageGradientInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientInterleaveds16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleaveds16, -/// \a fcvImageGradientInterleaveds16_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleaveds16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @param gradStride -/// Stride in bytes of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as 4*(srcWidth-2). -/// \n\b WARNING: must be multiple of 16 ( 8 * 2-byte values ), and at least as much as 4*(srcWidth-2) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize MSER. To invoke MSER functionality, 3 functions have to be called: -/// fcvMserInit, fcvMseru8, fcvMserRelease. -/// -/// Heris the typical usage: -/// -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvmseru8 (mserHandle,...); -/// fcvRelease(mserHandle); -/// } -/// -/// -/// @param width Width of the image for which MSER has to be done. -/// @param height Height of the image for which MSER has to be done. -/// @param delta Delta to be used in MSER algorithm (the difference in grayscale -/// values within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// @param minArea Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// @param maxArea Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// @param maxVariation Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// @param minDiversity Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// @param mserHandle Return value: the mserHandle to be used in subsequent calls. -/// -/// @return int 1 if mserInit is successful, if 0, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to release MSER resources. -/// -/// -/// -/// @param mserHandle Handle to be used to free up MSER resources. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserRelease(void *mserHandle); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER. -/// -/// \n\b ATTENTION: The signature of this function will be changed to reduce complexity -/// and memory usage when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// -/// @param mserHandle The MSER Handle returned by init. -/// @param srcPtr Pointer to an image array (unsigned char ) for which MSER has to be done. -/// @param srcWidth Width of the source image. -/// @param srcHeight Height of the source image. -/// @param srcStride Stride of the source image. -/// @param maxContours Maximum contours that will be returned. Must be set to 2x the maximum contours. -/// @param numContours Output, Number of MSER contours in the region. -/// @param numPointsInContour Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// @param pointsArraySize Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// @param pointsArray Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int pointsArraySize, - unsigned int* __restrict pointsArray - ); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER, with additional outputs for each contour. -/// -/// \n\b ATTENTION: The signature of this function will be changed to reduce complexity -/// and memory usage when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// @param mserHandle The MSER Handle returned by init. -/// @param srcPtr Pointer to an image array (unsigned char ) for which MSER has to be done. -/// @param srcWidth Width of the source image. -/// @param srcHeight Height of the source image. -/// @param srcStride Stride of the source image. -/// @param maxContours Maximum contours that will be returned. Need to be set to 2x the maximum contours. -/// Application dependent. OCR usually requires 100-1000 contours -/// Segmentation usually requires 50-100 -/// @param numContours Output, Number of MSER contours in the region. -/// @param numPointsInContour Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// @param pointsArraySize Size of the output points Array. -/// Typical size: (# of pixels in source image)*30 -/// @param pointsArray Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region; -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// @param contourVariation Output, Variation for each contour from previous grey level. -/// This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// @param contourPolarity Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. . This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// @param contourNodeId Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// @param contourNodeCounter Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleavedf32_v2 will be renamed to fcvImageGradientInterleavedf32 -/// and the signature of fcvImageGradientInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleavedf32, -/// \a fcvImageGradientInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: must be multiple of 32 ( 8 * 4-byte values ), and at least as much as 8 * srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanars16_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanars16_v2 will be renamed to fcvImageGradientPlanars16 -/// and the signature of fcvImageGradientPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientPlanars16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanars16, -/// \a fcvImageGradientPlanars16_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanars16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanarf32_v2 will be renamed to fcvImageGradientPlanarf32 -/// and the signature of fcvImageGradientPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanarf32, -/// \a fcvImageGradientPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride of Gradient values ('dx' and 'dy' arrays) measured in bytes. -/// \n\b NOTE: if 0, srcStride is set as 4*srcWidth. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value), and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold ); - -//------------------------------------------------------------------------------ -/// @brief -/// Local Harris Max applies the Harris Corner algorithm on an 11x11 patch -/// within an image to determine if a corner is present. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If srcStride == 0, then will use srcWidth. -/// -/// @param posX -/// Center X coordinate of the search window -/// -/// @param posY -/// Center Y coordinate of the search window -/// -/// @param maxX -/// pointer to the X coordinate identified as a corner -/// -/// @param maxY -/// pointer to the Y coordinate identified as a corner -/// -/// @param maxScore -/// pointer to the Harris score associated with the corner -/// -/// @return -/// 0 if no corner is found (maxX, maxY, and maxScore are invalid) -/// or if posX and/or posY position the patch outside of the range of -/// the source image. -/// 1 if a corner is found (maxX, maxY, and maxScore are valid) -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API unsigned int -fcvLocalHarrisMaxu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Respose" of a pixel for it to be -/// regarded as a corner. -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisInMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Computes affine trans. for a given set of corresponding features points -/// using a linear least square colver based on Cholkesky decomposition. -/// -/// @param corrs -/// Correspondence data struct containing coords of points in two frames -/// -/// @param affine -/// 3 x 3 affine matrix (computed best fit affine transformation) -/// -/// @ingroup 3D_reconstruction -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified affine transformation against provided points -/// correspondences. Checks which correspondence members have a projection -/// error that is smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param affine -/// Affine matrix representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky homography fitting on specified points correspondences. -/// -/// @details -/// Output precision is within 3e-3 -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// 3x3 floating point matrix formatted as @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky pose fitting on specified points correspondences. -/// Takes a pose and uses the correspondences to refine it using iterative -/// Gauss-Newton optimization. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param minIterations -/// Minimum number of iterations to refine. -/// -/// @param maxIterations -/// Maximum number of iterations to refine. -/// -/// @param stopCriteria -/// Improvement threshold, iterations stop if improvement is less than this -/// value. -/// -/// @param initpose -/// Pose representing initial pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param refinedpose -/// Pose representing refined pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// Final reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update and compute the differential pose based on the specified points correspondences -/// This function and fcvGeomPoseOptimizeGNf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing differential pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update the pose based on the specified points correspondences -/// using Gauss-Newton optimization. This function and fcvGeomPoseEvaluateErrorf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseOptimizeGNf32( const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the reprojection error based on the input pose. -/// This function and fcvGeomPoseOptimizef32 can be used iteratively -/// to perform poseRefine (GN or LM).. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @return -/// Reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseEvaluateErrorf32( const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Checks which members have a projection error that is smaller than the -/// given one. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing relationship between ptTo and ptFrom -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param maxSquErr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numInliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Estimates a 6DOF pose -/// \n\b NOTE: Given the coordinates of three 3D points (in world reference frame), -/// and their corresponding perspective projections in an image, -/// this algorithm determines the position and orientation of the camera in -/// the world reference frame. The function provides up to four solutions -/// that can be disambiguated using a fourth point. -/// When used in conjunction with RANSAC, this function can perform efficient outlier rejection. -/// Two degenerate cases should be avoided when using this function: -/// - Indeterminate configuration: -/// When the three points are collinear in space, there will be a family of poses mapping the -/// three points to the same image points. -/// - Unstable configuration: -/// The camera center is located on a circular cylinder passing through the three points and -/// the camera optical axis is perpendicular to the plane derived by the three points. -/// With this configuration, a small change in the position of the three points will -/// result in a large change of the estimated pose.. -/// -/// @param corrs -/// 2D-3D correspondence points -/// -/// @param pose -/// computed pose (numPoses * 12 data) -/// -/// @param numPoses (max = 4) -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorr3x3s8_v2(). In the 2.0.0 release, -/// fcvFilterCorr3x3s8_v2 will be renamed to fcvFilterCorr3x3s8 -/// and the signature of fcvFilterCorr3x3s8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param dst -/// Output convolution. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorr3x3s8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorr3x3s8, -/// \a fcvFilterCorr3x3s8_v2 will be removed, and the current signature -/// for \a fcvFilterCorr3x3s8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorr3x3s8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output convolution. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. Border values are ignored in this function. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 9x9 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep9x9s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep9x9s16_v2 will be renamed to fcvFilterCorrSep9x9s16 -/// and the signature of fcvFilterCorrSep9x9s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel in Q15. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmp -/// Temporary image buffer used internally. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep9x9s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmp, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 9x9 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep9x9s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep9x9s16, -/// \a fcvFilterCorrSep9x9s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep9x9s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep9x9s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Size = width * heigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 11x11 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep11x11s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep11x11s16_v2 will be renamed to fcvFilterCorrSep11x11s16 -/// and the signature of fcvFilterCorrSep11x11s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be >=12 elements with kernel[11]=0 -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Normalized to Q1.15 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep11x11s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 11x11 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep11x11s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep11x11s16, -/// \a fcvFilterCorrSep11x11s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep11x11s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep11x11s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 13x13 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep13x13s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep13x13s16_v2 will be renamed to fcvFilterCorrSep13x13s16 -/// and the signature of fcvFilterCorrSep13x13s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep13x13s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 13x13 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep13x13s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep13x13s16, -/// \a fcvFilterCorrSep13x13s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep13x13s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep13x13s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 15x15 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep15x15s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep15x15s16_v2 will be renamed to fcvFilterCorrSep15x15s16 -/// and the signature of fcvFilterCorrSep15x15s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep15x15s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 15x15 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep15x15s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep15x15s16, -/// \a fcvFilterCorrSep15x15s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep15x15s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep15x15s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 17x17 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep17x17s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep17x17s16_v2 will be renamed to fcvFilterCorrSep17x17s16 -/// and the signature of fcvFilterCorrSep17x17s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation.. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep17x17s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// 17x17 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep17x17s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep17x17s16, -/// \a fcvFilterCorrSep17x17s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep17x17s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep17x17s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: must be multiple of 8. -/// -/// @param xBegin -/// x coordinate of of top left of rectangle -/// -/// @param yBegin -/// y coordinate of of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a histogram of intensities for a rectangular region of a grayscale -/// image. Bins each pixel into a histogram of size 256, depending on the -/// intensity of the pixel (in the range 0 to 255). -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: must be multiple of 8. -/// -/// @param xBegin -/// x coordinate of of top left of rectangle -/// -/// @param yBegin -/// y coordinate of of top left of rectangle -/// -/// @param recWidth -/// Width of rectangular region -/// -/// @param recHeight -/// Height of rectangular region -/// -/// @param histogram -/// Array of size 256 for storing the histogram -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit image and adds an -/// unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatchu8_v2(). In the 2.0.0 release, -/// fcvIntegratePatchu8_v2 will be renamed to fcvIntegratePatchu8 -/// and the signature of fcvIntegratePatchu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatchu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatchu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatchu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch12x12u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch12x12u8_v2 will be renamed to fcvIntegratePatch12x12u8 -/// and the signature of fcvIntegratePatch12x12u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatch12x12u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch12x12u8, -/// \a fcvIntegratePatch12x12u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch12x12u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch12x12u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch18x18u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch18x18u8_v2 will be renamed to fcvIntegratePatch18x18u8 -/// and the signature of fcvIntegratePatch18x18u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatch18x18u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch18x18u8, -/// \a fcvIntegratePatch18x18u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch18x18u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch18x18u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Integrates one line of an image or any portion of an image that is -/// contiguous in memory. -/// -/// @param src -/// Input image. Size of buffer is srcWidth bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Number of pixels. -/// \n NOTE: bit width enforces numPxls < 2^16 -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegrateImageLineu8( const uint8_t* __restrict src, - uint16_t srcWidth, - uint32_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integrates 64 contiguous pixels of an image. -/// -/// @param src -/// Input image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageLine64u8( const uint8_t* __restrict src, - uint16_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// compute approximate mean and variance for the range of NFT4 float -/// descriptors where descriptor elements along dimension are treated -/// as random vars -/// -/// @param src -/// contiguous block of descriptors of dimension 36 -/// -/// @param first -/// index of the first descriptor in range array vind for computing mean and var -/// -/// @param last -/// index of the last descriptor in range array vind for computing mean and range -/// -/// @param vind -/// array of randomized indexes of descriptors -/// -/// @param means -/// buffer for approximate means, must be 36 long -/// -/// @param vars -/// buffer for approximate variances, must be 36 long -/// -/// @param temp -/// bufffer, must be 46 long -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @remark -/// If descriptor range is > 100 then only -/// 100 samples are drawn from the range to compute -/// approximate means and variances. -/// -/// Variances computed here do not have to be true variances because their -/// values do not matter in kdtrees. The only thing that matters is that -/// the ordering relation of variances is preserved -/// -/// -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvDescriptorSampledMeanAndVar36f32( const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnCircle8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnCircle8x8u8_v2 will be renamed to fcvNCCPatchOnCircle8x8u8 -/// and the signature of fcvNCCPatchOnCircle8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvNCCPatchOnCircle8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnCircle8x8u8, -/// \a fcvNCCPatchOnCircle8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnCircle8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnCircle8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnSquare8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnSquare8x8u8_v2 will be renamed to fcvNCCPatchOnSquare8x8u8 -/// and the signature of fcvNCCPatchOnSquare8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvNCCPatchOnSquare8x8u8 with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnSquare8x8u8, -/// \a fcvNCCPatchOnSquare8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnSquare8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnSquare8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvSumOfAbsoluteDiffs8x8u8_v2(). In the 2.0.0 release, -/// fcvSumOfAbsoluteDiffs8x8u8_v2 will be renamed to fcvSumOfAbsoluteDiffs8x8u8 -/// and the signature of fcvSumOfAbsoluteDiffs8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// The dst buffer shall be width X height bytes in length. -/// Output of SAD(A,B). dst[4][4] correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvSumOfAbsoluteDiffs8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvSumOfAbsoluteDiffs8x8u8, -/// \a fcvSumOfAbsoluteDiffs8x8u8_v2 will be removed, and the current signature -/// for \a fcvSumOfAbsoluteDiffs8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvSumOfAbsoluteDiffs8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param patchStride -/// Stride of the 8x8 template buffer -/// -/// @param dstStride -/// Stride of the patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param dst -/// The dst buffer shall be at least ( width x height ) values in length. -/// Output of SAD(A,B). dst[4][4]correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2u8_v2 will be renamed to fcvScaleDownBy2u8 -/// and the signature of fcvScaleDownBy2u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/4 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy2u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2u8, -/// \a fcvScaleDownBy2u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/2 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2Gaussian5x5u8_v2 will be renamed to fcvScaleDownBy2Gaussian5x5u8 -/// and the signature of fcvScaleDownBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2Gaussian5x5u8, -/// \a fcvScaleDownBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy4u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy4u8_v2 will be renamed to fcvScaleDownBy4u8 -/// and the signature of fcvScaleDownBy4u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/16 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy4u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy4u8_v2, -/// \a fcvScaleDownBy4u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy4u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy4u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/4 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/4. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/4 if not 0. -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to 2/3 width and height by averaging 3x3 pixels -/// into one.. -/// -/// @details -/// A 3x3 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// Memory must be pre-allocated at least srcWidth * srcHeight * 2 / 3 -/// dstWidth = srcWidth/3*2 -/// dstHeight = srcHeight/3*2 -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return 0 if successful -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// @details -/// Uses Nearest Neighbor method -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return 0 if successful -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownu8_v2(). In the 2.0.0 release, -/// fcvScaleDownu8_v2 will be renamed to fcvScaleDownu8 -/// and the signature of fcvScaleDownu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension. -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownu8, -/// \a fcvScaleDownu8_v2 will be removed, and the current signature -/// for \a fcvScaleDownu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleUpBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleUpBy2Gaussian5x5u8_v2 will be renamed to fcvScaleUpBy2Gaussian5x5u8 -/// and the signature of fcvScaleUpBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*width) x (2*height). -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleUpBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleUpBy2Gaussian5x5u8, -/// \a fcvScaleUpBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleUpBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleUpBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*dstStride) x (2*srcHeight). -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Translate to float and normalize 36 8-bit elements -/// -/// @param src -/// Pointer to the first input vector -/// -/// @param invLen -/// Pointer to inverse length of the first input vector -/// located right after each 36 element vector -/// -/// @param numVecs -/// Number of vectors to translate -/// -/// @param reqNorm -/// Required norm -/// -/// @param srcStride -/// Step in bytes to data of the next vector -/// Each vector has 36 8-bit elements and 1 float invLen -/// -/// @param dst -/// Pointer to contiguous block for output vectors -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param stopBuild -/// Allows other threads to break this function in the middle of processing. -/// When set to 1, the function will exit on the next iteration. -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @ingroup math_vector -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against 4 others. -/// -/// @details -/// SSD of one vector (a) against 4 others (b0,b1,b2,b3) using their given -/// inverse lengths for normalization. -/// \n\n SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenB -/// Inverse of vectors b0...b3 = 1/|b0|,... 1/|b3| -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param distances -/// Output of the 4 results { SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: array must be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict a, - float invLenA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - const float* __restrict invLenB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other 36-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict a, - float invLenA, - const int8_t* const * __restrict b, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sorting of 8 float numbers -/// -/// @details -/// Perform sorting of 8 scores in ascending order (output of SumOfSquaredDiffs) -/// -/// @param inScores -/// Input 8 element float array -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param outScores -/// Output is 8 element sorted float array -/// \n\b WARNING: array must be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSort8Scoresf32( float* __restrict inScores, float* __restrict outScores ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdu8_v2 will be renamed to fcvFilterThresholdu8 -/// and the signature of fcvFilterThresholdu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterDilate3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterDilate3x3u8_v2 will be renamed to fcvFilterDilate3x3u8 -/// and the signature of fcvFilterDilate3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterDilate3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterErode3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterErode3x3u8_v2 will be renamed to fcvFilterErode3x3u8 -/// and the signature of fcvFilterErode3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterErode3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffine8x8u8_v2(). In the 2.0.0 release, -/// fcvTransformAffine8x8u8_v2 will be renamed to fcvTransformAffine8x8u8 -/// and the signature of fcvTransformAffine8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param nPatch -/// Transformed patch. -/// -/// -/// @returns 0 if the transformation is valid -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvTransformAffine8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffine8x8u8, -/// \a fcvTransformAffine8x8u8_v2 will be removed, and the current signature -/// for \a fcvTransformAffine8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffine8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as 8. -/// \n\b WARNING: must be at least as much as 8 if not 0. -/// -/// -/// @returns 0 if the transformation is valid -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcvWarpPerspectiveu8_v2 will be renamed to fcvWarpPerspectiveu8 -/// and the signature of fcvWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data must be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data must be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection matrix using -/// bilinear interpolation. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcv3ChannelWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcv3ChannelWarpPerspectiveu8_v2 will be renamed to fcv3ChannelWarpPerspectiveu8 -/// and the signature of fcv3ChannelWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight*3 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight*3 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection -/// matrix using bilinear interpolation. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcv3ChannelWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcv3ChannelWarpPerspectiveu8, -/// \a fcv3ChannelWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcv3ChannelWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcv3ChannelWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth*3. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*3 if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth*3. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth*3 if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// \n\b WARNING: must be > numPoints * dim. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension dim. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surface of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension 36. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * 36. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surphace of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s16_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s16_v2 will be renamed to fcvFilterGaussian5x5s16 -/// and the signature of fcvFilterGaussian5x5s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// \n\b NOTE: Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s16, -/// \a fcvFilterGaussian5x5s16_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, edstStrid is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s32_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s32_v2 will be renamed to fcvFilterGaussian5x5s32 -/// and the signature of fcvFilterGaussian5x5s32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int32_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5s32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s32, -/// \a fcvFilterGaussian5x5s32_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s32 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffineu8_v2(). In the 2.0.0 release, -/// fcvTransformAffineu8_v2 will be renamed to fcvTransformAffineu8 -/// and the signature of fcvTransformAffineu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @returns 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvTransformAffineu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffineu8, -/// \a fcvTransformAffineu8_v2 will be removed, and the current signature -/// for \a fcvTransformAffineu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffineu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, patchStride is set as patchWidth. -/// \n\b WARNING: must be at least as much as patchWidth if not 0. -/// -/// @returns 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts a 17x17 rotation corrected patch from a 25x25 image. -/// -/// @param src -/// 25x25 input image in continuous memory. -/// -/// @param dst -/// 17x17 output patch. -/// -/// @param orientation -/// Rotation angle of patch relative to src. -/// \n 10-bit fixed-point angle around unit circle. -/// \n NOTE: 0 = 0 degrees and 1024 = 360 degrees. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCopyRotated17x17u8( const uint8_t* __restrict src, - uint8_t* __restrict dst, - int orientation ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied vector. -/// -/// @param src -/// Pointer to vector to count bits that are 1. -/// -/// @param srcLength -/// Length of the vector to count bits. Assumed that the remainder of bits modulo 8 -/// will be set to 0 a priori. -/// -/// @returns total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu8( const uint8_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied 32-byte vector. -/// -/// @param src -/// Pointer to 32-byte vector(s) to count bits that are 1. -/// -/// @returns total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to count bits. -/// -/// @param b -/// Pointer to 32-byte vector to count bits. -/// -/// @param c -/// Pointer to 32-byte vector to count bits. -/// -/// @param d -/// Pointer to 32-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount32x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 64-byte vector. -/// -/// @param src -/// Pointer to 64-byte vector(s) to count bits. -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to count bits. -/// -/// @param b -/// Pointer to 64-byte vector to count bits. -/// -/// @param c -/// Pointer to 64-byte vector to count bits. -/// -/// @param d -/// Pointer to 64-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied vector of unsigned intergers. -/// -/// @param src -/// Pointer to vector(s) to count bits. -/// -/// @param srcLength -/// Number of elements in vector -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu32( const uint32_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied arbitrary length -/// vectors. -/// -/// @param a -/// Pointer to vector to compute distance. -/// -/// @param b -/// Pointer to vector to compute distance. -/// -/// @param abLength -/// Length in bits of each of the vectors. Assumed that the remainder of -/// bits modulo 8 will be set to 0 a priori. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte -/// vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// 8-bit image -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// \n\b NOTE: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// Grayscale image with one byte per pixel -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvCornerFast9Scoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9Scoreu8, -/// \a fcvCornerFast9Scoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9Scoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9Scoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvCornerFast9InMaskScoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9InMaskScoreu8, -/// \a fcvCornerFast9InMaskScoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9InMaskScoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9InMaskScoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @return -/// void. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @return -/// void. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. Bitwidth optimized implementation -/// -/// \n\b ATTENTION: The signature of this function will be changed to remove -/// unused parameters when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int srcWidth, - int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. -/// -/// \n\b ATTENTION: This function will be removed when the 2.0.0 release of this library -/// is made. Until 2.0.0, the developer should use this implementation with the expectation of -/// using \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// \n\b NOTE: Possible status are : -/// \n TRACKED 1 -/// \n NOT_FOUND -1 -/// \n SMALL_DET -2 -/// \n MAX_ITERATIONS -3 -/// \n OUT_OF_BOUNDS -4 -/// \n LARGE_RESIDUE -5 -/// \n SMALL_EIGVAL -6 -/// \n INVALID -99 -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE : Suggest that be set to between 0.1 and 0.2, say 0.15 -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of float32 arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param srcHeight -/// Height of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32( const float* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of uint8_t arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^(numLevels-1) -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: must be a multiple of 2^(numLevels-1) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of int16_t from an image pyramid of uint8_t -/// -/// @param imgPyr -/// Input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of float32 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatef32( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of integer8 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei8( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16_v2 and -/// fcvImageGradientSobelPlanars16_v3 as it appears now, will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as (srcWidth*sizeof(int16_t)). -/// \n\b WARNING: must be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes central differences on 3x3 neighborhood and then convolves -/// the result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanars16_v2() with a change in behavior: no normalization -/// at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars16, -/// \a fcvImageGradientSobelPlanars16_v2 and fcvImageGradientSobelPlanars16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelPlanars16 -/// and fcvImageGradientSobelPlanars16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 and -/// fcvImageGradientSobelInterleaveds16_v2 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(int16_t). -/// \n\b WARNING: must be multiple of 8, and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// \n Compared to the original and v2 functions, this v3 functions does not normalize -/// \n the gradients (divide by 8). It just returns the actual dx, dy values. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelInterleaveds16_v2() with a change in behavior: no -/// normalization at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleaveds16, -/// \a fcvImageGradientSobelInterleaveds16_v2 and fcvImageGradientSobelInterleaveds16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelInterleaveds16 -/// and fcvImageGradientSobelInterleaveds16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the interleaved gradients array. If left at 0 gradStride is default to 4 * (srcWidth-2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleavedf32_v2 will be renamed to fcvImageGradientSobelInterleavedf32 -/// and the signature of fcvImageGradientSobelInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 floats in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleavedf32, -/// \a fcvImageGradientSobelInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: must be multiple of 8, and at least as much as (srcWidth-2)*2*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars8_v2 will be renamed to fcvImageGradientSobelPlanars8 -/// and the signature of fcvImageGradientSobelPlanars8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanars8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars8, -/// \a fcvImageGradientSobelPlanars8_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanars8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32_v2 will be renamed to fcvImageGradientSobelPlanarf32 -/// and the signature of fcvImageGradientSobelPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32, -/// \a fcvImageGradientSobelPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as 4*srcWidth. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value),and at least as much as srcWidth*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32f32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32f32_v2 will be renamed to fcvImageGradientSobelPlanarf32f32 -/// and the signature of fcvImageGradientSobelPlanarf32f32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels (not bytes) between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanarf32f32()() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32f32(), -/// \a fcvImageGradientSobelPlanarf32f32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32f32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32f32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride (in bytes) of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*4. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value). -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, dxyStride is set as srcWidth*4. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Block Optical Flow 16x16 - Tracks all 16x16 blocks in the Region of Interest -/// (ROI) from Source-1 to Source-2. Generates Motion Vectors for blocks where -/// motion is detected. -/// -/// @details -/// -/// @param[in] src1 -/// Pointer to source image where the original blocks are present. -/// \n Dimensions should be same as \a src2, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: must be 128-bit aligned. Buffer size is srcStride*srcHeight bytes. -/// -/// @param[in] src2 -/// Pointer to second source image where motion vectors for blocks in \a img1 -/// are to be located. -/// \n Dimensions should be same as \a src1, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param[in] srcWidth -/// Width of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcHeight -/// Height of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcStride -/// Stride of source images pointed by \a src1 and \a src2. -/// -/// @param[in] roiLeft -/// Left co-ordinate (x0) of Region-of-Interest (ROI). -/// -/// @param[in] roiTop -/// Top co-orgdinate (y0) of Region-of-Interest (ROI). -/// -/// @param[in] roiRight -/// Right co-ordinate (x1) of Region-of-Interest (ROI). -/// -/// @param[in] roiBottom -/// Bottom co-ordinate (y1) of Region-of-Interest (ROI). -/// -/// @param[in] shiftSize -/// Distance in number of pixels (both horizontally and vertically) between -/// consecutive blocks for which motion vector is searched. -/// \n\b NOTE: Larger the value, less number of blocks will be tracked, and -/// hence the function will run faster. -/// -/// @param[in] searchWidth -/// Numbers of pixels horizontally on left and right of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchHeight -/// Numbers of pixels vertically on top and bottom of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchStep -/// Distance in number of pixels between consecutive search targets within -/// the above search window. -/// \n\b NOTE: Larger the value, more coarse the search will be and thus -/// will make the fucntion run faster. Smaller the value, more dense the -/// search will be, making the funciton run slower. -/// -/// @param[in] usePrevious -/// Indicates if the function should use the existing motion vectors in -/// locX and locY as the starting point for motion vector search. -/// \n\b NOTE: This parameter is redundant at the moment. -/// -/// @param[out] numMv -/// Pointer to variable that will store the count of Motion Vectors -/// generated by the function. -/// \n\b WARNING: This pointer should be Non-NULL. -/// -/// @param[out] locX -/// Pointer to an array which will store the X co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] locY -/// Pointer to an array which will store the Y co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvX -/// Pointer to an array which will store the X co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvX[i]-\a locX[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvY -/// Pointer to an array which will store the Y co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvY[i]-\a locY[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @return -/// 0 - Success, Failure otherwise. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 8-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 8-bit source image 1. -/// -/// @param src2 -/// Pointer to the 8-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOru8(const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 32-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 32-bit source image 1. -/// -/// @param src2 -/// Pointer to the 32-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOrs32(const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to grayscale -/// -/// @details -/// -/// @param src -/// Source 8-bit image, BGR888 format (R is lowest byte for the pixel) -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Destination 8-bit gray-scale image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcStride as default -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API void -fcvColorRGB888ToGrayu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integral of the image tilted by 45 degrees -/// -/// @details -/// Calculates the tilted integral image of an input image -/// and adds an zero-filled border on top. Left border not zero. -/// dst[i,j]=sum (src[m,n]), where n according to -/// descDBTargetId. -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param descDBOldIdx -/// A pointer to uint32_t [numDescDB], -/// which stores the old index of the desc before sorting -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvLinearSearchPrepare8x36s8( uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict descDBOldIdx, - uint32_t numDescDB ); - -//--------------------------------------------------------------------------- -/// @brief -/// Perform linear search of descriptor in a database -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @param srcDesc -/// A pointer to int8_t [numSrcDesc][36], -/// which stores descriptors. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param srcDescInvLenQ38 -/// A pointer to uint32_t [numSrcDec], -/// which stores the inverse length of srcDesc. -/// The value is in Q38 format. -/// -/// @param srcDescIdx -/// A pointer to the dbLUT data -/// -/// @param numSrcDesc -/// Number of source descriptor -/// -/// @param targetsToIgnore -/// A list of target IDs to be ignored -/// -/// @param numTargetsToIgnore -/// Number of targets to be ignored -/// -/// @param maxDistanceQ31 -/// Maximum distance for correspondences. -/// In Q31 format. -/// -/// @param correspondenceDBIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of featuresDB -/// as a part of correspondences. -/// -/// @param correspondenceSrcDescIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of descriptors -/// as a part of correspondences. -/// -/// @param correspondenceDistanceQ31 -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output the distances -/// as a part of correspondences. -/// In Q31 format. -/// -/// @param maxNumCorrespondences -/// Maximum number of correspondences allowed -/// -/// @param numCorrespondences -/// Number of correspondences returned by this function -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondenceSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds only extreme outer contours in a binary image. There is no nesting -/// relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 -/// for all the contours. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image without any hierarchical relationships. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and organizes them into a two-level -/// hierarchy. At the top level, there are external boundaries of the -/// components. At the second level, there are boundaries of the holes. -/// If there is another contour inside a hole of a connected component, -/// it is still put at the top level. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and reconstructs a full hierarchy of -/// nested contours -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates assistant and intermediate data for contour -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @return -/// Pointer to allocated data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void* -fcvFindContoursAllocate( uint32_t srcStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Deallocates assistant and intermediate data for contour -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursDelete( void* contourHandle ); - -//------------------------------------------------------------------------------ -/// @brief -/// Solve linear equation system -/// Ax = b -/// -/// @details -/// -/// -/// @param A -/// The matrix contains coefficients of the linear equation system -/// -/// @param numRows -/// The number of rows for the matrix A -/// -/// @param numCols -/// The number of columns for the matrix A -/// -/// @param b -/// The right side value -/// -/// @param x -/// The solution vector -/// -/// -/// @return -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates a perspective transform from four pairs of the corresponding -/// points. -/// NOTE: in order to guarantee a valid output transform, any three points -/// in src1 or src2 cannot be collinear. -/// -/// @param src1 -/// Coordinates of quadrangle vertices in the source image -/// -/// @param src2 -/// Coordinates of the corresponding quadrangle vertices in the destination -/// image -/// -/// @param transformCoefficient -/// 3x3 matrix of a perspective transform -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ -FASTCV_API void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input uint8_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for the mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSetElementsu8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input int32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementss32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input float32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsf32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param value4 -/// Fourth uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param value4 -/// Fourth int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param value4 -/// Fourth float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines an enumeration to list threshold types used in fcvAdaptiveThreshold -//------------------------------------------------------------------------------ - -typedef enum { - FCV_THRESH_BINARY = 0, // value = value > threshold ? max_value : 0 - FCV_THRESH_BINARY_INV // value = value > threshold ? 0 : max_value -} fcvThreshType; - - -//--------------------------------------------------------------------------- -/// @brief -/// Binarizes a grayscale image based on an adaptive threshold value calculated from 3x3 Gaussian kernel. -/// -/// @details -/// For each pixel, the threshold is computed adaptively based on cross-correlation with a -/// 3x3 Gaussian kernel minus value (parameter). The standard deviation is used for Gaussian kernel. -/// For FCV_THRESH_BINARY threshold type, the pixel is set as maxValue if it's value is greater than the threshold; -/// else, it is set as zero. For FCV_THRESH_BINARY_INV threshold type, the pixel is set as zero if it's value is greater than the threshold; -/// else, it is set as maxValue. -/// -/// @param src -/// Pointer to the 8-bit input image. -/// -/// @param srcWidth -/// Width of source images pointed by src. -/// -/// @param srcHeight -/// Height of source images pointed by src. -/// -/// @param srcStride -/// Stride of source image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// -/// @param maxValue -/// The maximum integer value to be used. 0>1+8) *sizeof(uint32_t) -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param integralCrStride -/// The stride of integralCr. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 integralCrStride is default to (srcWidth>>1+8) *sizeof(uint32_t) -/// \n\b NOTE: must be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function finds the foreground. -/// -/// @details -/// This function tries to find a forgound in the current image (represented by: fgIntegralY, -/// fgIntegralCb, fgIntegralCr) based on the current background model (represented by: bgIntegralY, -/// bgIntegralCb, bgIntegralCr). For example, the tuple (bgIntegralY, bgIntegralCb, bgIntegralCr) may be -/// from a picture shooting a wall. Then the tuple (fgIntegralY, fgIntegralCb, fgIntegralCr) may be -/// the wall with a paint on it. Note that all the first six parameters are indicating integral images -/// that's computed from a YUV420 image, which maybe computed from the function: -/// fcvIntegrateImageYCbCr420PseudoPlanaru8. Generally the size of fgIntegralY and bgIntegralY are -/// (srcWidth+1)*(srcHeight+1). And the size of fgIntegralU, fgIntegralV, bgIntegralU and bgIntegralV -/// are (srcWidth/2+1)*(srcHeight/2+1). The value of the outputWidth and outputHeight are usually indicating -/// the desired block size. For example, if the user wants a 20x15 blocks on a 800x480 image. Then -/// outputWidth=800/20 and outputHeight=480/15. After return, if the value in the outputMask image is -/// 255, then a moving block is indicated, otherwise a non-moving block is indicated. -/// -/// @param bgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the background image. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param bgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the background image. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param bgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the background image. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. See the details. -/// \n\b NOTE: must be a multiple of 16. -/// -/// @param srcHeight -/// The height of the source image. See the details. -/// \n\b NOTE: must be a multiple of 2. -/// -/// @param srcYStride -/// The stride of the input source image's Y channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcCbStride -/// The stride of the input source image's Cb channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcCrStride -/// The stride of the input source image's Cr channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param outputMask -/// The output mask image. Each pixel represent the motion condition for a block in the original image. -/// Size of buffer is outputMaskStride*outputHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param outputWidth -/// The width of the output mask image. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param outputHeight -/// The height of the output mask image. -/// -/// @param outputMaskStride -/// The stride of the output mask image. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 outputMaskStride is default to outputWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param threshold -/// The threshold that's used to decide if a block is moving or not. (recommend the value of 20). -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t * __restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// The input image/patch. Must be 32 bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// The actually number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShifts32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracku8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracks32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTrackf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - -//------------------------------------------------------------------------------ -/// @brief -/// Compute a singular value decomposition of a matrix of a float type -/// A = U*diag[w]*Vt; -/// It is used for solving problems like least-squares, under-determined linear systems, matrix -/// inversion and so forth. The algorithm used here does not compute the full U and V matrices -/// however it computes a condensed version of U and V described below which is sufficient to solve -/// most problems which use SVD. -/// -/// @details -/// -/// -/// @param A -/// The input matrix of dimensions m x n -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param m -/// The number of rows of matrix A -/// -/// @param n -/// The number of columns of matrix A -/// -/// @param w -/// The pointer to the buffer that holds n singular values. When m>n it -/// contains n singular values while when m -#include - -//============================================================================== -// Defines -//============================================================================== - -#define FASTCV_INL_VERSION 122 - -#ifdef ANDROID - #include - #define FASTCV_ERROR( FMT, ... ) \ - __android_log_print( ANDROID_LOG_ERROR, "", FMT, __VA_ARGS__ ); -#else - #define FASTCV_ERROR( FMT, ... ) \ - fprintf( stderr, FMT, __VA_ARGS__ ); -#endif - -#ifndef fcvAssertHook - #define fcvAssertHook( FASTCV_ASSERT_HOOK_IN, \ - FASTCV_ASSERT_HOOK_FILE, \ - FASTCV_ASSERT_HOOK_LINE ) \ - FASTCV_ERROR( "%s@%d: %s\n", \ - FASTCV_ASSERT_HOOK_FILE, \ - FASTCV_ASSERT_HOOK_LINE, \ - #FASTCV_ASSERT_HOOK_IN ) -#endif - -#ifndef NDEBUG - #define fcvAssert( FASTCV_ASSERT_IN ) \ - if( !(FASTCV_ASSERT_IN) ) \ - fcvAssertHook( FASTCV_ASSERT_IN, __FILE__, __LINE__ ); -#else - #define fcvAssert( FASTCV_ASSERT_IN ) ((void)0) -#endif - - -//============================================================================== -// Declarations -//============================================================================== - -#ifdef _MSC_VER - #pragma warning(disable:4311) -#endif - -#if FASTCV_VERSION != FASTCV_INL_VERSION - #error "Version mismatch: fastcv.h and fastcv.inl is not from the same version." -#endif - -extern void -(**ppfcvFilterMedian3x3u8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterGaussian3x3u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int border -); - -extern void -(**ppfcvFilterGaussian5x5u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvFilterGaussian11x11u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvColorYUV420toRGB565u8) -( - const uint8_t* __restrict yuv420, - unsigned int width, - unsigned int height, - uint32_t* __restrict rgb565 -); - -extern void -(**ppfcvColorYCrCbH1V1toRGB888u8) -( - const uint8_t* __restrict crcb, - unsigned int width, - unsigned int height, - uint8_t* __restrict rgb888 -); - -extern void -(**ppfcvColorYCrCbH2V2toRGB888u8) -( - const uint8_t* __restrict y_src, - unsigned int width, - unsigned int height, - uint8_t* __restrict rgb888 -); - -extern void -(**ppfcvColorYCrCbH2V1toRGB888u8) -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvColorYCrCbH1V2toRGB888u8) -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvColorRGB888toYCrCbu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvDescriptor17x17u8To36s8) -( - const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq -); - -extern int -(**ppfcvDescriptorSampledMeanAndVar36f32) -( - const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp -); - -extern int32_t -(**ppfcvDotProducts8) -( - const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize -); - -extern int32_t -(**ppfcvDotProductu8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize -); - -extern int32_t -(**ppfcvDotProduct36x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct36x4s8)( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] ); - -extern void -(**ppfcvDotProductNorm36x4s8)( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); -extern int32_t -(**ppfcvDotProduct36x1u8)( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - -extern void -(**ppfcvDotProduct36x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm36x4u8)( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern int32_t -(**ppfcvDotProduct64x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct64x4s8) -( - const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm64x4s8)( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern uint32_t -(**ppfcvDotProduct64x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvDotProduct64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm64x4u8)( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern int32_t -(**ppfcvDotProduct128x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct128x4s8)( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] ); - -extern void -(**ppfcvDotProductNorm128x4s8) -( - const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts -); - -extern uint32_t -(**ppfcvDotProduct128x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvDotProduct128x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm128x4u8)(const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -extern void -(**ppfcvDotProduct8x8u8)( const uint8_t* ptch, const uint8_t* img, - unsigned short imgW, unsigned short imgH, int nX, - int nY, unsigned int nNum, int32_t* nProducts ); - -extern void -(**ppfcvDotProduct11x12u8)( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, int iX, - int iY, int32_t* __restrict dotProducts ); - -extern void -(**ppfcvFilterSobel3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCanny3x3u8_v2) -( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int low, - int high -); - -extern void -(**ppfcvImageDiffu8_v2) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDiffs16_v2) -( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDifff32_v2) -( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDiffu8f32_v3) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStrde -); - - -extern void -(**ppfcvImageDiffu8s8_v2) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageGradientInterleaveds16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientInterleavedf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientPlanars16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientPlanarf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelInterleaveds16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride -); - -extern void - (**ppfcvImageGradientSobelInterleaveds16_v3) - ( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride - ); - -extern void -(**ppfcvImageGradientSobelInterleavedf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientSobelPlanars16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void - (**ppfcvImageGradientSobelPlanars16_v3) - ( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelPlanarf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelPlanarf32f32_v2) -( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride -); - -extern int -(**ppfcvClusterEuclideanf32)( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -extern int -(**ppfcvClusterEuclideanNormedf32)( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) ; - - -extern int -(**ppfcvClusterEuclideanNormed36f32)( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - -extern void -(**ppfcvImageGradientSobelPlanars8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvCornerFast9u8_v2) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - unsigned int maxnumcorners, - uint32_t* numcorners -); - -extern void -(**ppfcvCornerFast9InMasku8_v2) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight -); - -extern void -(**ppfcvCornerFast10u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - -extern void -(**ppfcvCornerFast10InMasku8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - -extern void -(**ppfcvCornerHarrisu8) -( - const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold -); - -extern unsigned int -(**ppfcvLocalHarrisMaxu8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore -); - -extern void -(**ppfcvCornerHarrisInMasku8) -( - const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold, - const uint8_t* __restrict bitMask, - int maskWidth, - int maskHeight -); - -extern void -(**ppfcvGeomAffineFitf32)( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - -extern int -(**ppfcvGeomAffineEvaluatef32)( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -extern void -(**ppfcvGeomHomographyFitf32)( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - -extern int -(**ppfcvGeomHomographyEvaluatef32)( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -extern float -(**ppfcvGeomPoseRefineGNf32) ( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -extern int -(**ppfcvGeomPoseUpdatef32) ( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -extern int -(**ppfcvGeomPoseOptimizeGNf32) ( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -extern float -(**ppfcvGeomPoseEvaluateErrorf32) ( - const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - -extern int -(**ppfcvGeomPoseEvaluatef32) ( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - -extern void -(**ppfcvGeom3PointPoseEstimatef32) ( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - -extern void -(**ppfcvFilterCorr3x3s8_v2) -( -const int8_t* __restrict mask, -const uint8_t* __restrict srcImg, -unsigned int srcWidth, -unsigned int srcHeight, -unsigned int srcStride, -uint8_t* __restrict dstImg, -unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep9x9s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep13x13s16) -( - const int16_t* __restrict knl, - const int16_t* __restrict srcimg, unsigned int w, unsigned int h, - int16_t* __restrict tmpimg, - int16_t* __restrict dstimg -); - - -extern void -(**ppfcvFilterCorrSep11x11s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep13x13s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep15x15s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep17x17s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDownBy2u8_v2) -( const uint8_t* __restrict imgSrc, - unsigned int width, - unsigned int height, - unsigned int srcStride, - uint8_t* __restrict imgDst, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDownBy4u8_v2) -( const uint8_t* __restrict imgSrc, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict imgDst, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDown3To2u8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvScaleDownu8_v2) -( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride -); - -extern int -(**ppfcvScaleDownNNu8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride -); - -extern void -(**ppfcvScaleUpBy2Gaussian5x5u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvScaleDownBy2Gaussian5x5u8) -( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvScaleDownBy2Gaussian5x5u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageIntensityStats) ( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -extern void -(**ppfcvImageIntensityHistogram)( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - -extern void -(**ppfcvIntegrateImageu8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - uint32_t* __restrict integralImageOut, - unsigned int integralImageStride -); - -extern void -(**ppfcvIntegratePatchu8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegratePatch12x12u8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegratePatch18x18u8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegrateImageLineu8) -( - const uint8_t* __restrict imageIn, - unsigned short numPxls, - uint32_t* intgrl, - uint32_t* intgrlSqrd -); - -extern void -(**ppfcvIntegrateImageLine64u8) -( - const uint8_t* __restrict imageIn, - uint16_t* intgrl, - uint32_t* intgrlSqrd -); - -extern int -(**ppfcvNCCPatchOnCircle8x8u8_v2) -( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -extern int -(**ppfcvNCCPatchOnSquare8x8u8_v2) -( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - -extern void -(**ppfcvSumOfAbsoluteDiffs8x8u8_v2) -( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvVecNormalize36s8f32)( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - -extern void -(**ppfcvSumOfSquaredDiffs36x4s8)( const int8_t* __restrict A, - float invLenA, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - const float invLenB[4], - float distances[4] ); - -extern void -(**ppfcvSumOfSquaredDiffs36xNs8)( const int8_t* __restrict A, - float invLenA, - const int8_t* const * __restrict B, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - -extern void -(**ppfcvSort8Scoresf32)( float* __restrict inScores, - float* __restrict outScores ); - -extern void -(**ppfcvFilterThresholdu8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold -); - -extern void -(**ppfcvFilterDilate3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterErode3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvTransformAffine8x8u8_v2) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride -); - -extern void -(**ppfcvWarpPerspectiveu8) -( - const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict kernel -); - -extern void -(**ppfcvWarpPerspectiveu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict kernel -); - -extern void -(**ppfcv3ChannelWarpPerspectiveu8) -( - const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict kernel -); - -extern void -(**ppfcv3ChannelWarpPerspectiveu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict kernel -); - -extern void -(**ppfcvFilterGaussian5x5s16_v2) -( - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvFilterGaussian5x5s32_v2) -( - const int32_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern int -(**ppfcvTransformAffineu8) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - const float nPos[ 2 ], - const float nAffine[ 4 ], - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight -); - -extern int -(**ppfcvTransformAffineu8_v2) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const float nPos[ 2 ], - const float nAffine[ 4 ], - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride -); - -extern void -(**ppfcvCopyRotated17x17u8) -( - const uint8_t*region, - uint8_t*patch, - int nOri - ); - -extern void -(**ppfcvCornerFast9Scoreu8_v3) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* numcorners -); - -extern void -(**ppfcvCornerFast9InMaskScoreu8_v3) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight -); - -extern void -(**ppfcvCornerFast9Scoreu8_v4) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* numcorners, - uint32_t nmsEnabled, - void* __restrict tempBuf -); - -extern void -(**ppfcvCornerFast9InMaskScoreu8_v4) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf -); - -extern void -(**ppfcvCornerFast10Scoreu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -extern void -(**ppfcvCornerFast10InMaskScoreu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -extern void -(**ppfcvTrackLKOpticalFlowu8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized -); - -extern void -(**ppfcvTrackLKOpticalFlowf32) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized -); - -extern int -(**ppfcvPyramidCreatef32) -( - const float* __restrict base, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid -); - -extern int -(**ppfcvPyramidCreateu8) -( - const uint8_t* __restrict base, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, - fcvPyramidLevel * pyramid -); - -extern int -(**ppfcvPyramidAllocate) -( - fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase -); - -extern void -(**ppfcvPyramidDelete) -( - fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel -); - -extern int -(**ppfcvPyramidSobelGradientCreatei16) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, - unsigned int numLevels -); - -extern int -(**ppfcvPyramidSobelGradientCreatei8) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, unsigned int numLevels -); - -extern int -(**ppfcvPyramidSobelGradientCreatef32) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, - unsigned int numLevels -); - -extern uint32_t -(**ppfcvBitCountu8) -( - const uint8_t* __restrict src, - unsigned int len -); - -extern uint32_t -(**ppfcvBitCount32x1u8) -( - const uint8_t* __restrict src -); - -extern void -(**ppfcvBitCount32x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - uint32_t* __restrict count -); - -extern uint32_t -(**ppfcvBitCount64x1u8) -( - const uint8_t* __restrict src -); - -extern void -(**ppfcvBitCount64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - uint32_t count[4] -); - -extern uint32_t -(**ppfcvBitCountu32) -( - const uint32_t* __restrict src, - unsigned int len -); - -extern uint32_t -(**ppfcvHammingDistanceu8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int len -); - -extern uint32_t -(**ppfcvHammingDistance32x1u8a4) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance64x1u8a4) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance32x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance64x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvHammingDistance32x4u8a4) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern void -(**ppfcvHammingDistance64x4u8a4) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern void -(**ppfcvHammingDistance64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern int -(**ppfcvTrackBMOpticalFlow16x16u8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY -); - -extern int -(**ppfcvMserInit) -( - const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle -); - -extern void -(**ppfcvMserRelease) (void *mserHandle); - -extern void -(**ppfcvMseru8) -( - void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour, -unsigned int pointsArraySize, -unsigned int* __restrict pointsArray -); - -extern void -(**ppfcvMserExtu8)( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ); - - -extern void -(**ppfcvBoundingRectangle) -( -const uint32_t * __restrict xy, uint32_t numPoints, - uint32_t * rectTopLeftX, uint32_t * rectTopLeftY, - uint32_t * rectWidth, uint32_t *rectHeight -); - -extern void -(**ppfcvUpsampleVerticalu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleHorizontalu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsample2Du8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleVerticalInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleHorizontalInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsample2DInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToRGB888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToRGBA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToRGB565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToRGBA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToRGB565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToRGB888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToLABu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvEdgeWeightings16) -( - int16_t* __restrict edgeMap, - const uint32_t edgeMapWidth, - const uint32_t edgeMapHeight, - const uint32_t edgeMapStride, - const uint32_t weight, - const uint32_t edge_limit, - const uint32_t hl_threshold, - const uint32_t hh_threshold, - const uint32_t edge_denoise_factor -); - -extern void -(**ppfcvDeinterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst0, - uint32_t dst0Stride, - uint8_t* __restrict dst1, - uint32_t dst1Stride -); - -extern void -(**ppfcvInterleaveu8) -( - const uint8_t* __restrict src0, - const uint8_t* __restrict src1, - uint32_t imageWidth, - uint32_t imageHeight, - uint32_t src0Stride, - uint32_t src1Stride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWTHaarTransposeu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWT53TabTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWT53TabTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWTHaarTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWTHaaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWT53Tabs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWT53Tabs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWTHaars16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDCTu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDCTs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvScaleUpPolyu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleUpPolyInterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleDownMNu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleDownMNInterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern uint32_t -(**ppfcvKMeansTreeSearch36x10s8) -( - const int8_t* __restrict nodeChildrenCenter, - const uint32_t* __restrict nodeChildrenInvLenQ32, - const uint32_t* __restrict nodeChildrenIndex, - const uint8_t* __restrict nodeNumChildren, - uint32_t numNodes, - const int8_t* __restrict key -); - -extern void -(**ppfcvLinearSearch8x36s8) -( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondencSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences -); - -extern int -(**ppfcvLinearSearchPrepare8x36s8_v2) -( - uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict idxLUT, - uint32_t numDescDB -); - -extern void -(**ppfcvFindContoursExternalu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void -(**ppfcvFindContoursListu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - -extern void -(**ppfcvFindContoursCcompu8)( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void -(**ppfcvFindContoursTreeu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void * -(**ppfcvFindContoursAllocate) ( uint32_t srcStride ); - -extern void -(**ppfcvFindContoursDelete) ( void* contourHandle ); - -extern void -(**ppfcvSolvef32) (const float32_t * __restrict A, - int32_t numRows, - int32_t numCols, - const float32_t * __restrict b, - float32_t * __restrict x); - -extern void -(**ppfcvGetPerspectiveTransformf32)( const float32_t* __restrict src, - const float32_t* __restrict dst, - float32_t* __restrict transformCoefficient ); - - -extern void -(**ppfcvSetElementsu8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementss32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsf32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4u8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4s32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4f32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); -extern void -(**ppfcvSetElementsc3u8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc3s32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc3f32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -extern void -(**ppfcvAdaptiveThresholdGaussian3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); -extern void -(**ppfcvAdaptiveThresholdGaussian5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdGaussian11x11u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdMean3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAdaptiveThresholdMean5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdMean11x11u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvBoxFilter3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - - -extern void -(**ppfcvBoxFilter5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - -extern void -(**ppfcvBoxFilter11x11u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - -extern void -(**ppfcvBilateralFilter5x5u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - - -extern void -(**ppfcvBilateralFilter7x7u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - -extern void -(**ppfcvBilateralFilter9x9u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - -extern void -(**ppfcvSegmentFGMasku8)(uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t Polygonal, - uint32_t perimScale); - - -extern void -(**ppfcvAbsDiffu8)(const uint8_t * __restrict src1, - const uint8_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - - -extern void -(**ppfcvAbsDiffs32)(const int32_t * __restrict src1, - const int32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - - - -extern void -(**ppfcvAbsDifff32)(const float32_t * __restrict src1, - const float32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVu8)(const uint8_t * __restrict src, - uint8_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVs32)(const int32_t * __restrict src, - int32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVf32)(const float32_t * __restrict src, - float32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVc4u8)(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVc4s32)(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc4f32)(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride); - -extern void -(**ppfcvAbsDiffVc3u8)(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc3s32)(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc3f32)(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride); - -extern -int (**ppfcvKDTreeCreate36s8f32) -( const int8_t* __restrict vectors, - const float32_t* __restrict invLengths, - int numVectors, - fcvKDTreeDatas8f32** kdtrees -); - -extern -int (**ppfcvKDTreeDestroy36s8f32) -( fcvKDTreeDatas8f32* kdtrees -); - -extern -int (**ppfcvKDTreeQuery36s8f32) -( fcvKDTreeDatas8f32* kdtrees, - const int8_t* __restrict query, - float32_t queryInvLen, - int maxNNs, - float32_t maxDist, - int maxChecks, - const uint8_t* __restrict mask, - int32_t* numNNsFound, - int32_t* __restrict NNInds, - float32_t* __restrict NNDists -); - -extern void (**ppfcvBitwiseOru8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -); - -extern void -(**ppfcvBitwiseOrs32) -( - const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -); - -extern void -(**ppfcvColorRGB888ToGrayu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvTiltedIntegralu8s32) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvConvValids16) -( - const int16_t* __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int16_t* __restrict src2, - uint32_t src2Width, - uint32_t src2Height, - uint32_t src2Stride, - int32_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvFloodfillSimpleu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - uint32_t xBegin, - uint32_t yBegin, - uint8_t newVal, //new Val can't be zero. zero is background. - fcvConnectedComponent *cc, - uint8_t connectivity, - void* lineBuffer); - -extern void -(**ppfcvUpdateMotionHistoryu8s32) -( - const uint8_t* __restrict src, - uint32_t srcWidth, uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride, - int32_t timeStamp, - int32_t maxHistory); - -extern void -(**ppfcvIntegrateImageYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride -); - -extern void -(**ppfcvFindForegroundIntegrateImageYCbCr420u32) -( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t *__restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold -); - -extern void -(**ppfcvAverages32) -( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue -); - -extern void -(**ppfcvAverageu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue -); - -extern uint32_t - (**ppfcvMeanShiftu8) - (const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvMeanShifts32) - (const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvMeanShiftf32) - (const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvConAdaTracku8) - (const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern uint32_t - (**ppfcvConAdaTracks32) - (const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern uint32_t - (**ppfcvConAdaTrackf32) - (const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern void -(**ppfcvSVDf32) -( - const float32_t * __restrict A, - uint32_t m, - uint32_t n, - float32_t * __restrict w, - float32_t * __restrict U, - float32_t * __restrict Vt, - float32_t * __restrict tmpU, - float32_t * __restrict tmpV -); - -extern void -(**ppfcvFillConvexPolyu8) -( - uint32_t nPts, - const uint32_t* __restrict polygon, - uint32_t nChannel, - const uint8_t* __restrict color, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvPointPolygonTest) -( - uint32_t nPts, - const uint32_t* __restrict polygonContour, - uint32_t px, - uint32_t py, - float32_t* distance, - int16_t* resultFlag -); - -extern void -(**ppfcvFindConvexHull) -( - uint32_t* __restrict polygonContour, - uint32_t nPtsContour, - uint32_t* __restrict convexHull, - uint32_t* nPtsHull, - uint32_t* __restrict tmpBuff -); - -extern int32_t -(**ppfcvSolveCholeskyf32) -( - float32_t* __restrict A, - const float32_t* __restrict b, - float32_t* __restrict diag, - uint32_t N, - float32_t* __restrict x -); - -extern void - (**ppfcvGeomDistortPoint2x1f32) - (const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice); - -extern void -(**ppfcvGeomDistortPoint2xNf32)(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyDevice, - uint32_t dstStride); - -extern void - (**ppfcvGeomUndistortPoint2x1f32) - (const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - float32_t* __restrict xyCamera); - -extern void -(**ppfcvGeomUndistortPoint2xNf32)(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyCamera, - uint32_t dstStride); - -extern int32_t -(**ppfcvGeomProjectPoint3x1f32) -(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice); - -extern void -(**ppfcvGeomProjectPoint3xNf32)(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - uint32_t srcStride, - uint32_t xyzSize, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice, - uint32_t dstStride, - uint32_t* inFront); - -extern void -(**ppfcvRemapRGBA8888NNu8) -( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride -); - -extern void -(**ppfcvRemapRGBA8888BLu8) -( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride -); - -extern void -(**ppfcvJacobianSE2f32) -( const uint8_t *__restrict warpedImage, - const uint16_t *__restrict warpedBorder, - const uint8_t *__restrict targetImage, - const int16_t *__restrict targetDX, - const int16_t *__restrict targetDY, - uint32_t width, - uint32_t height, - uint32_t stride, - float32_t *__restrict sumJTJ, - float32_t *__restrict sumJTE, - float32_t *__restrict sumError, - uint32_t * __restrict numPixels -); - -extern void -(**ppfcvTransformAffineClippedu8) -( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t *__restrict affineMatrix, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint32_t *__restrict dstBorder -); - -extern fcvBGCodeWord** - (**ppfcvCreateBGCodeBookModel) - ( - uint32_t srcWidth, - uint32_t srcHeight, - void** __restrict cbmodel - ); - -extern void - (**ppfcvReleaseBGCodeBookModel) - ( - void** cbmodel - ); - -extern void - (**ppfcvBGCodeBookUpdateu8) - ( - void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict updateTime - ); - -extern void - (**ppfcvBGCodeBookDiffu8) - ( - void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict numFgMask - ); - - -extern void - (**ppfcvBGCodeBookClearStaleu8) - ( - void* __restrict cbmodel, - int32_t staleThresh, - const uint8_t* __restrict fgMask, - uint32_t fgMaskWidth, - uint32_t fgMaskHeight, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap - ); - -extern void -(**ppfcvHoughCircleu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvCircle *circles, - uint32_t* numCircle, - uint32_t maxCircle, - uint32_t minDist, - uint32_t cannyThreshold, - uint32_t accThreshold, - uint32_t minRadius, - uint32_t maxRadius, - void *data); - -extern void -(**ppfcvDrawContouru8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t color, - uint8_t hole_color); - -extern void -(**ppfcvDrawContourInterleavedu8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB); - -extern void -(**ppfcvDrawContourPlanaru8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB); - -//============================================================================== -// Function Definitions -//============================================================================== - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterMedian3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterMedian3x3u8_v2)( src, width, height, width, dst, width ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterMedian3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( ((width - 2)/6)*6 <= (width - 2) && - ((width - 2)/6)*6 >= ((width - 2) - 5) ); - - return (**ppfcvFilterGaussian3x3u8_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - fcvAssert( ((srcWidth - 2)/6)*6 <= (srcWidth - 2) && - ((srcWidth - 2)/6)*6 >= ((srcWidth - 2) - 5) ); - - return (**ppfcvFilterGaussian3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian5x5u8_v2)( src, width, height, width, dst, width, - border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int blurBorder ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian11x11u8_v2)( src, width, height, width, dst, - width, blurBorder ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvFilterGaussian11x11u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, blurBorder ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYUV420toRGB8888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint32_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8)( src, width, height, width, width, dst, width * sizeof(uint32_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ) -{ - srcYStride = (srcYStride==0 ? srcWidth : srcYStride); - srcCStride = (srcCStride==0 ? srcWidth : srcCStride); - dstStride = (dstStride==0 ? srcWidth*4 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 4 - fcvAssert( (dstStride & 31) == 0 ); // multiple of 32 - fcvAssert( (srcYStride >= srcWidth) ); // Y-stride is at least as much as srcWidth - fcvAssert( (srcCStride >= srcWidth) ); // Y-stride is at least as much as srcWidth/2 - fcvAssert( (dstStride >= srcWidth*4) ); // Dst-stride is at least as much as srcWidth*3 -#endif - - return (**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8)( src, srcWidth, srcHeight, - srcYStride, srcCStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYUV420toRGB565u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint32_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x3) == 0 ); // multiple of 4 -#endif - - return (**ppfcvColorYUV420toRGB565u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH1V1toRGB888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH1V1toRGB888u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH2V2toRGB888u8 -( - const uint8_t* __restrict y_src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)y_src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH2V2toRGB888u8)( y_src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorRGB888toYCrCbu8_v2 -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - dstStride = (dstStride==0 ? srcWidth*3 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*3) ); // multiple of 8 - fcvAssert( (dstStride >= srcWidth*3) ); // multiple of 8 -#endif - - return (**ppfcvColorRGB888toYCrCbu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorRGB888toYCrCbu8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorRGB888toYCrCbu8_v2)( src, width, height, width*3, dst, width*3 ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH2V1toRGB888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH2V1toRGB888u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH1V2toRGB888u8 -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - - fcvAssert( ((int)(size_t)ysrc & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH1V2toRGB888u8)( ysrc, width, height, dst ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ) -{ - return (**ppfcvDescriptor17x17u8To36s8)(patch, descriptorChar, descriptorNormSq); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvDescriptorSampledMeanAndVar36f32( - const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ) -{ - return (**ppfcvDescriptorSampledMeanAndVar36f32)(src, first, last, vind, means, vars, temp); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ) -{ - return (**ppfcvDotProducts8)( a, b, abSize ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ) -{ - return (**ppfcvDotProductu8)( a, b, abSize ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct36x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct36x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct36x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm36x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm36x4s8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct36x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct36x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct36x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm36x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm36x4u8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct64x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct64x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct64x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm64x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm64x4s8)( A, invLengthA, - vB0, - vB1, - vB2, - vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct64x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct64x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct64x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm64x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm64x4u8)( A, invLengthA, - vB0, - vB1, - vB2, - vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct128x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct128x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct128x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm128x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm128x4s8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct128x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct128x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct128x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm128x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm128x4u8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct8x8u8( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, - int nX, int nY, unsigned int nNum, int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct8x8u8)( ptch, img, imgW, imgH, nX, nY, nNum, dotProducts ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct11x12u8( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, - int iX, int iY, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct11x12u8)( ptch, img, imgW, imgH, iX, iY, dotProducts ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterSobel3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterSobel3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int low, - int high ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( (low >=0 ) && (low <= 255) ); - fcvAssert( (high >=0 ) && (high <= 255) ); - fcvAssert( low <= high ); - - return (**ppfcvFilterCanny3x3u8_v2)( src, width, height, width, dst, width, low, high ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int low, - int high ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - fcvAssert( (low >=0 ) && (low <= 255) ); - fcvAssert( (high >=0 ) && (high <= 255) ); - fcvAssert( low <= high ); - - return (**ppfcvFilterCanny3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, low, high ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageDiffu8_v2)( src1, src2, srcWidth, srcHeight, srcWidth, dst, - srcWidth ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvImageDiffu8_v2)( src1, src2, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -inline void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? (srcWidth * sizeof (int16_t)) : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (int16_t)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvImageDiffs16_v2)( src1, src2, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? (srcWidth * sizeof (float)) : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (float)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDifff32_v2)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (float)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDiffu8f32_v3)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDiffu8s8_v2)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); - -} - - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); //4*(width-2) because 2 grad values, 2 bytes each. - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*(width-2) -#endif - - return(**ppfcvImageGradientInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*gradients) == 4 ); -#endif - - return(**ppfcvImageGradientInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(float) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(float))) ); // at least as much as 8*width -#endif - - return(**ppfcvImageGradientInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth<<1) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0xF) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // srcStride should be at least as much as srcWidth - fcvAssert( (dxyStride >= (srcWidth<<1)) ); // dxyStride should be at least twice as much as srcWidth -#endif - - return(**ppfcvImageGradientPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*dx) == 4 ); - fcvAssert( sizeof(*dy) == 4 ); -#endif - - return(**ppfcvImageGradientPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? srcStride*4 : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 31) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( srcStride >= srcWidth ); // at least as much as width - fcvAssert( dxyStride >= srcWidth*4 ); // at least as much as 4*width -#endif - - return(**ppfcvImageGradientPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*(width -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*width -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v3)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*gradients) == 4 ); -#endif - - return (**ppfcvImageGradientSobelInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(float) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(float))) ); // at least as much as 8*width -#endif - - return (**ppfcvImageGradientSobelInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(int16_t)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 15 ) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(int16_t))) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageGradientSobelPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(int16_t)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(int16_t))) ); // Stride is at least as much as Width*2 -#endif - - return (**ppfcvImageGradientSobelPlanars16_v3)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanars8_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? srcWidth : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageGradientSobelPlanars8_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(float)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 31 ) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. -#endif - - return (**ppfcvImageGradientSobelPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*dx) == 4 ); - fcvAssert( sizeof(*dy) == 4 ); -#endif - - return (**ppfcvImageGradientSobelPlanarf32f32_v2)(src,srcWidth,srcHeight,srcStride*sizeof(float),dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? (srcWidth*sizeof(float)) : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(float)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 31) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( (dxyStride & 31 ) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( (srcStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. - fcvAssert( (dxyStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. -#endif - - return (**ppfcvImageGradientSobelPlanarf32f32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanNormed36f32)(points,numPoints,pointStride,indices,numIndices,numClusters,clusterCenters, - clusterCenterStride,newClusterCenters,clusterMemberCounts, - clusterBindings,sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanf32)(points,numPoints,dim,pointStride,indices,numIndices,numClusters, - clusterCenters,clusterCenterStride, - newClusterCenters,clusterMemberCounts,clusterBindings, - sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanNormedf32)(points,numPoints,dim,pointStride,indices,numIndices,numClusters,clusterCenters, - clusterCenterStride,newClusterCenters,clusterMemberCounts, - clusterBindings,sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9u8_v2)( src, width, height, stride, barrier, border, xy, - maxnumcorners, numcorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9InMasku8_v2)( src, width, height, stride, barrier, border, xy, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( srcWidth <= 2048 ); - - (**ppfcvCornerFast10u8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, - nCornersMax, nCorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( srcWidth <= 2048 ); - - (**ppfcvCornerFast10InMasku8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, - nCornersMax, nCorners, - mask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvCornerHarrisu8)( src, width, height, stride, border, xy, - maxnumcorners, numcorners, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline unsigned int -fcvLocalHarrisMaxu8 (const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvLocalHarrisMaxu8) - ( src, srcWidth, srcHeight, srcStride, posX, - posY, maxX, maxY, maxScore); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvCornerHarrisInMasku8( const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvCornerHarrisInMasku8)( srcImg, width, height, stride, border, xy, maxnumcorners, - numcorners, threshold, bitMask, maskWidth, - maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*affine) == 4 ); -#endif - - (**ppfcvGeomAffineFitf32)( corrs, affine ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*affine) == 4 ); -#endif - - return (**ppfcvGeomAffineEvaluatef32)( corrs, affine, maxsqerr, inliers, - numinliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*homography) == 4 ); -#endif - - (**ppfcvGeomHomographyFitf32)( corrs, homography ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*homography) == 4 ); -#endif - - return (**ppfcvGeomHomographyEvaluatef32)( corrs, homography, maxsqerr, inliers, - numinliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*initpose) == 4 ); - fcvAssert( sizeof(*refinedpose) == 4 ); -#endif - - return (**ppfcvGeomPoseRefineGNf32)( corrs, minIterations, maxIterations, stopCriteria, - initpose, refinedpose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseUpdatef32)( projected, reprojErr, invz, - reprojVariance, numpts, pose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseOptimizeGNf32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseOptimizeGNf32)( projected, reprojErr, invz, - reprojVariance, numpts, pose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline float -fcvGeomPoseEvaluateErrorf32( - const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseEvaluateErrorf32)( corrs, pose, projected, reprojErr, - invz, reprojVariance ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseEvaluatef32)( corrs, pose, maxSquErr, inliers, numInliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeom3PointPoseEstimatef32)( corrs, pose, numPoses ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, unsigned int w, unsigned int h, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x1) == 0 ); // even - fcvAssert( (h & 0x1) == 0 ); // even -#endif - - (**ppfcvFilterCorr3x3s8_v2)( kernel, src, w, h, w, dst, w ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x1) == 0 ); // even - fcvAssert( (srcHeight & 0x1) == 0 ); // even - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvFilterCorr3x3s8_v2)( kernel, src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep9x9s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep9x9s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep11x11s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep11x11s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep13x13s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep13x13s16)( knl, src, w, h, tmp, dst ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep15x15s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep15x15s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep17x17s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep17x17s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep9x9s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep11x11s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep13x13s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep15x15s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep17x17s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -inline void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*mean) == 4 ); - fcvAssert( sizeof(*variance) == 4 ); -#endif - fcvAssert( (recHeight * recWidth ) > 1 ); - - (**ppfcvImageIntensityStats)( src, srcWidth, xBegin, yBegin, recWidth, recHeight, mean, - variance ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -inline void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)histogram & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvImageIntensityHistogram)( src, srcWidth, xBegin, yBegin, recWidth, recHeight, - histogram ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegrateImageu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint32_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( height < 2048 ); -#endif - - (**ppfcvIntegrateImageu8_v2)( src, width, height, width, dst, (width+1)*sizeof(uint32_t) ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegrateImageu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint32_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? ((srcWidth+1)*sizeof(uint32_t)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= ((srcWidth+1)*sizeof(uint32_t))) ); // Stride is at least as much as Width*4 (in bytes) - fcvAssert( (srcHeight) < 2048 ); -#endif - - (**ppfcvIntegrateImageu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, int patchX, int patchY, - unsigned int patchW, unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (patchW*patchH) < 66051 ); // to avoid overflow -#endif - fcvAssert( height < 2048 ); - - (**ppfcvIntegratePatchu8_v2)( src, width, height, width, patchX, patchY, patchW, patchH, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (patchW*patchH) < 66051 ); // to avoid overflow -#endif - fcvAssert( srcHeight < 2048 ); - - (**ppfcvIntegratePatchu8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - patchW, patchH, intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIntegratePatch12x12u8_v2)( src, srcWidth, srcHeight, srcWidth, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvIntegratePatch12x12u8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, int patchX, int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIntegratePatch18x18u8_v2)( src, width, height, width, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvIntegratePatch18x18u8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageLineu8( const uint8_t* __restrict imageIn, - unsigned short numPxls, - uint32_t* intgrl, - uint32_t* intgrlSqrd ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)imageIn & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIntegrateImageLineu8)( imageIn, numPxls, intgrl, intgrlSqrd ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageLine64u8( const uint8_t* __restrict imageIn, - uint16_t* intgrl, - uint32_t* intgrlSqrd ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)imageIn & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIntegrateImageLine64u8)( imageIn, intgrl, intgrlSqrd ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_radius <= 5 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - const int defaultLowVariance = 0; - - return (**ppfcvNCCPatchOnCircle8x8u8_v2) - ( patch_pixels, image_pixels, - image_w, image_h, search_center_x, search_center_y, - search_radius, defaultLowVariance, bestX, bestY, bestNCC, - doSubPixel, subX, subY ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_w <= 11 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - const int defaultLowVariance = 0; - - return (**ppfcvNCCPatchOnSquare8x8u8_v2) - ( patch_pixels, image_pixels, image_w, image_h, - search_center_x, search_center_y, search_w, defaultLowVariance, - bestX, bestY, bestNCC, doSubPixel, subX, subY ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_radius <= 5 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - - return (**ppfcvNCCPatchOnCircle8x8u8_v2) - ( patch_pixels, image_pixels, - image_w, image_h, search_center_x, search_center_y, - search_radius, filterLowVariance, bestX, bestY, bestNCC, - doSubPixel, subX, subY ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_w <= 11 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - - return (**ppfcvNCCPatchOnSquare8x8u8_v2) - ( patch_pixels, image_pixels, image_w, image_h, - search_center_x, search_center_y, search_w, filterLowVariance, - bestX, bestY, bestNCC, doSubPixel, subX, subY ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int width, unsigned int height, - unsigned int pitch, - uint16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (patch != NULL) ); - fcvAssert( (src != NULL) ); - fcvAssert( (dst != NULL) ); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvSumOfAbsoluteDiffs8x8u8_v2)( patch, 8, src, width, height, pitch, dst, width*sizeof(uint16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ) -{ - patchStride = (patchStride==0 ? 8 : patchStride); - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth*2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (patch != NULL) ); - fcvAssert( (src != NULL) ); - fcvAssert( (dst != NULL) ); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (patchStride >= 8) ); // Stride is at least as much as width - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth*2)) ); // Stride is at least as much as 2*width -#endif - - return (**ppfcvSumOfAbsoluteDiffs8x8u8_v2)( patch, patchStride, src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy2u8( const uint8_t* __restrict src, unsigned int width, unsigned int height, - uint8_t* __restrict dst) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownBy2u8_v2)( src, width, height, width, dst, width/2 ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth/2)) ); // Stride is at least as much as width/2 -#endif - - return (**ppfcvScaleDownBy2u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy4u8( const uint8_t* __restrict src, unsigned int width, unsigned int height, - uint8_t* __restrict dst) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownBy4u8_v2)( src, width, height, width, dst, width/4 ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/4 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth/4)) ); // Stride is at least as much as (width/4) -#endif - - return (**ppfcvScaleDownBy4u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDown3To2u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownNNu8)( src, srcWidth, srcHeight, srcStride, dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst, - unsigned int dstWidth, unsigned int dstHeight) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( ( width % dstWidth ) == 0 && ( height % dstHeight ) == 0 ); - - return (**ppfcvScaleDownu8_v2)( src, width, height, width, dst, dstWidth, dstHeight, dstWidth ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // Stride is at least as much as width -#endif - fcvAssert( ( srcWidth % dstWidth ) == 0 && ( srcHeight % dstHeight ) == 0 ); - - return (**ppfcvScaleDownu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpBy2Gaussian5x5u8_v2)( src, width, height, width, dst, width*2 ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth*2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth*2)) ); // Stride is at least as much as 2*width -#endif - - (**ppfcvScaleUpBy2Gaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( (width&1)==0 && (height&1)==0 ); - - (**ppfcvScaleDownBy2Gaussian5x5u8)( src, width, height, dst ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 1) == 0 ); // Height is multiple of 2 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= (srcWidth/2)) ); // Stride is at least as much as Width/2 -#endif - - (**ppfcvScaleDownBy2Gaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvVecNormalize36s8f32)( src, srcStride, invLen, numVecs, reqNorm, - dst, stopBuild ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict A, - float invLenA, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - const float* __restrict invLenB, - float* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLenB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvSumOfSquaredDiffs36x4s8)( A, invLenA, B, C, D, E, invLenB, - distances ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict A, - float invLenA, - const int8_t* const * __restrict B, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*invLenB) == 4 ); - fcvAssert( sizeof(*distances) == 4 ); -#endif - - return (**ppfcvSumOfSquaredDiffs36xNs8)( A, invLenA, B, invLenB, numB, - distances ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSort8Scoresf32( float* __restrict inScores, - float* __restrict outScores ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*inScores) == 4 ); - fcvAssert( sizeof(*outScores) == 4 ); -#endif - - return (**ppfcvSort8Scoresf32)( inScores, outScores ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterThresholdu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - unsigned int threshold ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterThresholdu8_v2)( src, width, height, width, dst, width, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterThresholdu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterThresholdu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterDilate3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterDilate3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterErode3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterErode3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvTransformAffine8x8u8_v2)( src, width, height, width, nPos, nAffine, nPatch, 8 ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - patchStride = (patchStride==0 ? 8 : patchStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment - - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (patchStride >= 8) ); // Stride is at least as much as 8 (patchWidth) -#endif - - return (**ppfcvTransformAffine8x8u8_v2)( src, srcWidth, srcHeight, srcStride, - nPos, nAffine, patch, patchStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict proj ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvWarpPerspectiveu8)( src, srcwidth, srcheight, dst, - dstwidth, dstheight, proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict proj ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // at least as much as width -#endif - - return (**ppfcvWarpPerspectiveu8_v2)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride, - proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict proj ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcv3ChannelWarpPerspectiveu8)( src, srcwidth, srcheight, dst, - dstwidth, dstheight, proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict proj ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - dstStride = (dstStride==0 ? dstWidth*3 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= (srcWidth*3)) ); // at least as much as 3*width (3-channel) - fcvAssert( (dstStride >= (dstWidth*3)) ); // at least as much as 3*width (3-channel) -#endif - - return (**ppfcv3ChannelWarpPerspectiveu8_v2)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride, - proj ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int width, - unsigned int height, - int16_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvFilterGaussian5x5s16_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5s16_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int width, - unsigned int height, - int32_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian5x5s32_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5s32_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffineu8( const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - const float* __restrict nPos, - const float* __restrict nAffine, - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvTransformAffineu8_v2)( nImage,imageWidth,imageHeight,imageWidth, - nPos, nAffine, - nPatch, patchWidth, patchHeight, patchWidth ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffineu8_v2( const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const float* __restrict nPos, - const float* __restrict nAffine, - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ) - -{ - imageStride = (imageStride==0 ? imageWidth : imageStride); - patchStride = (patchStride==0 ? patchWidth : patchStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment - - fcvAssert( (imageStride >= imageWidth) ); // Stride is at least as much as width - fcvAssert( (patchStride >= patchWidth) ); // Stride is at least as much as width -#endif - - return (**ppfcvTransformAffineu8_v2)( nImage, imageWidth, imageHeight, imageStride, - nPos, nAffine, - nPatch, patchWidth, patchHeight, patchStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvCopyRotated17x17u8( const uint8_t* __restrict region, - uint8_t* __restrict patch, - int nOri ) -{ - (**ppfcvCopyRotated17x17u8)( region, patch, nOri ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9Scoreu8_v3)( src, width, height, stride, barrier,border, xy, scores, - maxnumcorners, numcorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 );// 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9InMaskScoreu8_v3)( src, width, height, stride, barrier, border, xy, scores, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - stride = (stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL)); - fcvAssert( stride >= width ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast9Scoreu8_v4)( src, width, height, stride, barrier,border, xy, scores, - maxnumcorners, numcorners, nmsEnabled, tempBuf ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - stride = (stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL) && (bitMask != NULL)); - fcvAssert( stride >= width ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bitMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast9InMaskScoreu8_v4)( src, width, height, stride, barrier, border, xy, scores, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight, nmsEnabled, tempBuf ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL)); - fcvAssert( srcStride >= srcWidth ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - (**ppfcvCornerFast10Scoreu8)( src, srcWidth, srcHeight, srcStride, barrier,border, xy, scores, - nCornersMax, nCorners, nmsEnabled, tempBuf ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL) && (mask != NULL) ); - fcvAssert( srcStride >= srcWidth ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast10InMaskScoreu8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, scores, - nCornersMax, nCorners, - mask, maskWidth, maskHeight, nmsEnabled, tempBuf ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int width, - int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*featureXY) == 4 ); - fcvAssert( sizeof(*featureXY_out) == 4 ); - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY_out & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureStatus & 0xF) == 0 ); // 128-bit alignment - #ifndef NDEBUG - int div = (1 << (nPyramidLevels - 1)) - 1; - fcvAssert( ( (width & div) == 0 ) & ( (height & div) == 0 ) ); //width and height multiples of 2^(nPyramidLevels-1) - #endif -#endif - - (**ppfcvTrackLKOpticalFlowu8)( src1, src2, width, height, - src1Pyr, scr2Pyr, - dx1Pyr, dy1Pyr, - featureXY, featureXY_out, - featureStatus, featureLen, - windowWidth, windowHeight, - maxIterations, nPyramidLevels, - maxResidue, minDisplacement, - minEigenvalue, lightingNormalized); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *src2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*featureXY) == 4 ); - fcvAssert( sizeof(*featureXY_out) == 4 ); - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY_out & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureStatus & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvTrackLKOpticalFlowf32)( src1, src2, width, height, - src1Pyr, src2Pyr, - dx1Pyr,dy1Pyr, - featureXY, featureXY_out, - featureStatus, featureLen, windowWidth, windowHeight, - maxIterations, nPyramidLevels, maxResidue, - minDisplacement, minEigenvalue, - lightingNormalized ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidCreatef32( const float* __restrict base, unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, fcvPyramidLevel* pyramid ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)base & 0xF) == 0 ); // 128-bit alignment - #ifndef NDEBUG - int div = (1 << (numLevels - 1)) - 1; - #endif - fcvAssert( sizeof(*base) == 4 ); - fcvAssert( ( (baseWidth & div) == 0 ) & ( (baseHeight & div) == 0 ) ); -#endif - - return (**ppfcvPyramidCreatef32)( base, baseWidth, baseHeight,numLevels, pyramid ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidCreateu8( const uint8_t* __restrict base, unsigned int baseWidth, unsigned int baseHeight, - unsigned int numLevels, fcvPyramidLevel * pyramid ) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - #ifndef NDEBUG - int div = (1 << (numLevels - 1)) - 1; - #endif - fcvAssert( ( (baseWidth & div) == 0 ) & ( (baseHeight & div) == 0 ) ); -#endif - return (**ppfcvPyramidCreateu8)( base, baseWidth, baseHeight,numLevels, pyramid ); - -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvPyramidAllocate( fcvPyramidLevel* pyr, unsigned int baseWidth, - unsigned int baseHeight, unsigned int bytesPerPixel, - unsigned int numLevels, int allocateBase ) -{ - - return (**ppfcvPyramidAllocate)(pyr,baseWidth,baseHeight,bytesPerPixel,numLevels,allocateBase); - -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvPyramidDelete( fcvPyramidLevel * pyr, unsigned int numLevels, unsigned int startLevel ) -{ - - (**ppfcvPyramidDelete)(pyr,numLevels,startLevel); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatei16)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatei8 ( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatei8)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatef32 ( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatef32)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCountu8( const uint8_t* __restrict src, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvBitCountu8)( src, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvBitCount32x1u8)( src ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvBitCount32x4u8( const uint8_t* __restrict A, const uint8_t* __restrict B, - const uint8_t* __restrict C, const uint8_t* __restrict D, - uint32_t* __restrict count ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)count & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvBitCount32x4u8)( A, B, C, D, count ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvBitCount64x1u8)( src ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvBitCount64x4u8( const uint8_t* __restrict A, const uint8_t* __restrict B, - const uint8_t* __restrict C, const uint8_t* __restrict D, - uint32_t* __restrict count ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)count & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvBitCount64x4u8)( A, B, C, D, count ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCountu32( const uint32_t* __restrict src, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvBitCountu32)( src, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistanceu8)( a, b, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistance32x1u8a4)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)b & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvHammingDistance64x1u8a4)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistance32x1u8)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)b & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvHammingDistance64x1u8)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)E & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance32x4u8a4)( A, B, C, D, E, distances ); -} - - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)E & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance64x4u8a4)( A, B, C, D, E, distances ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance64x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)E & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance64x4u8)( A, B, C, D, E, distances ); -} - -inline void fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int pointsArraySize, - unsigned int* __restrict pointsArray - ) - -{ - (**ppfcvMseru8)(mserHandle,srcPtr,srcWidth,srcHeight,srcStride - ,maxContours,numContours,numPointsInContour,pointsArraySize,pointsArray); -} - -inline void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ) -{ - (**ppfcvMserExtu8)(mserHandle,srcPtr,srcWidth,srcHeight,srcStride,maxContours, numContours, numPointsInContour, - pointsArray,pointsArraySize,contourVariation,contourPolarity,contourNodeId, contourNodeCounter); -} - -inline int fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle ) -{ - return (*ppfcvMserInit)(width,height,delta,minArea,maxArea,maxVariation, minDiversity, mserHandle); -} - -inline void fcvMserRelease(void *mserHandle) -{ - (**ppfcvMserRelease)(mserHandle); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((static_cast(reinterpret_cast(src1))) & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((static_cast(reinterpret_cast(src1))) & 0xF) == 0 ); // 128-bit alignment - fcvAssert( numMv != NULL ); // NULL Check - fcvAssert( locX != NULL ); // NULL Check - fcvAssert( locY != NULL ); // NULL Check - fcvAssert( mvX != NULL ); // NULL Check - fcvAssert( mvY != NULL ); // NULL Check -#endif - - return (**ppfcvTrackBMOpticalFlow16x16u8)( src1, src2, srcWidth, srcHeight, srcStride, - roiLeft, roiTop, roiRight, roiBottom, shiftSize, - searchWidth, searchHeight, searchStep, usePrevious, - numMv, locX, locY, mvX, mvY ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void fcvBoundingRectangle (const uint32_t * __restrict xy, uint32_t numPoints, - uint32_t * rectTopLeftX, uint32_t * rectTopLeftY, - uint32_t * rectWidth, uint32_t *rectHeight) -{ - (**ppfcvBoundingRectangle)(xy,numPoints,rectTopLeftX, rectTopLeftY, rectWidth, rectHeight); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleVerticalu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleVerticalu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleHorizontalu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleHorizontalu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsample2Du8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsample2Du8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleVerticalInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleVerticalInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleHorizontalInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleHorizontalInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsample2DInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsample2DInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToRGB888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToRGB888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToRGBA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToRGBA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToRGB565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToRGB565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToRGBA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToRGBA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToRGB565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToRGB565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToRGB888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToRGB888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToLABu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToLABu8)(src, srcWidth, srcHeight, srcStride, dst, dstStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr422Planaru8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr420Planaru8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr444Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr420Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr444Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr422Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvEdgeWeightings16( int16_t* __restrict edgeMap, - const uint32_t edgeMapWidth, - const uint32_t edgeMapHeight, - const uint32_t edgeMapStride, - const uint32_t weight, - const uint32_t edge_limit, - const uint32_t hl_threshold, - const uint32_t hh_threshold, - const uint32_t edge_denoise_factor ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)edgeMap & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( edgeMapStride == 0 && (edgeMapWidth & 0x7) == 0 ) || (edgeMapStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvEdgeWeightings16)( edgeMap, edgeMapWidth, edgeMapHeight, edgeMapStride, - weight, edge_limit, hl_threshold, hh_threshold, edge_denoise_factor ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDeinterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst0, - uint32_t dst0Stride, - uint8_t* __restrict dst1, - uint32_t dst1Stride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst0 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dst0Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dst1Stride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDeinterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst0, dst0Stride, dst1, dst1Stride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvInterleaveu8( const uint8_t* __restrict src0, - const uint8_t* __restrict src1, - uint32_t imageWidth, - uint32_t imageHeight, - uint32_t src0Stride, - uint32_t src1Stride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src0 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (imageWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (src0Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (src1Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvInterleaveu8)( src0, src1, imageWidth, imageHeight, - src0Stride, src1Stride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHarrTransposeu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDWTHaarTransposeu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHaarTransposeu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWTHaarTransposeu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWT53TabTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWT53TabTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWT53TabTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWT53TabTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHarrTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIDWTHaarTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHaarTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWTHaarTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHaaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWTHaaru8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWT53Tabs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWT53Tabs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWT53Tabs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWT53Tabs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHaars16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWTHaars16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDCTu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDCTu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDCTs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDCTs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpPolyu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpPolyu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpPolyInterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpPolyInterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownMNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleDownMNu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownMNInterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleDownMNInterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline uint32_t -fcvKMeansTreeSearch36x10s8( const int8_t* __restrict nodeChildrenCenter, - const uint32_t* __restrict nodeChildrenInvLenQ32, - const uint32_t* __restrict nodeChildrenIndex, - const uint8_t* __restrict nodeNumChildren, - uint32_t numNodes, - const int8_t* __restrict key ) -{ - return (**ppfcvKMeansTreeSearch36x10s8)( nodeChildrenCenter, - nodeChildrenInvLenQ32, - nodeChildrenIndex, - nodeNumChildren, - numNodes, - key ); - -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondencSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ) -{ - return (**ppfcvLinearSearch8x36s8)( dbLUT, - numDBLUT, - descDB, - descDBInvLenQ38, - descDBTargetId, - numDescDB, - srcDesc, - srcDescInvLenQ38, - srcDescIdx, - numSrcDesc, - targetsToIgnore, - numTargetsToIgnore, - maxDistanceQ31, - correspondenceDBIdx, - correspondencSrcDescIdx, - correspondenceDistanceQ31, - maxNumCorrespondences, - numCorrespondences ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvLinearSearchPrepare8x36s8( - uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict idxLUT, - uint32_t numDescDB ) -{ - return (**ppfcvLinearSearchPrepare8x36s8_v2)( dbLUT, - numDBLUT, - descDB, - descDBInvLenQ38, - descDBTargetId, - idxLUT, - numDescDB ); -} - - -inline void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursExternalu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ) -{ - return(**ppfcvFindContoursListu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours, - numContourPoints,contourStartPoints,pointBuffer,pointBufferSize,contourHandle); -} - -inline void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursCcompu8) (src,srcWidth,srcHeight,srcStride,maxNumContours,numContours, - holeFlag,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursTreeu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours,holeFlag,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void* -fcvFindContoursAllocate( uint32_t srcStride ) -{ - return(**ppfcvFindContoursAllocate) (srcStride); -} - -inline void -fcvFindContoursDelete( void* contourHandle ) -{ - (**ppfcvFindContoursDelete) ( contourHandle ); -} - - -inline void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x) -{ - return(**ppfcvSolvef32)(A,numCols,numRows,b,x); - -} - -inline void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ) - -{ - (**ppfcvGetPerspectiveTransformf32)(src1,src2,transformCoefficient); - -} -inline void -fcvSetElementsu8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsu8)( src, srcWidth, srcHeight, srcStride, value, mask, maskStride ); -} - -inline void -fcvSetElementss32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ) -{ - (**ppfcvSetElementss32)( src, srcWidth, srcHeight, srcStride, value, mask , maskStride); - -} - -inline void -fcvSetElementsf32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsf32)( src, srcWidth, srcHeight, srcStride, value, mask, maskStride); - -} - -inline void -fcvSetElementsc4u8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4u8)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); - -} - -inline void -fcvSetElementsc4s32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4s32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); -} - -inline void -fcvSetElementsc4f32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4f32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); -} - -inline void -fcvSetElementsc3u8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - return (**ppfcvSetElementsc3u8)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); - -} - -inline void -fcvSetElementsc3s32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc3s32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); -} - -inline void -fcvSetElementsc3f32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc3f32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); -} - - - - -inline void -fcvAdaptiveThresholdGaussian3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian3x3u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} -inline void -fcvAdaptiveThresholdGaussian5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian5x5u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdGaussian11x11u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian11x11u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdMean3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean3x3u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); - -} - -inline void -fcvAdaptiveThresholdMean5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean5x5u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdMean11x11u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean11x11u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvBoxFilter3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (*ppfcvBoxFilter3x3u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); - -} - - -inline void -fcvBoxFilter5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (*ppfcvBoxFilter5x5u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); - -} - - -inline void -fcvBoxFilter11x11u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBoxFilter11x11u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvBilateralFilter5x5u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBilateralFilter5x5u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvBilateralFilter7x7u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - - (**ppfcvBilateralFilter7x7u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvBilateralFilter9x9u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBilateralFilter9x9u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvSegmentFGMasku8(uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t Polygonal, - uint32_t perimScale) -{ - (**ppfcvSegmentFGMasku8)(src,srcWidth,srcHeight,srcStride,Polygonal,perimScale); -} - - -inline void -fcvAbsDiffu8(const uint8_t * __restrict src1, - const uint8_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (uint8_t) : dstStride); - - - (*ppfcvAbsDiffu8)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvAbsDiffs32(const int32_t * __restrict src1, - const int32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (int32_t) : dstStride); - - (*ppfcvAbsDiffs32)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvAbsDifff32(const float32_t * __restrict src1, - const float32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (float32_t) : dstStride); - - (*ppfcvAbsDifff32)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVu8(const uint8_t * __restrict src, - uint8_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (uint8_t) : dstStride); - - (**ppfcvAbsDiffVu8)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVs32(const int32_t * __restrict src, - int32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (int32_t) : dstStride); - - (**ppfcvAbsDiffVs32)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVf32(const float32_t * __restrict src, - float32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (float32_t) : dstStride); - - (**ppfcvAbsDiffVf32)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVc4u8(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*4*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (uint8_t) : dstStride); - - (*ppfcvAbsDiffVc4u8)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVc4s32(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth*4*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (int32_t) : dstStride); - - (*ppfcvAbsDiffVc4s32)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc4f32(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride) -{ - - srcStride = (srcStride==0 ? srcWidth*4*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (float32_t) : dstStride); - - (*ppfcvAbsDiffVc4f32)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3u8(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (uint8_t) : dstStride); - - (**ppfcvAbsDiffVc3u8)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3s32(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (int32_t) : dstStride); - - (**ppfcvAbsDiffVc3s32)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3f32(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (float32_t) : dstStride); - - (**ppfcvAbsDiffVc3f32)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeCreate36s8f32( const int8_t* __restrict vectors, - const float32_t* __restrict invLengths, - int numVectors, - fcvKDTreeDatas8f32** kdtrees ) -{ - return (**ppfcvKDTreeCreate36s8f32)(vectors, invLengths, numVectors, kdtrees ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeDestroy36s8f32( fcvKDTreeDatas8f32* kdtrees ) -{ - return (**ppfcvKDTreeDestroy36s8f32) ( kdtrees ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeQuery36s8f32( fcvKDTreeDatas8f32* kdtrees, - const int8_t* __restrict query, - float32_t queryInvLen, - int maxNNs, - float32_t maxDist, - int maxChecks, - const uint8_t* __restrict mask, - int32_t* numNNsFound, - int32_t* __restrict NNInds, - float32_t* __restrict NNDists ) -{ - return (**ppfcvKDTreeQuery36s8f32) ( kdtrees, query, queryInvLen, maxNNs, - maxDist, maxChecks, mask, numNNsFound, - NNInds, NNDists ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvBitwiseOru8 -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -) -{ - return (**ppfcvBitwiseOru8) ( src1, src2, srcWidth, srcHeight, - srcStride, dst, dstStride, mask, - maskStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvBitwiseOrs32 -( - const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -) -{ - return (**ppfcvBitwiseOrs32) ( src1, src2, srcWidth, srcHeight, - srcStride, dst, dstStride, mask, - maskStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvColorRGB888ToGrayu8 -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvColorRGB888ToGrayu8) ( src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvTiltedIntegralu8s32 -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvTiltedIntegralu8s32) ( src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvConvValids16 -( - const int16_t* __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int16_t* __restrict src2, - uint32_t src2Width, - uint32_t src2Height, - uint32_t src2Stride, - int32_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvConvValids16) ( src1, src1Width, src1Height, src1Stride, - src2, src2Width, src2Height, src2Stride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride) -{ - srcYStride=(srcYStride==0 ? srcWidth : srcYStride); - srcCStride=(srcCStride==0 ? srcWidth : srcCStride); - integralYStride=(integralYStride==0 ? (srcWidth+8)*sizeof(uint32_t) : integralYStride); - integralCbStride=(integralCbStride==0 ? ((srcWidth>>1)+8) *sizeof(uint32_t) : integralCbStride); - integralCrStride=(integralCrStride==0 ? ((srcWidth>>1)+8) *sizeof(uint32_t) : integralCrStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0xF) == 0 ); // multiple of 16 - fcvAssert( (srcYStride & 0xF) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0xF) == 0 ); // multiple of 8 - fcvAssert( (integralYStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (integralCbStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (integralCrStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (srcYStride >= srcWidth) ); // at least as much as width - fcvAssert( (srcCStride >= srcWidth>>1) ); // at least as much as width - fcvAssert( (integralYStride >= srcWidth*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) - fcvAssert( (integralCbStride >= srcWidth>>1*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) - fcvAssert( (integralCrStride >= srcWidth>>1*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvIntegrateImageYCbCr420PseudoPlanaru8)(srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - integralY, integralCb, integralCr, integralYStride, integralCbStride, integralCrStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t *__restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ) -{ - srcYStride=(srcYStride==0 ? (srcWidth+8)*sizeof(uint32_t) : srcYStride); - srcCbStride=(srcCbStride==0 ? ((srcWidth>>1)+8)*sizeof(uint32_t) : srcCbStride); - srcCrStride=(srcCrStride==0 ? ((srcWidth>>1)+8)*sizeof(uint32_t) : srcCrStride); - outputMaskStride=(outputMaskStride==0 ? outputWidth : outputMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)outputMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0xF) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (outputMaskStride & 0x7) == 0 ); // multiple of 8 (8 values) - fcvAssert( (srcYStride >= srcWidth*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (srcCbStride >= srcWidth>>1*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (srcCrStride >= srcWidth>>1*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (outputMaskStride >= (uint32_t)outputWidth)); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvFindForegroundIntegrateImageYCbCr420u32)(bgIntegralY, bgIntegralCb, bgIntegralCr, fgIntegralY, fgIntegralCb, fgIntegralCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - outputMask, outputWidth, outputHeight, outputMaskStride, threshold); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFloodfillSimpleu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - uint32_t xBegin, - uint32_t yBegin, - uint8_t newVal, //new Val can't be zero. zero is background. - fcvConnectedComponent *cc, - uint8_t connectivity, - void* lineBuffer) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - dstStride=(dstStride==0 ? srcWidth : dstStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)lineBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0xF) == 0 ); // multiple of 16 (8 values) - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= srcWidth) ); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvFloodfillSimpleu8)(src, srcWidth, srcHeight, srcStride, dst, dstStride, xBegin, yBegin, newVal, cc, connectivity, lineBuffer); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpdateMotionHistoryu8s32( - const uint8_t* __restrict src, - uint32_t srcWidth, uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride, - int32_t timeStamp, - int32_t maxHistory) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - dstStride=(dstStride==0 ? srcWidth*sizeof(int32_t) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= srcWidth*sizeof(int32_t))); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvUpdateMotionHistoryu8s32)(src, srcWidth, srcHeight, srcStride, dst, dstStride, timeStamp, maxHistory); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue) -{ - srcStride=(srcStride==0 ? srcWidth*sizeof(uint32_t) : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*sizeof(uint32_t)) ); // at least as much as width -#endif - (**ppfcvAverages32)(src, srcWidth, srcHeight, srcStride, avgValue); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - (**ppfcvAverageu8)(src, srcWidth, srcHeight, srcStride, avgValue); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShiftu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - return (**ppfcvMeanShiftu8)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShifts32( const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvMeanShifts32)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShiftf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvMeanShiftf32)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTracku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - return (**ppfcvConAdaTracku8)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTracks32( const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvConAdaTracks32)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTrackf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvConAdaTrackf32)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSVDf32(const float32_t * __restrict A, - uint32_t m, - uint32_t n, - float32_t * __restrict w, - float32_t * __restrict U, - float32_t * __restrict Vt, - float32_t * tmpU, - float32_t * tmpV) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)w & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)U & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)Vt & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpU & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpV & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvSVDf32)(A,m,n,w,U,Vt,tmpU,tmpV); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFillConvexPolyu8( uint32_t nPts, - const uint32_t* __restrict polygon, - uint32_t nChannel, - const uint8_t* __restrict color, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride) -{ - - dstStride = (dstStride==0 ? dstWidth * nChannel : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygon != NULL) && (dst != NULL) && (color != NULL)); - fcvAssert( ((int)(size_t)polygon & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - -#endif - (**ppfcvFillConvexPolyu8)(nPts, polygon, nChannel, color, dst, dstWidth, dstHeight, dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvPointPolygonTest(uint32_t nPts, - const uint32_t* __restrict polygonContour, - uint32_t px, - uint32_t py, - float32_t* distance, - int16_t* resultFlag) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygonContour != NULL) && (nPts >= 2) ); - fcvAssert( ((int)(size_t)polygonContour & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvPointPolygonTest)(nPts, polygonContour, px, py, distance, resultFlag); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void fcvFindConvexHull( uint32_t* __restrict polygonContour, - uint32_t nPtsContour, - uint32_t* __restrict convexHull, - uint32_t* nPtsHull, - uint32_t* __restrict tmpBuff) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygonContour != NULL) && (convexHull != NULL) && (tmpBuff != NULL)); - fcvAssert( ((int)(size_t)polygonContour & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)convexHull & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpBuff & 0xF) == 0 ); // 128-bit alignment - fcvAssert( nPtsContour>0 ); // non negative number of input points -#endif - - (**ppfcvFindConvexHull)(polygonContour,nPtsContour,convexHull,nPtsHull,tmpBuff); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvSolveCholeskyf32( float32_t *__restrict A, - const float32_t *__restrict b, - float32_t *__restrict diag, - uint32_t N, - float32_t *__restrict x) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (A != NULL) && (b != NULL) ); - fcvAssert( (diag != NULL) && (x != NULL) ); - fcvAssert( ((int)(size_t)A & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)b & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)diag & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)x & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvSolveCholeskyf32)(A, b, diag, N, x); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void - fcvGeomUndistortPoint2x1f32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - float32_t* __restrict xyCamera) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvGeomUndistortPoint2x1f32)(cameraCalibration, - xyDevice, - xyCamera); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomUndistortPoint2xNf32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyCamera, - uint32_t dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - (**ppfcvGeomUndistortPoint2xNf32)(cameraCalibration,xyDevice,srcStride,xySize,xyCamera,dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void - fcvGeomDistortPoint2x1f32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvGeomDistortPoint2x1f32)(cameraCalibration, - xyCamera, - xyDevice); -} - -inline void -fcvGeomDistortPoint2xNf32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyDevice, - uint32_t dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - (**ppfcvGeomDistortPoint2xNf32)(cameraCalibration,xyCamera,srcStride,xySize,xyDevice,dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int32_t - fcvGeomProjectPoint3x1f32(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (pose != NULL) && (xyz != NULL) ); - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvGeomProjectPoint3x1f32)(pose, cameraCalibration, xyz, xyCamera, xyDevice); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomProjectPoint3xNf32(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - uint32_t srcStride, - uint32_t xyzSize, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice, - uint32_t dstStride, - uint32_t* inFront) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (pose != NULL) && (cameraCalibration != NULL)); - fcvAssert( (xyz != NULL) && (xyCamera != NULL) && (xyDevice != NULL) && (inFront != NULL)); - fcvAssert( ((int)(size_t)pose & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyz & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvGeomProjectPoint3xNf32)(pose,cameraCalibration,xyz,srcStride,xyzSize,xyCamera,xyDevice,dstStride,inFront); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvRemapRGBA8888NNu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t *__restrict mapX, - const float32_t *__restrict mapY, - uint32_t mapStride) -{ - srcStride = (srcStride==0 ? srcWidth*4 : srcStride); - dstStride = (dstStride==0 ? dstWidth*4 : dstStride); - mapStride = (mapStride==0 ? dstWidth*sizeof(float32_t) : mapStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (dst!=NULL) && (mapX!=NULL) && (mapY!=NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (mapStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4(4 channels) - fcvAssert( (dstStride >= dstWidth*4) ); // at least as much as width*4(4 channels) - fcvAssert( (mapStride >= (dstWidth*sizeof(float32_t))) ); //at least as much as dstWidth*4 (float) -#endif - - return (**ppfcvRemapRGBA8888NNu8)(src, srcWidth, srcHeight, srcStride, dst, - dstWidth, dstHeight, dstStride, mapX, mapY, mapStride); -} - -//---------------------------------------------------------------------------------------- -//---------------------------------------------------------------------------------------- -inline void -fcvRemapRGBA8888BLu8 ( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t *__restrict mapX, - const float32_t *__restrict mapY, - uint32_t mapStride ) -{ - srcStride = (srcStride==0 ? srcWidth*4 : srcStride); - dstStride = (dstStride==0 ? dstWidth*4 : dstStride); - mapStride = (mapStride==0 ? dstWidth*sizeof(float32_t) : mapStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (dst!=NULL) && (mapX!=NULL) && (mapY!=NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (mapStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width *4 ( 4 channels) - fcvAssert( (dstStride >= dstWidth*4) ); // at least as much as width *4 (4 channels) - fcvAssert( (mapStride >= (dstWidth*sizeof(float32_t))) ); //at least as much as dstWidth *4 (float ) -#endif - - return (**ppfcvRemapRGBA8888BLu8)(src, srcWidth, srcHeight, srcStride, dst, - dstWidth, dstHeight, dstStride, mapX, mapY, mapStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvJacobianSE2f32(const uint8_t* __restrict warpedImage, - const uint16_t *__restrict warpedBorder, - const uint8_t *__restrict targetImage, - const int16_t *__restrict targetDX, - const int16_t *__restrict targetDY, - uint32_t width, - uint32_t height, - uint32_t stride, - float32_t *__restrict sumJTJ, - float32_t *__restrict sumJTE, - float32_t *__restrict sumError, - uint32_t *__restrict numPixels) -{ - stride=(stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)warpedImage & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetImage & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)warpedBorder & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetDX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetDY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)sumJTJ & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride >= width) ); // at least as much as width -#endif - - (**ppfcvJacobianSE2f32)(warpedImage, warpedBorder, targetImage, targetDX, - targetDY, width, height, stride, sumJTJ, sumJTE, - sumError, numPixels); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvTransformAffineClippedu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t *__restrict affineMatrix, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint32_t *__restrict dstBorder) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)affineMatrix & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstBorder & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // at least as much as width -#endif - - (**ppfcvTransformAffineClippedu8)(src, srcWidth, srcHeight, srcStride, - affineMatrix, dst, dstWidth, dstHeight, - dstStride, dstBorder); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline fcvBGCodeWord** - fcvCreateBGCodeBookModel( uint32_t srcWidth, - uint32_t srcHeight, - void** __restrict cbmodel ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - return (**ppfcvCreateBGCodeBookModel) ( srcWidth, srcHeight, cbmodel ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvReleaseBGCodeBookModel( void** cbmodel ) -{ - return (**ppfcvReleaseBGCodeBookModel) ( cbmodel ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookUpdateu8( void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict updateTime ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - fgMaskStride = (fgMaskStride==0 ? srcWidth : fgMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= 3*srcWidth) ); // Stride is at least 3 times of Width. Input image must have 3 channels. - fcvAssert( (fgMaskStride >= srcWidth) ); // Stride is at least as much as Width -#endif - return (**ppfcvBGCodeBookUpdateu8) ( cbmodel, src, srcWidth, srcHeight, srcStride, fgMask, fgMaskStride, cbMap, updateTime ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookDiffu8( void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict numFgMask ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - fgMaskStride = (fgMaskStride==0 ? srcWidth : fgMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= 3*srcWidth) ); // Stride is at least 3 times of Width. Input image must have 3 channels. - fcvAssert( (fgMaskStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvBGCodeBookDiffu8) ( cbmodel, src, srcWidth, srcHeight, srcStride, fgMask, fgMaskStride, cbMap, numFgMask); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookClearStaleu8( void* __restrict cbmodel, - int32_t staleThresh, - const uint8_t* __restrict fgMask, - uint32_t fgMaskWidth, - uint32_t fgMaskHeight, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap ) -{ - fgMaskStride = (fgMaskStride==0 ? fgMaskWidth : fgMaskStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (fgMaskWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride >= fgMaskWidth) ); // Stride is at least as much as Width -#endif - return (**ppfcvBGCodeBookClearStaleu8) ( cbmodel, staleThresh, fgMask, fgMaskWidth, fgMaskHeight, fgMaskStride, cbMap); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvHoughCircleu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvCircle *circles, - uint32_t* numCircle, - uint32_t maxCircle, - uint32_t minDist, - uint32_t cannyThreshold, - uint32_t accThreshold, - uint32_t minRadius, - uint32_t maxRadius, - void *data) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)data & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - (**ppfcvHoughCircleu8)(src, srcWidth, srcHeight, srcStride, circles, numCircle, maxCircle, minDist, cannyThreshold, accThreshold, minRadius, maxRadius, data); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContouru8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t color, - uint8_t hole_color) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContouru8) (src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, color, hole_color); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContourInterleavedu8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContourInterleavedu8)( src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, colorR, colorG, colorB, hole_colorR, hole_colorG, hole_colorB); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContourPlanaru8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContourPlanaru8)( src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, colorR, colorG, colorB, hole_colorR, hole_colorG, hole_colorB); -} diff --git a/phonelibs/fastcv/x64/include/stdint_.h b/phonelibs/fastcv/x64/include/stdint_.h deleted file mode 100755 index d02608a597..0000000000 --- a/phonelibs/fastcv/x64/include/stdint_.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/phonelibs/fastcv/x64/lib/libfastcv.a b/phonelibs/fastcv/x64/lib/libfastcv.a deleted file mode 100755 index 6d33d734e5..0000000000 Binary files a/phonelibs/fastcv/x64/lib/libfastcv.a and /dev/null differ diff --git a/phonelibs/install_capnp.sh b/phonelibs/install_capnp.sh deleted file mode 100755 index 6de661c8dd..0000000000 --- a/phonelibs/install_capnp.sh +++ /dev/null @@ -1,27 +0,0 @@ -set -e -echo "Installing capnp" - -cd /tmp -VERSION=0.6.1 -wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz -tar xvf capnproto-c++-${VERSION}.tar.gz -cd capnproto-c++-${VERSION} -CXXFLAGS="-fPIC" ./configure - -make -j4 -make install - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -cp .libs/capnp /usr/local/bin/ -rm /usr/local/bin/capnpc -ln -s /usr/local/bin/capnp /usr/local/bin/capnpc -cp .libs/capnpc-c++ /usr/local/bin/ -cp .libs/capnpc-capnp /usr/local/bin/ -cp .libs/*.a /usr/local/lib - diff --git a/phonelibs/zmq/.gitignore b/phonelibs/zmq/.gitignore deleted file mode 100644 index 7858a5f019..0000000000 --- a/phonelibs/zmq/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -czmq -libzmq diff --git a/phonelibs/zmq/aarch64-linux/bin/curve_keygen b/phonelibs/zmq/aarch64-linux/bin/curve_keygen deleted file mode 100755 index 3d76817f73..0000000000 Binary files a/phonelibs/zmq/aarch64-linux/bin/curve_keygen and /dev/null differ diff --git a/phonelibs/zmq/aarch64-linux/include/czmq.h b/phonelibs/zmq/aarch64-linux/include/czmq.h deleted file mode 100644 index dbf1fe5e40..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/czmq.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= - - "Tell them I was a writer. - A maker of software. - A humanist. A father. - And many things. - But above all, a writer. - Thank You. :) - - Pieter Hintjens -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/czmq_library.h b/phonelibs/zmq/aarch64-linux/include/czmq_library.h deleted file mode 100644 index 89dc4eb917..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/czmq_library.h +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 4 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 2 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -# define CZMQ_PRIVATE -#else -# define CZMQ_EXPORT -# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden"))) -# else -# define CZMQ_PRIVATE -# endif -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h b/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h deleted file mode 100644 index 534f47023c..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h +++ /dev/null @@ -1,647 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0600) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -// Note that (at least in Solaris) while rand() returns an int limited by -// RAND_MAX, random() returns a 32-bit value all filled with random bits. -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# if defined(RAND_MAX) -# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0)) -# else -# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0)) -# endif -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC) -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zactor.h b/phonelibs/zmq/aarch64-linux/include/zactor.h deleted file mode 100644 index c865c65daf..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zarmour.h b/phonelibs/zmq/aarch64-linux/include/zarmour.h deleted file mode 100644 index c7f299f7af..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zauth.h b/phonelibs/zmq/aarch64-linux/include/zauth.h deleted file mode 100644 index 3e0e59ecab..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or more addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zbeacon.h b/phonelibs/zmq/aarch64-linux/include/zbeacon.h deleted file mode 100644 index 78917e9577..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zcert.h b/phonelibs/zmq/aarch64-linux/include/zcert.h deleted file mode 100644 index 3161bc0596..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zcert.h +++ /dev/null @@ -1,128 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zcertstore.h b/phonelibs/zmq/aarch64-linux/include/zcertstore.h deleted file mode 100644 index 689b228ac1..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zcertstore.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zchunk.h b/phonelibs/zmq/aarch64-linux/include/zchunk.h deleted file mode 100644 index 56f29b161a..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/aarch64-linux/include/zclock.h b/phonelibs/zmq/aarch64-linux/include/zclock.h deleted file mode 100644 index eb064162c4..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zconfig.h b/phonelibs/zmq/aarch64-linux/include/zconfig.h deleted file mode 100644 index df0c708493..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zconfig.h +++ /dev/null @@ -1,185 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdigest.h b/phonelibs/zmq/aarch64-linux/include/zdigest.h deleted file mode 100644 index def9e86053..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdir.h b/phonelibs/zmq/aarch64-linux/include/zdir.h deleted file mode 100644 index 6c5551b57e..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdir_patch.h b/phonelibs/zmq/aarch64-linux/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb4..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zfile.h b/phonelibs/zmq/aarch64-linux/include/zfile.h deleted file mode 100644 index 75c35774b9..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/aarch64-linux/include/zframe.h b/phonelibs/zmq/aarch64-linux/include/zframe.h deleted file mode 100644 index 728093c36c..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zgossip.h b/phonelibs/zmq/aarch64-linux/include/zgossip.h deleted file mode 100644 index 647cb28c08..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zhash.h b/phonelibs/zmq/aarch64-linux/include/zhash.h deleted file mode 100644 index 138adf63ac..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zhash.h +++ /dev/null @@ -1,182 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zhashx.h b/phonelibs/zmq/aarch64-linux/include/zhashx.h deleted file mode 100644 index 360a773ee8..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zhashx.h +++ /dev/null @@ -1,277 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/ziflist.h b/phonelibs/zmq/aarch64-linux/include/ziflist.h deleted file mode 100644 index cb2b144802..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zlist.h b/phonelibs/zmq/aarch64-linux/include/zlist.h deleted file mode 100644 index 1dcd39b995..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zlistx.h b/phonelibs/zmq/aarch64-linux/include/zlistx.h deleted file mode 100644 index 512637cef3..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zloop.h b/phonelibs/zmq/aarch64-linux/include/zloop.h deleted file mode 100644 index 83f46f282a..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zloop.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmonitor.h b/phonelibs/zmq/aarch64-linux/include/zmonitor.h deleted file mode 100644 index b490bcb1a0..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmq.h b/phonelibs/zmq/aarch64-linux/include/zmq.h deleted file mode 100644 index 21a78eb657..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zmq.h +++ /dev/null @@ -1,643 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 2 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - -// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it -// defines compatibility macros for them. Need to include that header first to -// stop build failures since zmq_pollset_t defines them as events and revents. -#ifdef ZMQ_HAVE_AIX - #include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer - * alignment and raise sigbus on violations. Make sure applications allocate - * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. - */ -typedef struct zmq_msg_t { -#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ - (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); -#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) - __declspec (align (8)) unsigned char _ [64]; -#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) - __declspec (align (4)) unsigned char _ [64]; -#else - unsigned char _ [64]; -#endif -} zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT 0MQ socket events and monitoring */ -#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 -#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 - -/* DRAFT Context options */ -#define ZMQ_MSG_T_SIZE 6 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); -ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmq_utils.h b/phonelibs/zmq/aarch64-linux/include/zmq_utils.h deleted file mode 100644 index f29638d553..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmsg.h b/phonelibs/zmq/aarch64-linux/include/zmsg.h deleted file mode 100644 index d8a84d1f41..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zmsg.h +++ /dev/null @@ -1,280 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zpoller.h b/phonelibs/zmq/aarch64-linux/include/zpoller.h deleted file mode 100644 index 3b394c3516..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zpoller.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/aarch64-linux/include/zproxy.h b/phonelibs/zmq/aarch64-linux/include/zproxy.h deleted file mode 100644 index f672c5e724..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zrex.h b/phonelibs/zmq/aarch64-linux/include/zrex.h deleted file mode 100644 index 8b50618a34..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zsock.h b/phonelibs/zmq/aarch64-linux/include/zsock.h deleted file mode 100644 index 9ab060d6a3..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zsock.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32-octet binary -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef CZMQ_BUILD_DRAFT_API -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); -#endif // CZMQ_BUILD_DRAFT_API - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zstr.h b/phonelibs/zmq/aarch64-linux/include/zstr.h deleted file mode 100644 index 67f2f852b6..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zstr.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zsys.h b/phonelibs/zmq/aarch64-linux/include/zsys.h deleted file mode 100644 index 200271d924..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zsys.h +++ /dev/null @@ -1,395 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent. -// The default is INT_MAX. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zuuid.h b/phonelibs/zmq/aarch64-linux/include/zuuid.h deleted file mode 100644 index afc1104fea..0000000000 --- a/phonelibs/zmq/aarch64-linux/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.a b/phonelibs/zmq/aarch64-linux/lib/libczmq.a deleted file mode 100644 index ba2b0a3ca6..0000000000 Binary files a/phonelibs/zmq/aarch64-linux/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.la b/phonelibs/zmq/aarch64-linux/lib/libczmq.la deleted file mode 100755 index 81ef66bdbb..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libczmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libczmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libczmq.so.4' - -# Names of this library. -library_names='libczmq.so.4.0.2 libczmq.so.4 libczmq.so' - -# The name of the static archive. -old_library='libczmq.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -L/home/nvidia/build/zmq/lib /home/nvidia/build/zmq/lib/libzmq.la -lrt -lpthread -ldl -luuid' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libczmq. -current=4 -age=0 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/nvidia/build/zmq/lib' diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so b/phonelibs/zmq/aarch64-linux/lib/libczmq.so deleted file mode 120000 index db9aa60f9b..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libczmq.so +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 deleted file mode 120000 index db9aa60f9b..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 deleted file mode 100755 index bb9c2d52eb..0000000000 Binary files a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 and /dev/null differ diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.a b/phonelibs/zmq/aarch64-linux/lib/libzmq.a deleted file mode 100644 index b6bd2ab734..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libzmq.a +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0f7c6db2f4cbd86282f952cc64a570416220e5c7bc4dff96e3a436a778b59730 -size 27918754 diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.la b/phonelibs/zmq/aarch64-linux/lib/libzmq.la deleted file mode 100755 index 2aef5c45d0..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libzmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/nvidia/build/zmq/lib' diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so b/phonelibs/zmq/aarch64-linux/lib/libzmq.so deleted file mode 120000 index ef44cafc6a..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libzmq.so +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 deleted file mode 120000 index ef44cafc6a..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 deleted file mode 100755 index e96750a8ef..0000000000 Binary files a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 and /dev/null differ diff --git a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc deleted file mode 100644 index 7740eec8c0..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - -prefix=/home/nvidia/build/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libczmq -Description: The high-level C binding for 0MQ -Version: 4.0.2 - -Requires:libzmq - -Libs: -L${libdir} -lczmq -Cflags: -I${includedir} -Libs.private: -lzmq -luuid - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ diff --git a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc deleted file mode 100644 index 885271757d..0000000000 --- a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/home/nvidia/build/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libzmq -Description: 0MQ c++ library -Version: 4.2.2 -Libs: -L${libdir} -lzmq -Libs.private: -lstdc++ -Cflags: -I${includedir} diff --git a/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 b/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 deleted file mode 100644 index 7a702496b8..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmakecert -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMAKECERT" "1" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmakecert \- no title found -.SH "SYNOPSIS" -.sp -.nf -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Please add \fI@header\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zmakecert_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 deleted file mode 100644 index 481edc396e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 +++ /dev/null @@ -1,127 +0,0 @@ -'\" t -.\" Title: zactor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZACTOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zactor \- simple actor framework -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference\&. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor\&. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent\&. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor\&. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t\&. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference\&. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value\&. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor\*(Aqs zsock handle\&. Use this when you absolutely need -// to work with the zsock instance rather than the actor\&. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zactor_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zactor\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zactor class provides a simple actor framework\&. It replaces the CZMQ zthread class, which had a complex API that did not fit the CLASS standard\&. A CZMQ actor is implemented as a thread plus a PAIR\-PAIR pipe\&. The constructor and destructor are always synchronized, so the caller can be sure all resources are created, and destroyed, when these calls complete\&. (This solves a major problem with zthread, that a caller could not be sure when a child thread had finished\&.) -.sp -A zactor_t instance acts like a zsock_t and you can pass it to any CZMQ method that would take a zsock_t argument, including methods in zframe, zmsg, zstr, and zpoller\&. (zloop somehow escaped and needs catching\&.) -.sp -An actor function MUST call zsock_signal (pipe) when initialized and MUST listen to pipe and exit on $TERM command\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zactor\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zactor_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zactor_t *actor = zactor_new (echo_actor, "Hello, World"); -assert (actor); -zstr_sendx (actor, "ECHO", "This is a string", NULL); -char *string = zstr_recv (actor); -assert (streq (string, "This is a string")); -free (string); -zactor_destroy (&actor); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 deleted file mode 100644 index ea80677725..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 +++ /dev/null @@ -1,372 +0,0 @@ -'\" t -.\" Title: zarmour -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZARMOUR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zarmour \- armoured text encoding and decoding -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string\&. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk\&. The decoded output is -// null\-terminated, so it may be treated as a string, if that\*(Aqs what -// it was prior to encoding\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property\&. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode\&. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property\&. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on\&. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off\&. Default is on\&. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character\&. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character\&. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on\&. Default is off\&. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off\&. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines\&. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines\&. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zarmour\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zarmour \- armoured text encoding and decoding -.sp -The zarmour class implements encoding and decoding of armoured text data\&. The following codecs are implemented: * RFC 4648 (\m[blue]\fBhttp://www\&.ietf\&.org/rfc/rfc4648\&.txt\fR\m[]) \- base64 \- base64url \- base32 \- base32hex \- base16 * Z85 (\m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]) All RFC4648 base64 and base32 variants support padding the output\&. The pad character is configurable\&. Default is padding on, with character \fI=\fR\&. Additionally, in some cases (e\&.g\&. MIME), splitting the output into lines of a specific length is required\&. This feature is also supported, though turned off by default\&. The z85 mode does neither padding nor line breaks; it is merely a wrapping of the corresponding libzmq methods\&. Encoding will assert if input length is not divisible by 4 and decoding will assert if input length is not divisible by 5\&. -.SH "EXAMPLE" -.PP -\fBFrom zarmour_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zarmour_t *self = zarmour_new (); -assert (self); - -int mode = zarmour_mode (self); -assert (mode == ZARMOUR_MODE_BASE64_STD); - -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -mode = zarmour_mode (self); -assert (mode == ZARMOUR_MODE_BASE64_URL); - -assert (zarmour_pad (self)); -zarmour_set_pad (self, false); -assert (!zarmour_pad (self)); - -assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); -zarmour_set_pad_char (self, \*(Aq!\*(Aq); -assert (zarmour_pad_char (self) == \*(Aq!\*(Aq); -zarmour_set_pad_char (self, \*(Aq=\*(Aq); -assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); - -assert (!zarmour_line_breaks (self)); -zarmour_set_line_breaks (self, true); -assert (zarmour_line_breaks (self)); - -assert (zarmour_line_length (self) == 72); -zarmour_set_line_length (self, 64); -assert (zarmour_line_length (self) == 64); - -// Test against test vectors from RFC4648\&. -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg", verbose); -s_armour_test (self, "fo", "Zm8", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg", verbose); -s_armour_test (self, "fooba", "Zm9vYmE", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg==", verbose); -s_armour_test (self, "fo", "Zm8=", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg==", verbose); -s_armour_test (self, "fooba", "Zm9vYmE=", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg", verbose); -s_armour_test (self, "fo", "Zm8", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg", verbose); -s_armour_test (self, "fooba", "Zm9vYmE", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "Zg==", verbose); -s_armour_test (self, "fo", "Zm8=", verbose); -s_armour_test (self, "foo", "Zm9v", verbose); -s_armour_test (self, "foob", "Zm9vYg==", verbose); -s_armour_test (self, "fooba", "Zm9vYmE=", verbose); -s_armour_test (self, "foobar", "Zm9vYmFy", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "MY", verbose); -s_armour_test (self, "fo", "MZXQ", verbose); -s_armour_test (self, "foo", "MZXW6", verbose); -s_armour_test (self, "foob", "MZXW6YQ", verbose); -s_armour_test (self, "fooba", "MZXW6YTB", verbose); -s_armour_test (self, "foobar", "MZXW6YTBOI", verbose); -s_armour_decode (self, "my", "f", verbose); -s_armour_decode (self, "mzxq", "fo", verbose); -s_armour_decode (self, "mzxw6", "foo", verbose); -s_armour_decode (self, "mzxw6yq", "foob", verbose); -s_armour_decode (self, "mzxw6ytb", "fooba", verbose); -s_armour_decode (self, "mzxw6ytboi", "foobar", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "MY======", verbose); -s_armour_test (self, "fo", "MZXQ====", verbose); -s_armour_test (self, "foo", "MZXW6===", verbose); -s_armour_test (self, "foob", "MZXW6YQ=", verbose); -s_armour_test (self, "fooba", "MZXW6YTB", verbose); -s_armour_test (self, "foobar", "MZXW6YTBOI======", verbose); -s_armour_decode (self, "my======", "f", verbose); -s_armour_decode (self, "mzxq====", "fo", verbose); -s_armour_decode (self, "mzxw6===", "foo", verbose); -s_armour_decode (self, "mzxw6yq=", "foob", verbose); -s_armour_decode (self, "mzxw6ytb", "fooba", verbose); -s_armour_decode (self, "mzxw6ytboi======", "foobar", verbose); - -zarmour_set_pad (self, false); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "CO", verbose); -s_armour_test (self, "fo", "CPNG", verbose); -s_armour_test (self, "foo", "CPNMU", verbose); -s_armour_test (self, "foob", "CPNMUOG", verbose); -s_armour_test (self, "fooba", "CPNMUOJ1", verbose); -s_armour_test (self, "foobar", "CPNMUOJ1E8", verbose); -s_armour_decode (self, "co", "f", verbose); -s_armour_decode (self, "cpng", "fo", verbose); -s_armour_decode (self, "cpnmu", "foo", verbose); -s_armour_decode (self, "cpnmuog", "foob", verbose); -s_armour_decode (self, "cpnmuoj1", "fooba", verbose); -s_armour_decode (self, "cpnmuoj1e8", "foobar", verbose); -zarmour_set_pad (self, true); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "CO======", verbose); -s_armour_test (self, "fo", "CPNG====", verbose); -s_armour_test (self, "foo", "CPNMU===", verbose); -s_armour_test (self, "foob", "CPNMUOG=", verbose); -s_armour_test (self, "fooba", "CPNMUOJ1", verbose); -s_armour_test (self, "foobar", "CPNMUOJ1E8======", verbose); -s_armour_decode (self, "co======", "f", verbose); -s_armour_decode (self, "cpng====", "fo", verbose); -s_armour_decode (self, "cpnmu===", "foo", verbose); -s_armour_decode (self, "cpnmuog=", "foob", verbose); -s_armour_decode (self, "cpnmuoj1", "fooba", verbose); -s_armour_decode (self, "cpnmuoj1e8======", "foobar", verbose); -zarmour_set_pad (self, true); - -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "f", "66", verbose); -s_armour_test (self, "fo", "666F", verbose); -s_armour_test (self, "foo", "666F6F", verbose); -s_armour_test (self, "foob", "666F6F62", verbose); -s_armour_test (self, "fooba", "666F6F6261", verbose); -s_armour_test (self, "foobar", "666F6F626172", verbose); -s_armour_decode (self, "666f", "fo", verbose); -s_armour_decode (self, "666f6f", "foo", verbose); -s_armour_decode (self, "666f6f62", "foob", verbose); -s_armour_decode (self, "666f6f6261", "fooba", verbose); -s_armour_decode (self, "666f6f626172", "foobar", verbose); - -#ifdef _INCLUDE_Z85 -// Z85 test is homemade; using 0, 4 and 8 bytes, with precalculated -// test vectors created with a libzmq test\&. -// \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- - -// Make a fake curve key from hex (base16) string, making sure -// there are no null bytes inside, so we can use our test utility -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -zarmour_set_line_breaks (self, false); - -zchunk_t *chunk = zarmour_decode (self, - "4E6F87E2FB6EB22A1EF5E257B75D79124949565F0B8B36A878A4F03111C96E0B"); -assert (chunk); - -zarmour_set_mode (self, ZARMOUR_MODE_Z85); // Z85 mode does not support padding or line breaks -zarmour_set_pad (self, false); // so these two are superfluous; -zarmour_set_line_breaks (self, false); // just for consistency -if (verbose) - zarmour_print (self); - -s_armour_test (self, "", "", verbose); -s_armour_test (self, "foob", "w]zP%", verbose); -s_armour_test (self, "foobar!!", "w]zP%vr9Im", verbose); -s_armour_test (self, (char *) zchunk_data (chunk), - "ph+{E}!&X?9}!I]W{sm(nL8@&3Yu{wC+<*\-5Y[[#", verbose); -zchunk_destroy (&chunk); -#endif - -// Armouring longer byte array to test line breaks -zarmour_set_pad (self, true); -zarmour_set_line_breaks (self, true); -byte test_data [256]; -int index; -for (index = 0; index < 256; index++) - test_data [index] = index; - -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); -s_armour_test_long (self, test_data, 256, verbose); -zarmour_set_mode (self, ZARMOUR_MODE_BASE16); -s_armour_test_long (self, test_data, 256, verbose); -#ifdef _INCLUDE_Z85 -zarmour_set_mode (self, ZARMOUR_MODE_Z85); -s_armour_test_long (self, test_data, 256, verbose); -#endif - -zarmour_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 deleted file mode 100644 index b119d13e9a..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 +++ /dev/null @@ -1,309 +0,0 @@ -'\" t -.\" Title: zauth -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZAUTH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zauth \- authentication for ZeroMQ security mechanisms -.SH "SYNOPSIS" -.sp -.nf -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated)\&. -// -// Create new zauth actor instance\&. This installs authentication on all -// zsock sockets\&. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance\&. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command\&. -// -// Enable verbose logging of commands and activity\&. Verbose logging can help -// debug non\-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses\&. For NULL, all clients from -// these addresses will be accepted\&. For PLAIN and CURVE, they will be -// allowed to continue with authentication\&. You can call this method -// multiple times to whitelist more IP addresses\&. If you whitelist one -// or more addresses, any non\-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", "127\&.0\&.0\&.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses\&. For all security mechanisms, -// this rejects the connection without any further authentication\&. Use -// either a whitelist, or a blacklist, not not both\&. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192\&.168\&.0\&.1", "192\&.168\&.0\&.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain\-text password file\&. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i\&.e\&. their public keys\&. The certificates must be in -// zcert_save format\&. You can add and remove certificates in that directory -// at any time\&. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zauth\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -A zauth actor takes over authentication for all incoming connections in its context\&. You can whitelist or blacklist peers based on IP address, and define policies for securing PLAIN, CURVE, and GSSAPI connections\&. -.sp -This class replaces zauth_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zauth_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zauth" -zsys_dir_create (TESTDIR); - -// Check there\*(Aqs no authentication -zsock_t *server = zsock_new (ZMQ_PULL); -assert (server); -zsock_t *client = zsock_new (ZMQ_PUSH); -assert (client); -bool success = s_can_connect (&server, &client, true); -assert (success); - -// Install the authenticator -zactor_t *auth = zactor_new (zauth, NULL); -assert (auth); -if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); -} -// Check there\*(Aqs no authentication on a default NULL server -success = s_can_connect (&server, &client, true); -assert (success); - -// When we set a domain on the server, we switch on authentication -// for NULL sockets, but with no policies, the client connection -// will be allowed\&. -zsock_set_zap_domain (server, "global"); -success = s_can_connect (&server, &client, true); -assert (success); - -// Blacklist 127\&.0\&.0\&.1, connection should fail -zsock_set_zap_domain (server, "global"); -zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (!success); - -// Whitelist our address, which overrides the blacklist -zsock_set_zap_domain (server, "global"); -zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (success); - -// Try PLAIN authentication -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Password"); -success = s_can_connect (&server, &client, true); -assert (!success); - -FILE *password = fopen (TESTDIR "/password\-file", "w"); -assert (password); -fprintf (password, "admin=Password\en"); -fclose (password); -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Password"); -zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); -zsock_wait (auth); -success = s_can_connect (&server, &client, true); -assert (success); - -zsock_set_plain_server (server, 1); -zsock_set_plain_username (client, "admin"); -zsock_set_plain_password (client, "Bogus"); -success = s_can_connect (&server, &client, true); -assert (!success); - -if (zsys_has_curve ()) { - // Try CURVE authentication - // We\*(Aqll create two new certificates and save the client public - // certificate on disk; in a real case we\*(Aqd transfer this securely - // from the client machine to the server machine\&. - zcert_t *server_cert = zcert_new (); - assert (server_cert); - zcert_t *client_cert = zcert_new (); - assert (client_cert); - const char *server_key = zcert_public_txt (server_cert); - - // Test without setting\-up any authentication - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - success = s_can_connect (&server, &client, true); - assert (!success); - - // Test CURVE_ALLOW_ANY - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); - zsock_wait (auth); - success = s_can_connect (&server, &client, true); - assert (success); - - // Test full client authentication using certificates - zcert_set_meta (client_cert, "Hello", "%s", "World!"); - zcert_apply (server_cert, server); - zcert_apply (client_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, server_key); - zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); - zstr_sendx (auth, "CURVE", TESTDIR, NULL); - zsock_wait (auth); - success = s_can_connect (&server, &client, false); - assert (success); - -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) - // Test send/recv certificate metadata - zframe_t *frame = zframe_recv (server); - assert (frame != NULL); - const char *meta = zframe_meta (frame, "Hello"); - assert (meta != NULL); - assert (streq (meta, "World!")); - zframe_destroy (&frame); - s_renew_sockets(&server, &client); -#endif - - zcert_destroy (&server_cert); - zcert_destroy (&client_cert); - - // Test custom zcertstore - zcertstore_t *certstore = zcertstore_new (NULL); - zcertstore_set_loader (certstore, s_test_loader, NULL, NULL); - zactor_destroy(&auth); - auth = zactor_new (zauth, certstore); - assert (auth); - if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); - } - - byte public_key [32] = { 105, 76, 150, 58, 214, 191, 218, 65, 50, 172, - 131, 188, 247, 211, 136, 170, 227, 26, 57, 170, - 185, 63, 246, 225, 177, 230, 12, 8, 134, 136, - 105, 106 }; - byte secret_key [32] = { 245, 217, 172, 73, 106, 28, 195, 17, 218, 132, - 135, 209, 99, 240, 98, 232, 7, 137, 244, 100, - 242, 23, 29, 114, 70, 223, 83, 1, 113, 207, - 132, 149 }; - zcert_t *shared_cert = zcert_new_from (public_key, secret_key); - assert (shared_cert); - zcert_apply (shared_cert, server); - zcert_apply (shared_cert, client); - zsock_set_curve_server (server, 1); - zsock_set_curve_serverkey (client, "x?T*N/1Y{8goubv{Ts}#&#f}TXJ//DVe#D2HkoLU"); - success = s_can_connect (&server, &client, true); - assert (success); - zcert_destroy (&shared_cert); -} -// Remove the authenticator and check a normal connection works -zactor_destroy (&auth); -success = s_can_connect (&server, &client, true); -assert (success); - -zsock_destroy (&client); -zsock_destroy (&server); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 deleted file mode 100644 index 40e3abbac4..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 +++ /dev/null @@ -1,236 +0,0 @@ -'\" t -.\" Title: zbeacon -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZBEACON" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zbeacon \- LAN discovery and presence -.SH "SYNOPSIS" -.sp -.nf -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections\&. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon\&. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: \*(Aqs\*(Aq = C string, \*(Aqi\*(Aq = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec\&. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys\&.h to be 255: -// -// // Pictures: \*(Aqb\*(Aq = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers\&. The filter is used to do a prefix -// match on received beacons, to remove junk\&. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case\&. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer\&. Received beacons are always a 2\-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zbeacon\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zbeacon class implements a peer\-to\-peer discovery service for local networks\&. A beacon can broadcast and/or capture service announcements using UDP messages on the local area network\&. This implementation uses IPv4 UDP broadcasts\&. You can define the format of your outgoing beacons, and set a filter that validates incoming beacons\&. Beacons are sent and received asynchronously in the background\&. -.sp -This class replaces zbeacon_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zbeacon_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Test 1 \- two beacons, one speaking, one listening -// Create speaker beacon to broadcast our service -zactor_t *speaker = zactor_new (zbeacon, NULL); -assert (speaker); -if (verbose) - zstr_sendx (speaker, "VERBOSE", NULL); - -zsock_send (speaker, "si", "CONFIGURE", 9999); -char *hostname = zstr_recv (speaker); -if (!*hostname) { - printf ("OK (skipping test, no UDP broadcasting)\en"); - zactor_destroy (&speaker); - free (hostname); - return; -} -free (hostname); - -// Create listener beacon on port 9999 to lookup service -zactor_t *listener = zactor_new (zbeacon, NULL); -assert (listener); -if (verbose) - zstr_sendx (listener, "VERBOSE", NULL); -zsock_send (listener, "si", "CONFIGURE", 9999); -hostname = zstr_recv (listener); -assert (*hostname); -free (hostname); - -// We will broadcast the magic value 0xCAFE -byte announcement [2] = { 0xCA, 0xFE }; -zsock_send (speaker, "sbi", "PUBLISH", announcement, 2, 100); -// We will listen to anything (empty subscription) -zsock_send (listener, "sb", "SUBSCRIBE", "", 0); - -// Wait for at most 1/2 second if there\*(Aqs no broadcasting -zsock_set_rcvtimeo (listener, 500); -char *ipaddress = zstr_recv (listener); -if (ipaddress) { - zframe_t *content = zframe_recv (listener); - assert (zframe_size (content) == 2); - assert (zframe_data (content) [0] == 0xCA); - assert (zframe_data (content) [1] == 0xFE); - zframe_destroy (&content); - zstr_free (&ipaddress); - zstr_sendx (speaker, "SILENCE", NULL); -} -zactor_destroy (&listener); -zactor_destroy (&speaker); - -// Test subscription filter using a 3\-node setup -zactor_t *node1 = zactor_new (zbeacon, NULL); -assert (node1); -zsock_send (node1, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node1); -assert (*hostname); -free (hostname); - -zactor_t *node2 = zactor_new (zbeacon, NULL); -assert (node2); -zsock_send (node2, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node2); -assert (*hostname); -free (hostname); - -zactor_t *node3 = zactor_new (zbeacon, NULL); -assert (node3); -zsock_send (node3, "si", "CONFIGURE", 5670); -hostname = zstr_recv (node3); -assert (*hostname); -free (hostname); - -zsock_send (node1, "sbi", "PUBLISH", "NODE/1", 6, 250); -zsock_send (node2, "sbi", "PUBLISH", "NODE/2", 6, 250); -zsock_send (node3, "sbi", "PUBLISH", "RANDOM", 6, 250); -zsock_send (node1, "sb", "SUBSCRIBE", "NODE", 4); - -// Poll on three API sockets at once -zpoller_t *poller = zpoller_new (node1, node2, node3, NULL); -assert (poller); -int64_t stop_at = zclock_mono () + 1000; -while (zclock_mono () < stop_at) { - long timeout = (long) (stop_at \- zclock_mono ()); - if (timeout < 0) - timeout = 0; - void *which = zpoller_wait (poller, timeout * ZMQ_POLL_MSEC); - if (which) { - assert (which == node1); - char *ipaddress, *received; - zstr_recvx (node1, &ipaddress, &received, NULL); - assert (streq (received, "NODE/2")); - zstr_free (&ipaddress); - zstr_free (&received); - } -} -zpoller_destroy (&poller); - -// Stop listening -zstr_sendx (node1, "UNSUBSCRIBE", NULL); - -// Stop all node broadcasts -zstr_sendx (node1, "SILENCE", NULL); -zstr_sendx (node2, "SILENCE", NULL); -zstr_sendx (node3, "SILENCE", NULL); - -// Destroy the test nodes -zactor_destroy (&node1); -zactor_destroy (&node2); -zactor_destroy (&node3); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 deleted file mode 100644 index e2c81dbf10..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 +++ /dev/null @@ -1,215 +0,0 @@ -'\" t -.\" Title: zcert -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCERT" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zcert \- work with CURVE security certificates -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32\-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32\-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string\&. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, \&.\&.\&.) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn\*(Aqt -// exist, returns NULL\&. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate\&. Caller is responsible for -// destroying list\&. Caller should not modify the values of list items\&. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret")\&. -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i\&.e\&. use for CURVE security on socket\&. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully\&. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata\&. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcert\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zcert class provides a way to create and work with security certificates for the ZMQ CURVE mechanism\&. A certificate contains a public + secret key pair, plus metadata\&. It can be used as a temporary object in memory, or persisted to disk\&. On disk, a certificate is stored as two files\&. One is public and contains only the public key\&. The second is secret and contains both keys\&. The two have the same filename, with the secret file adding "_secret"\&. To exchange certificates, send the public file via some secure route\&. Certificates are not signed but are text files that can be verified by eye\&. -.sp -Certificates are stored in the ZPL (ZMQ RFC 4) format\&. They have two sections, "metadata" and "curve"\&. The first contains a list of \fIname = value\fR pairs, one per line\&. Values may be enclosed in quotes\&. The curve section has a \fIpublic\-key = keyvalue\fR and, for secret certificates, a \fIsecret\-key = keyvalue\fR line\&. The keyvalue is a Z85\-encoded CURVE key\&. -.SH "EXAMPLE" -.PP -\fBFrom zcert_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zcert" -zsys_dir_create (TESTDIR); - -// Create a simple certificate with metadata -zcert_t *cert = zcert_new (); -assert (cert); -zcert_set_meta (cert, "email", "ph@imatix\&.com"); -zcert_set_meta (cert, "name", "Pieter Hintjens"); -zcert_set_meta (cert, "organization", "iMatix Corporation"); -zcert_set_meta (cert, "version", "%d", 1); -zcert_set_meta (cert, "delete_me", "now"); -zcert_unset_meta (cert, "delete_me"); -assert (streq (zcert_meta (cert, "email"), "ph@imatix\&.com")); -zlist_t *keys = zcert_meta_keys (cert); -assert (zlist_size (keys) == 4); -zlist_destroy (&keys); - -// Check the dup and eq methods -zcert_t *shadow = zcert_dup (cert); -assert (zcert_eq (cert, shadow)); -zcert_destroy (&shadow); - -// Check we can save and load certificate -zcert_save (cert, TESTDIR "/mycert\&.txt"); -assert (zsys_file_exists (TESTDIR "/mycert\&.txt")); -assert (zsys_file_exists (TESTDIR "/mycert\&.txt_secret")); - -// Load certificate, will in fact load secret one -shadow = zcert_load (TESTDIR "/mycert\&.txt"); -assert (shadow); -assert (zcert_eq (cert, shadow)); -zcert_destroy (&shadow); - -// Delete secret certificate, load public one -int rc = zsys_file_delete (TESTDIR "/mycert\&.txt_secret"); -assert (rc == 0); -shadow = zcert_load (TESTDIR "/mycert\&.txt"); - -// 32\-byte null key encodes as 40 \*(Aq0\*(Aq characters -assert (streq (zcert_secret_txt (shadow), FORTY_ZEROES)); - -zcert_destroy (&shadow); -zcert_destroy (&cert); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 deleted file mode 100644 index 5b76f253db..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 +++ /dev/null @@ -1,173 +0,0 @@ -'\" t -.\" Title: zcertstore -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCERTSTORE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zcertstore \- work with CURVE security certificate stores -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location\&. The directory itself may be -// absent, and created later, or modified at any time\&. The certificate store -// is automatically refreshed on any zcertstore_lookup() call\&. If the -// location is specified as NULL, creates a pure\-memory store, which you -// can work with by inserting certificates at runtime\&. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory\&. Does not affect anything -// stored on disk\&. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL\&. The public key is provided in Z85 text format\&. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory\&. Note that this -// does not save the certificate to disk\&. To do that, use zcert_save() -// directly on the certificate\&. Takes ownership of zcert_t object\&. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source\&. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state\&. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn\&. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable\&. This wrapper exists to be friendly to bindings, -// which don\*(Aqt usually have access to struct internals\&. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcertstore\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -To authenticate new clients using the ZeroMQ CURVE security mechanism, we have to check that the client\(cqs public key matches a key we know and accept\&. There are numerous ways to store accepted client public keys\&. The mechanism CZMQ implements is "certificates" (plain text files) held in a "certificate store" (a disk directory)\&. This class works with such certificate stores, and lets you easily load them from disk, and check if a given client public key is known or not\&. The zcert class does the work of managing a single certificate\&. -.sp -The certificate store can be memory\-only, in which case you can load it yourself by inserting certificate objects one by one, or it can be loaded from disk, in which case you can add, modify, or remove certificates on disk at any time, and the store will detect such changes and refresh itself automatically\&. In most applications you won\(cqt use this class directly but through the zauth class, which provides a high\-level API for authentication (and manages certificate stores for you)\&. To actually create certificates on disk, use the zcert class in code, or the tools/zmakecert\&.c command line tool, or any text editor\&. The format of a certificate file is defined in the zcert man page\&. -.SH "EXAMPLE" -.PP -\fBFrom zcertstore_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zcertstore" -zsys_dir_create (TESTDIR); - -// Load certificate store from disk; it will be empty -zcertstore_t *certstore = zcertstore_new (TESTDIR); -assert (certstore); - -// Create a single new certificate and save to disk -zcert_t *cert = zcert_new (); -assert (cert); -char *client_key = strdup (zcert_public_txt (cert)); -assert (client_key); -zcert_set_meta (cert, "name", "John Doe"); -zcert_save (cert, TESTDIR "/mycert\&.txt"); -zcert_destroy (&cert); - -// Check that certificate store refreshes as expected -cert = zcertstore_lookup (certstore, client_key); -assert (cert); -assert (streq (zcert_meta (cert, "name"), "John Doe")); - -// Test custom loader -test_loader_state *state = (test_loader_state *) zmalloc (sizeof (test_loader_state)); -state\->index = 0; -zcertstore_set_loader (certstore, s_test_loader, s_test_destructor, (void *)state); -#if (ZMQ_VERSION_MAJOR >= 4) -cert = zcertstore_lookup (certstore, client_key); -assert (cert == NULL); -cert = zcertstore_lookup (certstore, "abcdefghijklmnopqrstuvwxyzabcdefghijklmn"); -assert (cert); -#endif - -free (client_key); - -if (verbose) - zcertstore_print (certstore); -zcertstore_destroy (&certstore); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 deleted file mode 100644 index 5b5d437860..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 +++ /dev/null @@ -1,266 +0,0 @@ -'\" t -.\" Title: zchunk -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCHUNK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zchunk \- work with memory chunks -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new chunk of the specified size\&. If you specify the data, it -// is copied into the chunk\&. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append\&. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user\-supplied data; truncate if too large\&. Data may -// be null\&. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user\-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user\-supplied data to chunk, return resulting chunk size\&. If the -// data would exceeded the available space, it is truncated\&. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method\&. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user\-supplied data to chunk, return resulting chunk size\&. If the -// data would exceeded the available space, the chunk grows in size\&. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from \*(Aqsource\*(Aq into the chunk as possible; returns the -// new size of chunk\&. If all data from \*(Aqsource\*(Aq is used, returns exhausted -// on the source chunk\&. Source can be consumed as many times as needed until -// it is exhausted\&. If source was already exhausted, does not change chunk\&. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero\&. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk\&. Will read up to maxsize of -// the file\&. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory\&. Returns a new -// chunk containing the file data, or NULL if the file could not be read\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object\&. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory\&. If chunk is null, -// returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string\&. Caller must free -// string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class\&. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing\&. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing\&. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t\&. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zchunk\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zchunk class works with variable sized blobs\&. Not as efficient as ZeroMQ\(cqs messages but they do less weirdness and so are easier to understand\&. The chunk class has methods to read and write chunks from disk\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zchunk\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zchunk_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zchunk_t *chunk = zchunk_new ("1234567890", 10); -assert (chunk); -assert (zchunk_size (chunk) == 10); -assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); -zchunk_destroy (&chunk); - -chunk = zchunk_new (NULL, 10); -assert (chunk); -zchunk_append (chunk, "12345678", 8); -zchunk_append (chunk, "90ABCDEF", 8); -zchunk_append (chunk, "GHIJKLMN", 8); -assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); -assert (zchunk_size (chunk) == 10); -assert (zchunk_streq (chunk, "1234567890")); -assert (streq (zchunk_digest (chunk), "01B307ACBA4F54F55AAFC33BB06BBBF6CA803E9A")); -char *string = zchunk_strdup (chunk); -assert (streq (string, "1234567890")); -free (string); -string = zchunk_strhex (chunk); -assert (streq (string, "31323334353637383930")); -free (string); - -zframe_t *frame = zchunk_pack (chunk); -assert (frame); - -zchunk_t *chunk2 = zchunk_unpack (frame); -assert (chunk2); -assert (memcmp (zchunk_data (chunk2), "1234567890", 10) == 0); -zframe_destroy (&frame); -zchunk_destroy (&chunk2); - -zchunk_t *copy = zchunk_dup (chunk); -assert (copy); -assert (memcmp (zchunk_data (copy), "1234567890", 10) == 0); -assert (zchunk_size (copy) == 10); -zchunk_destroy (©); -zchunk_destroy (&chunk); - -chunk = zchunk_new (NULL, 0); -zchunk_extend (chunk, "12345678", 8); -zchunk_extend (chunk, "90ABCDEF", 8); -zchunk_extend (chunk, "GHIJKLMN", 8); -assert (zchunk_size (chunk) == 24); -assert (zchunk_streq (chunk, "1234567890ABCDEFGHIJKLMN")); -zchunk_destroy (&chunk); - -copy = zchunk_new ("1234567890abcdefghij", 20); -assert (copy); -chunk = zchunk_new (NULL, 8); -assert (chunk); -zchunk_consume (chunk, copy); -assert (!zchunk_exhausted (copy)); -assert (memcmp (zchunk_data (chunk), "12345678", 8) == 0); -zchunk_set (chunk, NULL, 0); -zchunk_consume (chunk, copy); -assert (!zchunk_exhausted (copy)); -assert (memcmp (zchunk_data (chunk), "90abcdef", 8) == 0); -zchunk_set (chunk, NULL, 0); -zchunk_consume (chunk, copy); -assert (zchunk_exhausted (copy)); -assert (zchunk_size (chunk) == 4); -assert (memcmp (zchunk_data (chunk), "ghij", 4) == 0); -zchunk_destroy (©); -zchunk_destroy (&chunk); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 deleted file mode 100644 index 10691d17aa..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 +++ /dev/null @@ -1,116 +0,0 @@ -'\" t -.\" Title: zclock -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCLOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zclock \- millisecond clocks and delays -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds\&. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets\&. Use zclock_mono for that instead\&. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds\&. Use this when you compute -// time offsets\&. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock\&. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds\&. Use this when you compute -// time offsets\&. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock\&. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string\&. Free using zstr_free()\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class\&. -CZMQ_EXPORT void - zclock_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zclock\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zclock class provides essential sleep and system time functions, used to slow down threads for testing, and calculate timers for polling\&. Wraps the non\-portable system calls in a simple portable API\&. -.sp -The Win32 Sleep() call defaults to 16ms resolution unless the system timer resolution is increased with a call to timeBeginPeriod() permitting 1ms granularity\&. -.SH "EXAMPLE" -.PP -\fBFrom zclock_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int64_t start = zclock_time (); -zclock_sleep (10); -assert ((zclock_time () \- start) >= 10); -start = zclock_mono (); -int64_t usecs = zclock_usecs (); -zclock_sleep (10); -assert ((zclock_mono () \- start) >= 10); -assert ((zclock_usecs () \- usecs) >= 10000); -char *timestr = zclock_timestr (); -if (verbose) - puts (timestr); -free (timestr); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 deleted file mode 100644 index 5cd00c9707..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 +++ /dev/null @@ -1,342 +0,0 @@ -'\" t -.\" Title: zconfig -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZCONFIG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zconfig \- work with config files written in rfc\&.zeromq\&.org/spec:4/ZPL\&. -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable\&. Returns NULL -// if the file does not exist\&. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename\&. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value\&. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, \&.\&.\&.) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored\&. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item\&. The new value may be a string, a printf -// format, or NULL\&. Note that if string may possibly contain \*(Aq%\*(Aq, or if it -// comes from an insecure source, you must use \*(Aq%s\*(Aq as the format, followed -// by the string\&. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored\&. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else \-1\&. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk\&. You can add as many -// comment lines as you like\&. If you use a null format, all comments are -// deleted\&. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Return comments of config item, as zlist\&. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "\-" means dump to standard output\&. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename\&. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from\&. -// Returns 0 if OK, \-1 if there was an error (and then does not change -// existing data)\&. -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null\-terminated string -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded\&. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zconfig\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Lets applications load, work with, and save configuration files\&. This implements rfc\&.zeromq\&.org/spec:4/ZPL, which is a simple structured text format for configuration files\&. -.sp -Here is an example ZPL stream and corresponding config structure: -.sp -.if n \{\ -.RS 4 -.\} -.nf -context - iothreads = 1 - verbose = 1 # Ask for a trace -main - type = zqueue # ZMQ_DEVICE type - frontend - option - hwm = 1000 - swap = 25000000 # 25MB - bind = \*(Aqinproc://addr1\*(Aq - bind = \*(Aqipc://addr2\*(Aq - backend - bind = inproc://addr3 -.fi -.if n \{\ -.RE -.\} -.sp -.if n \{\ -.RS 4 -.\} -.nf -root Down = child -| Across = next -v -context\-\->main -| | -| v -| type=queue\-\->frontend\-\->backend -| | | -| | v -| | bind=inproc://addr3 -| v -| option\-\->bind=inproc://addr1\-\->bind=ipc://addr2 -| | -| v -| hwm=1000\-\->swap=25000000 -v -iothreads=1\-\->verbose=false -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBFrom zconfig_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create temporary directory for test files -# define TESTDIR "\&.test_zconfig" -zsys_dir_create (TESTDIR); - -zconfig_t *root = zconfig_new ("root", NULL); -assert (root); -zconfig_t *section, *item; - -section = zconfig_new ("headers", root); -assert (section); -item = zconfig_new ("email", section); -assert (item); -zconfig_set_value (item, "some@random\&.com"); -item = zconfig_new ("name", section); -assert (item); -zconfig_set_value (item, "Justin Kayce"); -zconfig_putf (root, "/curve/secret\-key", "%s", "Top Secret"); -zconfig_set_comment (root, " CURVE certificate"); -zconfig_set_comment (root, " \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-"); -assert (zconfig_comments (root)); -zconfig_save (root, TESTDIR "/test\&.cfg"); -zconfig_destroy (&root); -root = zconfig_load (TESTDIR "/test\&.cfg"); -if (verbose) - zconfig_save (root, "\-"); -assert (streq (zconfig_filename (root), TESTDIR "/test\&.cfg")); - -char *email = zconfig_get (root, "/headers/email", NULL); -assert (email); -assert (streq (email, "some@random\&.com")); -char *passwd = zconfig_get (root, "/curve/secret\-key", NULL); -assert (passwd); -assert (streq (passwd, "Top Secret")); - -zconfig_savef (root, "%s/%s", TESTDIR, "test\&.cfg"); -assert (!zconfig_has_changed (root)); -int rc = zconfig_reload (&root); -assert (rc == 0); -assert (!zconfig_has_changed (root)); -zconfig_destroy (&root); - -// Test chunk load/save -root = zconfig_new ("root", NULL); -assert (root); -section = zconfig_new ("section", root); -assert (section); -item = zconfig_new ("value", section); -assert (item); -zconfig_set_value (item, "somevalue"); -zconfig_t *search = zconfig_locate (root, "section/value"); -assert (search == item); -zchunk_t *chunk = zconfig_chunk_save (root); -assert (strlen ((char *) zchunk_data (chunk)) == 32); -char *string = zconfig_str_save (root); -assert (string); -assert (streq (string, (char *) zchunk_data (chunk))); -free (string); -assert (chunk); -zconfig_destroy (&root); - -root = zconfig_chunk_load (chunk); -assert (root); -char *value = zconfig_get (root, "/section/value", NULL); -assert (value); -assert (streq (value, "somevalue")); - -// Test config can\*(Aqt be saved to a file in a path that doesn\*(Aqt -// exist or isn\*(Aqt writable -rc = zconfig_savef (root, "%s/path/that/doesnt/exist/%s", TESTDIR, "test\&.cfg"); -assert (rc == \-1); - -zconfig_destroy (&root); -zchunk_destroy (&chunk); - -// Delete all test files -zdir_t *dir = zdir_new (TESTDIR, NULL); -assert (dir); -zdir_remove (dir, true); -zdir_destroy (&dir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 deleted file mode 100644 index cabae72d05..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 +++ /dev/null @@ -1,120 +0,0 @@ -'\" t -.\" Title: zdigest -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIGEST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdigest \- provides hashing functions (SHA\-1 at present) -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Constructor \- creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data\&. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data\&. If built without crypto support, -// returns NULL\&. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string\&. After calling this, you may not use zdigest_update() -// on the same digest\&. If built without crypto support, returns NULL\&. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdigest\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdigest class generates a hash from zchunks of data\&. The current algorithm is SHA\-1, chosen for speed\&. We are aiming to generate a unique digest for a file, and there are no security issues in this use case\&. -.sp -The current code depends on OpenSSL, which might be replaced by hard coded SHA\-1 implementation to reduce build dependencies\&. -.SH "EXAMPLE" -.PP -\fBFrom zdigest_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -byte *buffer = (byte *) zmalloc (1024); -memset (buffer, 0xAA, 1024); - -zdigest_t *digest = zdigest_new (); -assert (digest); -zdigest_update (digest, buffer, 1024); -const byte *data = zdigest_data (digest); -assert (data [0] == 0xDE); -assert (data [1] == 0xB2); -assert (data [2] == 0x38); -assert (data [3] == 0x07); -assert (streq (zdigest_string (digest), - "DEB23807D4FE025E900FE9A9C7D8410C3DDE9671")); -zdigest_destroy (&digest); -free (buffer); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 deleted file mode 100644 index 04cbc80542..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 +++ /dev/null @@ -1,287 +0,0 @@ -'\" t -.\" Title: zdir -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdir \- work with file\-system directories -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path\&. If parent is "\-", then -// loads only the top\-level directory, and does not use parent as a path\&. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains\&. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory\&. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree\&. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree\&. Do not destroy the -// original zdir tree until you are done with this list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels\&. If force is false, will only remove the directory if empty\&. -// If force is true, will remove all files and all subdirectories\&. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree\&. -// Returns a list of zdir_patch_t patches\&. Either older or newer may -// be null, indicating the directory is empty/absent\&. If alias is set, -// generates virtual filename (minus path, plus alias)\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA\-1 digests -// of every file in the tree\&. The cache is saved between runs in \&.cache\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data\&. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class\&. -CZMQ_EXPORT void - zdir_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdir class gives access to the file system index\&. It will load a directory tree (a directory plus all child directories) into a zdir structure and then let you navigate that structure\&. It exists mainly to wrap non\-portable OS functions to do this\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zdir_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// need to create a file in the test directory we\*(Aqre watching -// in order to ensure the directory exists -zfile_t *initfile = zfile_new ("\&./zdir\-test\-dir", "initial_file"); -assert (initfile); -zfile_output (initfile); -fprintf (zfile_handle (initfile), "initial file\en"); -zfile_close (initfile); -zfile_destroy (&initfile); - -zdir_t *older = zdir_new ("zdir\-test\-dir", NULL); -assert (older); -if (verbose) { - printf ("\en"); - zdir_dump (older, 0); -} -zdir_t *newer = zdir_new ("\&.", NULL); -assert (newer); -zlist_t *patches = zdir_diff (older, newer, "/"); -assert (patches); -while (zlist_size (patches)) { - zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); - zdir_patch_destroy (&patch); -} -zlist_destroy (&patches); -zdir_destroy (&older); -zdir_destroy (&newer); - -zdir_t *nosuch = zdir_new ("does\-not\-exist", NULL); -assert (nosuch == NULL); - -// zdir_watch test: -zactor_t *watch = zactor_new (zdir_watch, NULL); -assert (watch); - -if (verbose) { - zsock_send (watch, "s", "VERBOSE"); - assert (zsock_wait (watch) == 0); -} - -zclock_sleep (1001); // wait for initial file to become \*(Aqstable\*(Aq - -zsock_send (watch, "si", "TIMEOUT", 100); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "UNSUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); -assert (zsock_wait (watch) == 0); - -zfile_t *newfile = zfile_new ("zdir\-test\-dir", "test_abc"); -zfile_output (newfile); -fprintf (zfile_handle (newfile), "test file\en"); -zfile_close (newfile); - -zpoller_t *watch_poll = zpoller_new (watch, NULL); - -// poll for a certain timeout before giving up and failing the test\&. -assert (zpoller_wait (watch_poll, 1001) == watch); - -// wait for notification of the file being added -char *path; -int rc = zsock_recv (watch, "sp", &path, &patches); -assert (rc == 0); - -assert (streq (path, "zdir\-test\-dir")); -free (path); - -assert (zlist_size (patches) == 1); - -zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); -assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); - -zfile_t *patch_file = zdir_patch_file (patch); -assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); - -zdir_patch_destroy (&patch); -zlist_destroy (&patches); - -// remove the file -zfile_remove (newfile); -zfile_destroy (&newfile); - -// poll for a certain timeout before giving up and failing the test\&. -assert (zpoller_wait (watch_poll, 1001) == watch); - -// wait for notification of the file being removed -rc = zsock_recv (watch, "sp", &path, &patches); -assert (rc == 0); - -assert (streq (path, "zdir\-test\-dir")); -free (path); - -assert (zlist_size (patches) == 1); - -patch = (zdir_patch_t *) zlist_pop (patches); -assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); - -patch_file = zdir_patch_file (patch); -assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); - -zdir_patch_destroy (&patch); -zlist_destroy (&patches); - -zpoller_destroy (&watch_poll); -zactor_destroy (&watch); - -// clean up by removing the test directory\&. -zdir_t *testdir = zdir_new ("zdir\-test\-dir", NULL); -zdir_remove (testdir, true); -zdir_destroy (&testdir); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 deleted file mode 100644 index 61789b32c0..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 +++ /dev/null @@ -1,129 +0,0 @@ -'\" t -.\" Title: zdir_patch -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZDIR_PATCH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zdir_patch \- work with directory patches -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch\&. If the patch is null, or memory was exhausted, -// returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir_patch\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zdir_patch class works with one patch, which says "create this file" or "delete this file" (referring to a zfile item each time)\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir_patch\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zdir_patch_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zfile_t *file = zfile_new ("\&.", "bilbo"); -assert (file); -zdir_patch_t *patch = zdir_patch_new ("\&.", file, patch_create, "/"); -assert (patch); -zfile_destroy (&file); - -file = zdir_patch_file (patch); -assert (file); -assert (streq (zfile_filename (file, "\&."), "bilbo")); -assert (streq (zdir_patch_vpath (patch), "/bilbo")); -zdir_patch_destroy (&patch); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 deleted file mode 100644 index f3b6591812..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 +++ /dev/null @@ -1,340 +0,0 @@ -'\" t -.\" Title: zfile -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZFILE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zfile \- provides methods to work with files in a portable fashion\&. -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// If file exists, populates properties\&. CZMQ supports portable symbolic -// links, which are files with the extension "\&.ln"\&. A symbolic link is a -// text file containing one line, the filename of a target file\&. Reading -// data from the symbolic link actually reads from the target file\&. Path -// may be NULL, in which case it is not used\&. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item\&. If the file -// is null, or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots\&. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified\&. If you want this to reflect the -// current situation, call zfile_restat before checking this property\&. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last\-known size of the file\&. If you want this to reflect the -// current situation, call zfile_restat before checking this property\&. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory\&. If you want this to reflect -// any external changes, call zfile_restat before checking this property\&. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file\&. If you want this to reflect -// any external changes, call zfile_restat before checking this property\&. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process\&. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property\&. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process\&. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property\&. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed\&. -// Updates the file statistics from disk at every call\&. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it\&. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, \-1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location\&. Returns 0 if OK, \-1 if error\&. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position\&. If this was the last chunk, -// sets the eof property\&. Returns a null chunk in case of error\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file\&. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else \-1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file\&. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file\&. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class\&. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// These methods are deprecated, and now moved to zsys class\&. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zfile\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zfile class provides methods to work with disk files\&. A file object provides the modified date, current size, and type of the file\&. You can create a file object for a filename that does not yet exist\&. To read or write data from the file, use the input and output methods, and then read and write chunks\&. The output method lets you both read and write chunks, at any offset\&. Finally, this class provides portable symbolic links\&. If a filename ends in "\&.ln", the first line of text in the file is read, and used as the underlying file for read/write operations\&. This lets you manipulate (e\&.g\&.) copy symbolic links without copying the perhaps very large files they point to\&. -.sp -This class is a new API, deprecating the old zfile class (which still exists but is implemented in zsys now)\&. -.SH "EXAMPLE" -.PP -\fBFrom zfile_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zfile_t *file = zfile_new (NULL, "bilbo"); -assert (file); -assert (streq (zfile_filename (file, "\&."), "bilbo")); -assert (zfile_is_readable (file) == false); -zfile_destroy (&file); - -// Create a test file in some random subdirectory -file = zfile_new ("\&./this/is/a/test", "bilbo"); -assert (file); -int rc = zfile_output (file); -assert (rc == 0); -zchunk_t *chunk = zchunk_new (NULL, 100); -assert (chunk); -zchunk_fill (chunk, 0, 100); - -// Write 100 bytes at position 1,000,000 in the file -rc = zfile_write (file, chunk, 1000000); -assert (rc == 0); -zchunk_destroy (&chunk); -zfile_close (file); -assert (zfile_is_readable (file)); -assert (zfile_cursize (file) == 1000100); -assert (!zfile_is_stable (file)); -assert (zfile_digest (file)); - -// Now truncate file from outside -int handle = open ("\&./this/is/a/test/bilbo", O_WRONLY | O_TRUNC | O_BINARY, 0); -assert (handle >= 0); -rc = write (handle, "Hello, World\en", 13); -assert (rc == 13); -close (handle); -assert (zfile_has_changed (file)); -zclock_sleep (1001); -assert (zfile_has_changed (file)); - -assert (!zfile_is_stable (file)); -zfile_restat (file); -assert (zfile_is_stable (file)); -assert (streq (zfile_digest (file), "4AB299C8AD6ED14F31923DD94F8B5F5CB89DFB54")); - -// Check we can read from file -rc = zfile_input (file); -assert (rc == 0); -chunk = zfile_read (file, 1000100, 0); -assert (chunk); -assert (zchunk_size (chunk) == 13); -zchunk_destroy (&chunk); -zfile_close (file); - -// Check we can read lines from file -rc = zfile_input (file); -assert (rc == 0); -const char *line = zfile_readln (file); -assert (streq (line, "Hello, World")); -line = zfile_readln (file); -assert (line == NULL); -zfile_close (file); - -// Try some fun with symbolic links -zfile_t *link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); -assert (link); -rc = zfile_output (link); -assert (rc == 0); -fprintf (zfile_handle (link), "\&./this/is/a/test/bilbo\en"); -zfile_destroy (&link); - -link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); -assert (link); -rc = zfile_input (link); -assert (rc == 0); -chunk = zfile_read (link, 1000100, 0); -assert (chunk); -assert (zchunk_size (chunk) == 13); -zchunk_destroy (&chunk); -zfile_destroy (&link); - -// Remove file and directory -zdir_t *dir = zdir_new ("\&./this", NULL); -assert (dir); -assert (zdir_cursize (dir) == 26); -zdir_remove (dir, true); -assert (zdir_cursize (dir) == 0); -zdir_destroy (&dir); - -// Check we can no longer read from file -assert (zfile_is_readable (file)); -zfile_restat (file); -assert (!zfile_is_readable (file)); -rc = zfile_input (file); -assert (rc == \-1); -zfile_destroy (&file); - -file = zfile_new ("\&./", "eof_checkfile"); -assert (file); -// 1\&. Write something first -rc = zfile_output (file); -assert (rc == 0); -chunk = zchunk_new ("123456789", 9); -assert (chunk); - -rc = zfile_write (file, chunk, 0); -assert (rc == 0); -zchunk_destroy (&chunk); -zfile_close (file); -assert (zfile_cursize (file) == 9); - -// 2\&. Read the written something -rc = zfile_input (file); -assert (rc != \-1); -// try to read more bytes than there is in the file -chunk = zfile_read (file, 1000, 0); -assert (zfile_eof(file)); -assert (zchunk_streq (chunk, "123456789")); -zchunk_destroy (&chunk); - -// reading is ok -chunk = zfile_read (file, 5, 0); -assert (!zfile_eof(file)); -assert (zchunk_streq (chunk, "12345")); -zchunk_destroy (&chunk); - -// read from non zero offset until the end -chunk = zfile_read (file, 5, 5); -assert (zfile_eof(file)); -assert (zchunk_streq (chunk, "6789")); -zchunk_destroy (&chunk); -zfile_remove (file); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 deleted file mode 100644 index f723dd6105..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 +++ /dev/null @@ -1,357 +0,0 @@ -'\" t -.\" Title: zframe -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZFRAME" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zframe \- working with single message frames -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame\&. If size is not null, allocates the frame data -// to the specified size\&. If additionally, data is not null, copies -// size octets from the specified data into the frame body\&. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero\-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content\&. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted\&. Does a blocking recv, if you want to not block then use -// zpoller or zloop\&. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending\&. -// Return \-1 on error, 0 on success\&. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it\&. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame\&. If frame is null, -// or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs\&. -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0)\&. Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly\&. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false\&. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream)\&. Prefix shows before frame, if not null\&. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t\&. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket\&. -// Else returns zero\&. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame\&. This is used if/when the frame is sent to a -// ZMQ_SERVER socket\&. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio\-dish pattern\&. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame\&. This is used if/when the frame is sent to a -// ZMQ_RADIO socket\&. -// Return \-1 on error, 0 on success\&. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zframe\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zframe class provides methods to send and receive single message frames across 0MQ sockets\&. A \fIframe\fR corresponds to one zmq_msg_t\&. When you read a frame from a socket, the zframe_more() method indicates if the frame is part of an unfinished multipart message\&. The zframe_send method normally destroys the frame, but with the ZFRAME_REUSE flag, you can send the same frame many times\&. Frames are binary, and this class has no special support for text data\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zframe\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zframe_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@tcp://127\&.0\&.0\&.1:9001"); -assert (output); -zsock_t *input = zsock_new_pair (">tcp://127\&.0\&.0\&.1:9001"); -assert (input); - -// Send five different frames, test ZFRAME_MORE -int frame_nbr; -for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { - frame = zframe_new ("Hello", 5); - assert (frame); - rc = zframe_send (&frame, output, ZFRAME_MORE); - assert (rc == 0); -} -// Send same frame five times, test ZFRAME_REUSE -frame = zframe_new ("Hello", 5); -assert (frame); -for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { - rc = zframe_send (&frame, output, ZFRAME_MORE + ZFRAME_REUSE); - assert (rc == 0); -} -assert (frame); -zframe_t *copy = zframe_dup (frame); -assert (zframe_eq (frame, copy)); -zframe_destroy (&frame); -assert (!zframe_eq (frame, copy)); -assert (zframe_size (copy) == 5); -zframe_destroy (©); -assert (!zframe_eq (frame, copy)); - -// Test zframe_new_empty -frame = zframe_new_empty (); -assert (frame); -assert (zframe_size (frame) == 0); -zframe_destroy (&frame); - -// Send END frame -frame = zframe_new ("NOT", 3); -assert (frame); -zframe_reset (frame, "END", 3); -char *string = zframe_strhex (frame); -assert (streq (string, "454E44")); -free (string); -string = zframe_strdup (frame); -assert (streq (string, "END")); -free (string); -rc = zframe_send (&frame, output, 0); -assert (rc == 0); - -// Read and count until we receive END -frame_nbr = 0; -for (frame_nbr = 0;; frame_nbr++) { - zframe_t *frame = zframe_recv (input); - if (zframe_streq (frame, "END")) { - zframe_destroy (&frame); - break; - } - assert (zframe_more (frame)); - zframe_set_more (frame, 0); - assert (zframe_more (frame) == 0); - zframe_destroy (&frame); -} -assert (frame_nbr == 10); - -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) -// Test zframe_meta -frame = zframe_new ("Hello", 5); -assert (frame); -rc = zframe_send (&frame, output, 0); -assert (rc == 0); -frame = zframe_recv (input); -const char *meta = zframe_meta (frame, "Socket\-Type"); -assert (meta != NULL); -assert (streq (meta, "PAIR")); -assert (zframe_meta (frame, "nonexistent") == NULL); -zframe_destroy (&frame); -#endif - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Create server and client sockets and connect over inproc -zsock_t *server = zsock_new_server ("inproc://zframe\-test\-routing"); -assert (server); -zsock_t *client = zsock_new_client ("inproc://zframe\-test\-routing"); -assert (client); - -// Send request from client to server -zframe_t *request = zframe_new ("Hello", 5); -assert (request); -rc = zframe_send (&request, client, 0); -assert (rc == 0); -assert (!request); - -// Read request and send reply -request = zframe_recv (server); -assert (request); -assert (zframe_streq (request, "Hello")); -assert (zframe_routing_id (request)); - -zframe_t *reply = zframe_new ("World", 5); -assert (reply); -zframe_set_routing_id (reply, zframe_routing_id (request)); -rc = zframe_send (&reply, server, 0); -assert (rc == 0); -zframe_destroy (&request); - -// Read reply -reply = zframe_recv (client); -assert (zframe_streq (reply, "World")); -assert (zframe_routing_id (reply) == 0); -zframe_destroy (&reply); - -// Client and server disallow multipart -frame = zframe_new ("Hello", 5); -rc = zframe_send (&frame, client, ZFRAME_MORE); -assert (rc == \-1); -rc = zframe_send (&frame, server, ZFRAME_MORE); -assert (rc == \-1); -zframe_destroy (&frame); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif - -#ifdef ZMQ_RADIO -// Create radio and dish sockets and connect over inproc -zsock_t *radio = zsock_new_radio ("inproc://zframe\-test\-radio"); -assert (radio); -zsock_t *dish = zsock_new_dish ("inproc://zframe\-test\-radio"); -assert (dish); - -// Join the group -rc = zsock_join (dish, "World"); -assert (rc == 0); - -// Publish message from radio -zframe_t *message = zframe_new ("Hello", 5); -assert (message); -rc = zframe_set_group (message, "World"); -assert (rc == 0); -rc = zframe_send (&message, radio, 0); -assert (rc == 0); -assert (!message); - -// Receive the message from dish -message = zframe_recv (dish); -assert (message); -assert (zframe_streq (message, "Hello")); -assert (strcmp("World", zframe_group (message)) == 0); -zframe_destroy (&message); - -zsock_destroy (&dish); -zsock_destroy (&radio); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 deleted file mode 100644 index 170d3a2271..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 +++ /dev/null @@ -1,338 +0,0 @@ -'\" t -.\" Title: zgossip -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZGOSSIP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zgossip \- decentralized configuration management -.SH "SYNOPSIS" -.sp -.nf -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint\&. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zgossip\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Implements a gossip protocol for decentralized configuration management\&. Your applications nodes form a loosely connected network (which can have cycles), and publish name/value tuples\&. Each node re\-distributes the new tuples it receives, so that the entire network eventually achieves a consistent state\&. The current design does not expire tuples\&. -.sp -Provides these commands (sent as multipart strings to the actor): -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -BIND endpoint \(em binds the gossip service to specified endpoint -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PORT \(em returns the last TCP port, if any, used for binding -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -LOAD configfile \(em load configuration from specified file -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SET configpath value \(em set configuration path = value -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SAVE configfile \(em save configuration to specified file -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -CONNECT endpoint \(em connect the gossip service to the specified peer -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PUBLISH key value \(em publish a key/value pair to the gossip cluster -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -STATUS \(em return number of key/value pairs held by gossip service -.RE -.sp -Returns these messages: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PORT number \(em reply to PORT command -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -STATUS number \(em reply to STATUS command -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -DELIVER key value \(em new tuple delivered from network -.RE -.sp -The gossip protocol distributes information around a loosely\-connected network of gossip services\&. The information consists of name/value pairs published by applications at any point in the network\&. The goal of the gossip protocol is to create eventual consistency between all the using applications\&. -.sp -The name/value pairs (tuples) can be used for configuration data, for status updates, for presence, or for discovery\&. When used for discovery, the gossip protocol works as an alternative to e\&.g\&. UDP beaconing\&. -.sp -The gossip network consists of a set of loosely\-coupled nodes that exchange tuples\&. Nodes can be connected across arbitrary transports, so the gossip network can have nodes that communicate over inproc, over IPC, and/or over TCP, at the same time\&. -.sp -Each node runs the same stack, which is a server\-client hybrid using a modified Harmony pattern (from Chapter 8 of the Guide): \m[blue]\fBhttp://zguide\&.zeromq\&.org/page:all#True\-Peer\-Connectivity\-Harmony\-Pattern\fR\m[] -.sp -Each node provides a ROUTER socket that accepts client connections on an key defined by the application via a BIND command\&. The state machine for these connections is in zgossip\&.xml, and the generated code is in zgossip_engine\&.inc\&. -.sp -Each node additionally creates outbound connections via DEALER sockets to a set of servers ("remotes"), and under control of the calling app, which sends CONNECT commands for each configured remote\&. -.sp -The messages between client and server are defined in zgossip_msg\&.xml\&. We built this stack using the zeromq/zproto toolkit\&. -.sp -To join the gossip network, a node connects to one or more peers\&. Each peer acts as a forwarder\&. This loosely\-coupled network can scale to thousands of nodes\&. However the gossip protocol is NOT designed to be efficient, and should not be used for application data, as the same tuples may be sent many times across the network\&. -.sp -The basic logic of the gossip service is to accept PUBLISH messages from its owning application, and to forward these to every remote, and every client it talks to\&. When a node gets a duplicate tuple, it throws it away\&. When a node gets a new tuple, it stores it, and fowards it as just described\&. At any point the application can access the node\(cqs set of tuples\&. -.sp -At present there is no way to expire tuples from the network\&. -.sp -The assumptions in this design are: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The data set is slow\-changing\&. Thus, the cost of the gossip protocol is irrelevant with respect to other traffic\&. -.RE -.SH "EXAMPLE" -.PP -\fBFrom zgossip_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Test basic client\-to\-server operation of the protocol -zactor_t *server = zactor_new (zgossip, "server"); -assert (server); -if (verbose) - zstr_send (server, "VERBOSE"); -zstr_sendx (server, "BIND", "inproc://zgossip", NULL); - -zsock_t *client = zsock_new (ZMQ_DEALER); -assert (client); -zsock_set_rcvtimeo (client, 2000); -int rc = zsock_connect (client, "inproc://zgossip"); -assert (rc == 0); - -// Send HELLO, which gets no message -zgossip_msg_t *message = zgossip_msg_new (); -zgossip_msg_set_id (message, ZGOSSIP_MSG_HELLO); -zgossip_msg_send (message, client); - -// Send PING, expect PONG back -zgossip_msg_set_id (message, ZGOSSIP_MSG_PING); -zgossip_msg_send (message, client); -zgossip_msg_recv (message, client); -assert (zgossip_msg_id (message) == ZGOSSIP_MSG_PONG); -zgossip_msg_destroy (&message); - -zactor_destroy (&server); -zsock_destroy (&client); - -// Test peer\-to\-peer operations -zactor_t *base = zactor_new (zgossip, "base"); -assert (base); -if (verbose) - zstr_send (base, "VERBOSE"); -// Set a 100msec timeout on clients so we can test expiry -zstr_sendx (base, "SET", "server/timeout", "100", NULL); -zstr_sendx (base, "BIND", "inproc://base", NULL); - -zactor_t *alpha = zactor_new (zgossip, "alpha"); -assert (alpha); -zstr_sendx (alpha, "CONNECT", "inproc://base", NULL); -zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-1", "service1", NULL); -zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-2", "service2", NULL); - -zactor_t *beta = zactor_new (zgossip, "beta"); -assert (beta); -zstr_sendx (beta, "CONNECT", "inproc://base", NULL); -zstr_sendx (beta, "PUBLISH", "inproc://beta\-1", "service1", NULL); -zstr_sendx (beta, "PUBLISH", "inproc://beta\-2", "service2", NULL); - -// got nothing -zclock_sleep (200); - -zactor_destroy (&base); -zactor_destroy (&alpha); -zactor_destroy (&beta); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 deleted file mode 100644 index 8d0d45ab3f..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 +++ /dev/null @@ -1,382 +0,0 @@ -'\" t -.\" Title: zhash -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZHASH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zhash \- simple generic hash container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table\&. Packed data must follow format -// defined by zhash_pack\&. Hash table is set to autofree\&. An empty frame -// unpacks to an empty hash table\&. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item\&. -// If key is already present returns \-1 and leaves existing item unchanged -// Returns 0 on success\&. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item\&. -// If key is already present, destroys old item and inserts new one\&. -// Use free_fn method to ensure deallocator is properly called on item\&. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table\&. If there was no such -// item, this function does nothing\&. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key\&. If there was no such -// item, does nothing\&. Returns 0 if successful, else \-1\&. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when hash items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null\&. -// Does not copy items themselves\&. Rebuilds new table so may be slow on -// very large tables\&. NOTE: only works with item values that are strings -// since there\*(Aqs no other way to know how to duplicate the item value\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty\&. This method is simpler to use than the -// foreach() method, which is deprecated\&. To access the key for this item -// use zhash_cursor()\&. NOTE: do NOT modify the table while iterating\&. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned\&. Use this together with -// zhash_first() to process all items in a hash table\&. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort()\&. To -// access the key for this item use zhash_cursor()\&. NOTE: do NOT modify -// the table while iterating\&. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned\&. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash\&. After an -// unsuccessful first/next, returns NULL\&. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk\&. You can add as many -// comment lines as you like\&. These comment lines are discarded when loading -// the file\&. If you use a null format, all comments are deleted\&. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message\&. -// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in -// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict\-count *( dict\-name dict\-value ) -// dict\-count = number\-4 -// dict\-value = longstr -// dict\-name = string -// -// ; Strings are always length + text contents -// longstr = number\-4 *VCHAR -// string = number\-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number\-1 = 1OCTET -// number\-4 = 4OCTET -// -// Comments are not included in the packed data\&. Item values MUST be -// strings\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format\&. Hash values must be -// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, -// else \-1 if a file error occurred\&. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist\&. Hash values must printable strings; keys may not contain -// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i\&.e\&. not -// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the -// file\&. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zhash_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhash\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zhash is an expandable hash table container\&. This is a simple container\&. For heavy\-duty applications we recommend using zhashx\&. -.sp -Note that it\(cqs relatively slow (50K insertions/deletes per second), so don\(cqt do inserts/updates on the critical path for message I/O\&. It can do 2\&.5M lookups per second for 16\-char keys\&. Timed on a 1\&.6GHz CPU\&. -.SH "EXAMPLE" -.PP -\fBFrom zhash_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zhash_t *hash = zhash_new (); -assert (hash); -assert (zhash_size (hash) == 0); -assert (zhash_first (hash) == NULL); -assert (zhash_cursor (hash) == NULL); - -// Insert some items -int rc; -rc = zhash_insert (hash, "DEADBEEF", "dead beef"); -char *item = (char *) zhash_first (hash); -assert (streq (zhash_cursor (hash), "DEADBEEF")); -assert (streq (item, "dead beef")); -assert (rc == 0); -rc = zhash_insert (hash, "ABADCAFE", "a bad cafe"); -assert (rc == 0); -rc = zhash_insert (hash, "C0DEDBAD", "coded bad"); -assert (rc == 0); -rc = zhash_insert (hash, "DEADF00D", "dead food"); -assert (rc == 0); -assert (zhash_size (hash) == 4); - -// Look for existing items -item = (char *) zhash_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhash_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); -item = (char *) zhash_lookup (hash, "C0DEDBAD"); -assert (streq (item, "coded bad")); -item = (char *) zhash_lookup (hash, "DEADF00D"); -assert (streq (item, "dead food")); - -// Look for non\-existent items -item = (char *) zhash_lookup (hash, "foo"); -assert (item == NULL); - -// Try to insert duplicate items -rc = zhash_insert (hash, "DEADBEEF", "foo"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); - -// Some rename tests - -// Valid rename, key is now LIVEBEEF -rc = zhash_rename (hash, "DEADBEEF", "LIVEBEEF"); -assert (rc == 0); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an unknown item to a non\-existent key -rc = zhash_rename (hash, "WHATBEEF", "NONESUCH"); -assert (rc == \-1); - -// Trying to rename an unknown item to an existing key -rc = zhash_rename (hash, "WHATBEEF", "LIVEBEEF"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an existing item to another existing item -rc = zhash_rename (hash, "LIVEBEEF", "ABADCAFE"); -assert (rc == \-1); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhash_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); - -// Test keys method -zlist_t *keys = zhash_keys (hash); -assert (zlist_size (keys) == 4); -zlist_destroy (&keys); - -// Test dup method -zhash_t *copy = zhash_dup (hash); -assert (zhash_size (copy) == 4); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); - -// Test pack/unpack methods -zframe_t *frame = zhash_pack (hash); -copy = zhash_unpack (frame); -zframe_destroy (&frame); -assert (zhash_size (copy) == 4); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); - -// Test save and load -zhash_comment (hash, "This is a test file"); -zhash_comment (hash, "Created by %s", "czmq_selftest"); -zhash_save (hash, "\&.cache"); -copy = zhash_new (); -assert (copy); -zhash_load (copy, "\&.cache"); -item = (char *) zhash_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhash_destroy (©); -zsys_file_delete ("\&.cache"); - -// Delete a item -zhash_delete (hash, "LIVEBEEF"); -item = (char *) zhash_lookup (hash, "LIVEBEEF"); -assert (item == NULL); -assert (zhash_size (hash) == 3); - -// Check that the queue is robust against random usage -struct { - char name [100]; - bool exists; -} testset [200]; -memset (testset, 0, sizeof (testset)); -int testmax = 200, testnbr, iteration; - -srandom ((unsigned) time (NULL)); -for (iteration = 0; iteration < 25000; iteration++) { - testnbr = randof (testmax); - assert (testnbr != testmax); - assert (testnbr < testmax); - if (testset [testnbr]\&.exists) { - item = (char *) zhash_lookup (hash, testset [testnbr]\&.name); - assert (item); - zhash_delete (hash, testset [testnbr]\&.name); - testset [testnbr]\&.exists = false; - } - else { - sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); - if (zhash_insert (hash, testset [testnbr]\&.name, "") == 0) - testset [testnbr]\&.exists = true; - } -} -// Test 10K lookups -for (iteration = 0; iteration < 10000; iteration++) - item = (char *) zhash_lookup (hash, "DEADBEEFABADCAFE"); - -// Destructor should be safe to call twice -zhash_destroy (&hash); -zhash_destroy (&hash); -assert (hash == NULL); - -// Test autofree; automatically copies and frees string values -hash = zhash_new (); -assert (hash); -zhash_autofree (hash); -char value [255]; -strcpy (value, "This is a string"); -rc = zhash_insert (hash, "key1", value); -assert (rc == 0); -strcpy (value, "Inserting with the same key will fail"); -rc = zhash_insert (hash, "key1", value); -assert (rc == \-1); -strcpy (value, "Ring a ding ding"); -rc = zhash_insert (hash, "key2", value); -assert (rc == 0); -assert (streq ((char *) zhash_lookup (hash, "key1"), "This is a string")); -assert (streq ((char *) zhash_lookup (hash, "key2"), "Ring a ding ding")); -zhash_destroy (&hash); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 deleted file mode 100644 index d78b29a431..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 +++ /dev/null @@ -1,498 +0,0 @@ -'\" t -.\" Title: zhashx -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZHASHX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zhashx \- extended generic hash container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr\&. -// The caller takes ownership of the newly created object\&. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item\&. -// The caller takes ownership of the newly created object\&. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table\&. Packed data must follow format -// defined by zhashx_pack\&. Hash table is set to autofree\&. An empty frame -// unpacks to an empty hash table\&. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item\&. -// If key is already present returns \-1 and leaves existing item unchanged -// Returns 0 on success\&. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item\&. If the -// key is already present, destroys old item and inserts new one\&. If you set -// a container item destructor, this is called on the old value\&. If the key -// was not already present, inserts a new item\&. Sets the hash cursor to the -// new item\&. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table\&. If there was no such -// item, this function does nothing\&. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table\&. If the key destructor is -// set, calls it on every key\&. If the item destructor is set, calls -// it on every item\&. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key\&. If there was no such -// item, does nothing\&. Returns 0 if successful, else \-1\&. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when hash items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table\&. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table\&. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty\&. This method is simpler to use than the -// foreach() method, which is deprecated\&. To access the key for this item -// use zhashx_cursor()\&. NOTE: do NOT modify the table while iterating\&. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned\&. Use this together with -// zhashx_first() to process all items in a hash table\&. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort()\&. To -// access the key for this item use zhashx_cursor()\&. NOTE: do NOT modify -// the table while iterating\&. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned\&. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash\&. After an -// unsuccessful first/next, returns NULL\&. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk\&. You can add as many -// comment lines as you like\&. These comment lines are discarded when loading -// the file\&. If you use a null format, all comments are deleted\&. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format\&. Hash values must be -// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, -// else \-1 if a file error occurred\&. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist\&. Hash values must printable strings; keys may not contain -// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i\&.e\&. not -// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the -// file\&. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message\&. -// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in -// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict\-count *( dict\-name dict\-value ) -// dict\-count = number\-4 -// dict\-value = longstr -// dict\-name = string -// -// ; Strings are always length + text contents -// longstr = number\-4 *VCHAR -// string = number\-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number\-1 = 1OCTET -// number\-4 = 4OCTET -// -// Comments are not included in the packed data\&. Item values MUST be -// strings\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not\&. Copying a null reference returns a null -// reference\&. Note that this method\*(Aqs behavior changed slightly for CZMQ -// v3\&.x, as it does not set nor respect autofree\&. It does however let you -// duplicate any hash table safely\&. The old behavior is in zhashx_dup_v2\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user\-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed\&. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user\-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated\&. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user\-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free()\&. -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user\-defined duplicator for keys; by default keys are duplicated -// using strdup\&. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user\-defined comparator for keys; by default keys are -// compared using strcmp\&. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user\-defined comparator for keys; by default keys are -// compared using strcmp\&. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null\&. -// Does not copy items themselves\&. Rebuilds new table so may be slow on -// very large tables\&. NOTE: only works with item values that are strings -// since there\*(Aqs no other way to know how to duplicate the item value\&. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user\-defined deserializer function to convert -// a longstr back into item format\&. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user\-defined serializer function to convert items -// into longstr\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhashx\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zhashx is an extended hash table container with more functionality than zhash, its simpler cousin\&. -.sp -The hash table always has a size that is prime and roughly doubles its size when 75% full\&. In case of hash collisions items are chained in a linked list\&. The hash table size is increased slightly (up to 5 times before roughly doubling the size) when an overly long chain (between 1 and 63 items depending on table size) is detected\&. -.SH "EXAMPLE" -.PP -\fBFrom zhashx_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zhashx_t *hash = zhashx_new (); -assert (hash); -assert (zhashx_size (hash) == 0); -assert (zhashx_first (hash) == NULL); -assert (zhashx_cursor (hash) == NULL); - -// Insert some items -int rc; -rc = zhashx_insert (hash, "DEADBEEF", "dead beef"); -char *item = (char *) zhashx_first (hash); -assert (streq ((char *) zhashx_cursor (hash), "DEADBEEF")); -assert (streq (item, "dead beef")); -assert (rc == 0); -rc = zhashx_insert (hash, "ABADCAFE", "a bad cafe"); -assert (rc == 0); -rc = zhashx_insert (hash, "C0DEDBAD", "coded bad"); -assert (rc == 0); -rc = zhashx_insert (hash, "DEADF00D", "dead food"); -assert (rc == 0); -assert (zhashx_size (hash) == 4); - -// Look for existing items -item = (char *) zhashx_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhashx_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); -item = (char *) zhashx_lookup (hash, "C0DEDBAD"); -assert (streq (item, "coded bad")); -item = (char *) zhashx_lookup (hash, "DEADF00D"); -assert (streq (item, "dead food")); - -// Look for non\-existent items -item = (char *) zhashx_lookup (hash, "foo"); -assert (item == NULL); - -// Try to insert duplicate items -rc = zhashx_insert (hash, "DEADBEEF", "foo"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "DEADBEEF"); -assert (streq (item, "dead beef")); - -// Some rename tests - -// Valid rename, key is now LIVEBEEF -rc = zhashx_rename (hash, "DEADBEEF", "LIVEBEEF"); -assert (rc == 0); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an unknown item to a non\-existent key -rc = zhashx_rename (hash, "WHATBEEF", "NONESUCH"); -assert (rc == \-1); - -// Trying to rename an unknown item to an existing key -rc = zhashx_rename (hash, "WHATBEEF", "LIVEBEEF"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); - -// Trying to rename an existing item to another existing item -rc = zhashx_rename (hash, "LIVEBEEF", "ABADCAFE"); -assert (rc == \-1); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (streq (item, "dead beef")); -item = (char *) zhashx_lookup (hash, "ABADCAFE"); -assert (streq (item, "a bad cafe")); - -// Test keys method -zlistx_t *keys = zhashx_keys (hash); -assert (zlistx_size (keys) == 4); -zlistx_destroy (&keys); - -zlistx_t *values = zhashx_values(hash); -assert (zlistx_size (values) == 4); -zlistx_destroy (&values); - -// Test dup method -zhashx_t *copy = zhashx_dup (hash); -assert (zhashx_size (copy) == 4); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); - -// Test pack/unpack methods -zframe_t *frame = zhashx_pack (hash); -copy = zhashx_unpack (frame); -zframe_destroy (&frame); -assert (zhashx_size (copy) == 4); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); - -#ifdef CZMQ_BUILD_DRAFT_API -// Test own pack/unpack methods -zhashx_t *own_hash = zhashx_new (); -zhashx_set_destructor (own_hash, s_test_destroy_int); -assert (own_hash); -int *val1 = (int *) zmalloc (sizeof (int)); -int *val2 = (int *) zmalloc (sizeof (int)); -*val1 = 25; -*val2 = 100; -zhashx_insert (own_hash, "val1", val1); -zhashx_insert (own_hash, "val2", val2); -frame = zhashx_pack_own (own_hash, s_test_serialize_int); -copy = zhashx_unpack_own (frame, s_test_deserialze_int); -zhashx_set_destructor (copy, s_test_destroy_int); -zframe_destroy (&frame); -assert (zhashx_size (copy) == 2); -assert (*((int *) zhashx_lookup (copy, "val1")) == 25); -assert (*((int *) zhashx_lookup (copy, "val2")) == 100); -zhashx_destroy (©); -zhashx_destroy (&own_hash); -#endif // CZMQ_BUILD_DRAFT_API - -// Test save and load -zhashx_comment (hash, "This is a test file"); -zhashx_comment (hash, "Created by %s", "czmq_selftest"); -zhashx_save (hash, "\&.cache"); -copy = zhashx_new (); -assert (copy); -zhashx_load (copy, "\&.cache"); -item = (char *) zhashx_lookup (copy, "LIVEBEEF"); -assert (item); -assert (streq (item, "dead beef")); -zhashx_destroy (©); -zsys_file_delete ("\&.cache"); - -// Delete a item -zhashx_delete (hash, "LIVEBEEF"); -item = (char *) zhashx_lookup (hash, "LIVEBEEF"); -assert (item == NULL); -assert (zhashx_size (hash) == 3); - -// Check that the queue is robust against random usage -struct { - char name [100]; - bool exists; -} testset [200]; -memset (testset, 0, sizeof (testset)); -int testmax = 200, testnbr, iteration; - -srandom ((unsigned) time (NULL)); -for (iteration = 0; iteration < 25000; iteration++) { - testnbr = randof (testmax); - if (testset [testnbr]\&.exists) { - item = (char *) zhashx_lookup (hash, testset [testnbr]\&.name); - assert (item); - zhashx_delete (hash, testset [testnbr]\&.name); - testset [testnbr]\&.exists = false; - } - else { - sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); - if (zhashx_insert (hash, testset [testnbr]\&.name, "") == 0) - testset [testnbr]\&.exists = true; - } -} -// Test 10K lookups -for (iteration = 0; iteration < 10000; iteration++) - item = (char *) zhashx_lookup (hash, "DEADBEEFABADCAFE"); - -// Destructor should be safe to call twice -zhashx_destroy (&hash); -zhashx_destroy (&hash); -assert (hash == NULL); - -// Test destructor; automatically copies and frees string values -hash = zhashx_new (); -assert (hash); -zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); -zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); -char value [255]; -strcpy (value, "This is a string"); -rc = zhashx_insert (hash, "key1", value); -assert (rc == 0); -strcpy (value, "Ring a ding ding"); -rc = zhashx_insert (hash, "key2", value); -assert (rc == 0); -assert (streq ((char *) zhashx_lookup (hash, "key1"), "This is a string")); -assert (streq ((char *) zhashx_lookup (hash, "key2"), "Ring a ding ding")); -zhashx_destroy (&hash); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 deleted file mode 100644 index b50b06c0f3..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 +++ /dev/null @@ -1,134 +0,0 @@ -'\" t -.\" Title: ziflist -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZIFLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ziflist \- list of network interfaces available on system -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces\&. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ziflist\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The ziflist class takes a snapshot of the network interfaces that the system currently supports (this can change arbitrarily, especially on mobile devices)\&. The caller can then access the network interface information using an iterator that works like zlistx\&. Only stores those interfaces with broadcast capability, and ignores the loopback interface\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ziflist\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom ziflist_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -ziflist_t *iflist = ziflist_new (); -assert (iflist); - -size_t items = ziflist_size (iflist); - -if (verbose) { - printf ("ziflist: interfaces=%zu\en", ziflist_size (iflist)); - const char *name = ziflist_first (iflist); - while (name) { - printf (" \- name=%s address=%s netmask=%s broadcast=%s\en", - name, ziflist_address (iflist), ziflist_netmask (iflist), ziflist_broadcast (iflist)); - name = ziflist_next (iflist); - } -} -ziflist_reload (iflist); -assert (items == ziflist_size (iflist)); -ziflist_destroy (&iflist); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 deleted file mode 100644 index a7131f40e0..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 +++ /dev/null @@ -1,316 +0,0 @@ -'\" t -.\" Title: zlist -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zlist \- simple generic list container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Comparison function e\&.g\&. for sorting and removing\&. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the head item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item\&. If the list is empty, returns NULL\&. To move to -// the start of the list call zlist_first ()\&. Advances the cursor\&. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the current item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or \-1 if this -// failed for some reason (out of memory)\&. Note that if a duplicator has -// been set, this method will also duplicate the item\&. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or \-1 if this -// failed for some reason (out of memory)\&. Note that if a duplicator has -// been set, this method will also duplicate the item\&. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present\&. Uses compare method to determine if -// items are equal\&. If the compare method is NULL the check will only compare -// pointers\&. Returns true if item is present else false\&. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list\&. If the list has autofree set, the copied list will -// duplicate all items, which must be strings\&. Otherwise, the list will hold -// pointers back to the items in the original list\&. If list is null, returns -// NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list\&. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison\&. If you specify -// a compare function, this decides how items are sorted\&. The sort is not -// stable, so may reorder items with the same keys\&. The algorithm used is -// combsort, a compromise between performance and simplicity\&. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings\&. -// By default a list item refers to a value held elsewhere\&. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value\&. Then, when you destroy the list, it will free all -// item values automatically\&. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list\&. -// The usual technique is to pop list items and destroy them, until the -// list is empty\&. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list\&. The function compares two items\&. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item\&. -// This function is used for sorting, removal and exists checking\&. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item\&. When the item is -// destroyed, the free function, if any, is called on that item\&. -// Use this when list items are dynamically allocated, to ensure that -// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. -// Returns the item, or NULL if there is no such item\&. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class\&. -CZMQ_EXPORT void - zlist_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlist\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Provides a generic container implementing a fast singly\-linked list\&. You can use this to construct multi\-dimensional lists, and other structures together with other generic containers like zhash\&. This is a simple class\&. For demanding applications we recommend using zlistx\&. -.sp -To iterate through a list, use zlist_first to get the first item, then loop while not null, and do zlist_next at the end of each iteration\&. -.SH "EXAMPLE" -.PP -\fBFrom zlist_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zlist_t *list = zlist_new (); -assert (list); -assert (zlist_size (list) == 0); - -// Three items we\*(Aqll use as test data -// List items are void *, not particularly strings -char *cheese = "boursin"; -char *bread = "baguette"; -char *wine = "bordeaux"; - -zlist_append (list, cheese); -assert (zlist_size (list) == 1); -assert ( zlist_exists (list, cheese)); -assert (!zlist_exists (list, bread)); -assert (!zlist_exists (list, wine)); -zlist_append (list, bread); -assert (zlist_size (list) == 2); -assert ( zlist_exists (list, cheese)); -assert ( zlist_exists (list, bread)); -assert (!zlist_exists (list, wine)); -zlist_append (list, wine); -assert (zlist_size (list) == 3); -assert ( zlist_exists (list, cheese)); -assert ( zlist_exists (list, bread)); -assert ( zlist_exists (list, wine)); - -assert (zlist_head (list) == cheese); -assert (zlist_next (list) == cheese); - -assert (zlist_first (list) == cheese); -assert (zlist_tail (list) == wine); -assert (zlist_next (list) == bread); - -assert (zlist_first (list) == cheese); -assert (zlist_next (list) == bread); -assert (zlist_next (list) == wine); -assert (zlist_next (list) == NULL); -// After we reach end of list, next wraps around -assert (zlist_next (list) == cheese); -assert (zlist_size (list) == 3); - -zlist_remove (list, wine); -assert (zlist_size (list) == 2); - -assert (zlist_first (list) == cheese); -zlist_remove (list, cheese); -assert (zlist_size (list) == 1); -assert (zlist_first (list) == bread); - -zlist_remove (list, bread); -assert (zlist_size (list) == 0); - -zlist_append (list, cheese); -zlist_append (list, bread); -assert (zlist_last (list) == bread); -zlist_remove (list, bread); -assert (zlist_last (list) == cheese); -zlist_remove (list, cheese); -assert (zlist_last (list) == NULL); - -zlist_push (list, cheese); -assert (zlist_size (list) == 1); -assert (zlist_first (list) == cheese); - -zlist_push (list, bread); -assert (zlist_size (list) == 2); -assert (zlist_first (list) == bread); -assert (zlist_item (list) == bread); - -zlist_append (list, wine); -assert (zlist_size (list) == 3); -assert (zlist_first (list) == bread); - -zlist_t *sub_list = zlist_dup (list); -assert (sub_list); -assert (zlist_size (sub_list) == 3); - -zlist_sort (list, NULL); -char *item; -item = (char *) zlist_pop (list); -assert (item == bread); -item = (char *) zlist_pop (list); -assert (item == wine); -item = (char *) zlist_pop (list); -assert (item == cheese); -assert (zlist_size (list) == 0); - -assert (zlist_size (sub_list) == 3); -zlist_push (list, sub_list); -zlist_t *sub_list_2 = zlist_dup (sub_list); -zlist_append (list, sub_list_2); -assert (zlist_freefn (list, sub_list, &s_zlist_free, false) == sub_list); -assert (zlist_freefn (list, sub_list_2, &s_zlist_free, true) == sub_list_2); -zlist_destroy (&list); - -// Test autofree functionality -list = zlist_new (); -assert (list); -zlist_autofree (list); -// Set equals function otherwise equals will not work as autofree copies strings -zlist_comparefn (list, (zlist_compare_fn *) strcmp); -zlist_push (list, bread); -zlist_append (list, cheese); -assert (zlist_size (list) == 2); -zlist_append (list, wine); -assert (zlist_exists (list, wine)); -zlist_remove (list, wine); -assert (!zlist_exists (list, wine)); -assert (streq ((const char *) zlist_first (list), bread)); -item = (char *) zlist_pop (list); -assert (streq (item, bread)); -free (item); -item = (char *) zlist_pop (list); -assert (streq (item, cheese)); -free (item); - -zlist_destroy (&list); -assert (list == NULL); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 deleted file mode 100644 index 2e1068554b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 +++ /dev/null @@ -1,346 +0,0 @@ -'\" t -.\" Title: zlistx -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLISTX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zlistx \- extended generic list container -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list\&. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list\&. If an item destructor was specified, all items in the -// list are automatically destroyed as well\&. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list\&. Calls the item duplicator, if any, -// on the item\&. Resets cursor to list head\&. Returns an item handle on -// success, NULL if memory was exhausted\&. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list\&. Calls the item duplicator, if any, -// on the item\&. Resets cursor to list head\&. Returns an item handle on -// success, NULL if memory was exhausted\&. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the head item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item\&. At the end of the list (or in an empty list), -// returns NULL\&. Use repeated zlistx_next () calls to work through the list -// from zlistx_first ()\&. First time, acts as zlistx_first()\&. -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item\&. At the start of the list (or in an empty list), -// returns NULL\&. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last ()\&. First time, acts as zlistx_last()\&. -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list\&. If the list is empty, returns NULL\&. -// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item\&. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item\&. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL\&. Asserts that the passed in handle points to a list element\&. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start\&. Uses the item -// comparator, if any, else compares item values directly\&. Returns the -// item handle found, or NULL\&. Sets the cursor to the found item, if any\&. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle\&. The item is not modified, -// and the caller is responsible for destroying it if necessary\&. If handle is -// null, detaches the first item on the list\&. Returns item that was detached, -// or null if none was\&. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list\&. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list\&. The item is not modified, -// and the caller is responsible for destroying it as necessary\&. Returns item -// that was detached, or null if none was\&. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list\&. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle\&. Calls the item destructor is any is -// set\&. If handle is null, deletes the first item on the list\&. Returns 0 -// if an item was deleted, \-1 if not\&. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list\&. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle\&. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle\&. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set\&. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list\&. If an item comparator was set, calls that to compare -// items, otherwise compares on item value\&. The sort is not stable, so may -// reorder equal items\&. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list\&. Calls the item -// duplicator, if any, on the item\&. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end\&. Use the item -// comparator, if any, to find where to place the new node\&. Returns a handle -// to the new node, or NULL if memory was exhausted\&. Resets the cursor to the -// list head\&. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list\&. Uses -// the item comparator, if any, to determine the new location\&. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end\&. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not\&. Copying a null reference returns a null -// reference\&. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user\-defined deallocator for list items; by default items are not -// freed when the list is destroyed\&. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user\-defined duplicator for list items; by default items are not -// copied when the list is duplicated\&. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user\-defined comparator for zlistx_find and zlistx_sort; the method -// must return \-1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2\&. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class\&. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlistx\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Provides a generic doubly\-linked list container\&. This container provides hooks for duplicator, comparator, and destructor functions\&. These tie into CZMQ and standard C semantics, so e\&.g\&. for string items you can use strdup, strcmp, and zstr_free\&. To store custom objects, define your own duplicator and comparator, and use the standard object destructor\&. -.sp -This is a reworking of the simpler zlist container\&. It is faster to insert and delete items anywhere in the list, and to keep ordered lists\&. -.SH "EXAMPLE" -.PP -\fBFrom zlistx_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zlistx_t *list = zlistx_new (); -assert (list); -assert (zlistx_size (list) == 0); - -// Test operations on an empty list -assert (zlistx_first (list) == NULL); -assert (zlistx_last (list) == NULL); -assert (zlistx_next (list) == NULL); -assert (zlistx_prev (list) == NULL); -assert (zlistx_find (list, "hello") == NULL); -assert (zlistx_delete (list, NULL) == \-1); -assert (zlistx_detach (list, NULL) == NULL); -assert (zlistx_delete (list, NULL) == \-1); -assert (zlistx_detach (list, NULL) == NULL); -zlistx_purge (list); -zlistx_sort (list); - -// Use item handlers -zlistx_set_destructor (list, (zlistx_destructor_fn *) zstr_free); -zlistx_set_duplicator (list, (zlistx_duplicator_fn *) strdup); -zlistx_set_comparator (list, (zlistx_comparator_fn *) strcmp); - -// Try simple insert/sort/delete/next -assert (zlistx_next (list) == NULL); -zlistx_add_end (list, "world"); -assert (streq ((char *) zlistx_next (list), "world")); -zlistx_add_end (list, "hello"); -assert (streq ((char *) zlistx_prev (list), "hello")); -zlistx_sort (list); -assert (zlistx_size (list) == 2); -void *handle = zlistx_find (list, "hello"); -char *item1 = (char *) zlistx_item (list); -char *item2 = (char *) zlistx_handle_item (handle); -assert (item1 == item2); -assert (streq (item1, "hello")); -zlistx_delete (list, handle); -assert (zlistx_size (list) == 1); -char *string = (char *) zlistx_detach (list, NULL); -assert (streq (string, "world")); -free (string); -assert (zlistx_size (list) == 0); - -// Check next/back work -// Now populate the list with items -zlistx_add_start (list, "five"); -zlistx_add_end (list, "six"); -zlistx_add_start (list, "four"); -zlistx_add_end (list, "seven"); -zlistx_add_start (list, "three"); -zlistx_add_end (list, "eight"); -zlistx_add_start (list, "two"); -zlistx_add_end (list, "nine"); -zlistx_add_start (list, "one"); -zlistx_add_end (list, "ten"); - -// Test our navigation skills -assert (zlistx_size (list) == 10); -assert (streq ((char *) zlistx_last (list), "ten")); -assert (streq ((char *) zlistx_prev (list), "nine")); -assert (streq ((char *) zlistx_prev (list), "eight")); -assert (streq ((char *) zlistx_prev (list), "seven")); -assert (streq ((char *) zlistx_prev (list), "six")); -assert (streq ((char *) zlistx_prev (list), "five")); -assert (streq ((char *) zlistx_first (list), "one")); -assert (streq ((char *) zlistx_next (list), "two")); -assert (streq ((char *) zlistx_next (list), "three")); -assert (streq ((char *) zlistx_next (list), "four")); - -// Sort by alphabetical order -zlistx_sort (list); -assert (streq ((char *) zlistx_first (list), "eight")); -assert (streq ((char *) zlistx_last (list), "two")); - -// Moving items around -handle = zlistx_find (list, "six"); -zlistx_move_start (list, handle); -assert (streq ((char *) zlistx_first (list), "six")); -zlistx_move_end (list, handle); -assert (streq ((char *) zlistx_last (list), "six")); -zlistx_sort (list); -assert (streq ((char *) zlistx_last (list), "two")); - -// Copying a list -zlistx_t *copy = zlistx_dup (list); -assert (copy); -assert (zlistx_size (copy) == 10); -assert (streq ((char *) zlistx_first (copy), "eight")); -assert (streq ((char *) zlistx_last (copy), "two")); -zlistx_destroy (©); - -// Delete items while iterating -string = (char *) zlistx_first (list); -assert (streq (string, "eight")); -string = (char *) zlistx_next (list); -assert (streq (string, "five")); -zlistx_delete (list, zlistx_cursor (list)); -string = (char *) zlistx_next (list); -assert (streq (string, "four")); - -zlistx_purge (list); -zlistx_destroy (&list); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 deleted file mode 100644 index 7d5c84949f..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 +++ /dev/null @@ -1,261 +0,0 @@ -'\" t -.\" Title: zloop -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZLOOP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zloop \- event\-driven reactor -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low\-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor\&. When the reader has messages, -// the reactor will call the handler, passing the arg\&. Returns 0 if OK, \-1 -// if there was an error\&. If you register the same socket more than once, -// each instance will invoke its corresponding handler\&. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor\&. If multiple readers exist for -// same socket, cancels ALL of them\&. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors\&. If you do not set this, -// then readers that have errors are removed from the reactor silently\&. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low\-level libzmq pollitem with the reactor\&. When the pollitem -// is ready, will call the handler, passing the arg\&. Returns 0 if OK, \-1 -// if there was an error\&. If you register the pollitem more than once, each -// instance will invoke its corresponding handler\&. A pollitem with -// socket=NULL and fd=0 means \*(Aqpoll on FD zero\*(Aq\&. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD\&. If both -// are specified, uses only socket\&. If multiple poll items exist for same -// socket/FD, cancels ALL of them\&. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors\&. If you do not set this, -// then poller that have errors are removed from the reactor silently\&. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times\&. At each expiry, will call the handler, passing the arg\&. To run a -// timer forever, use 0 times\&. Returns a timer_id that is used to cancel the -// timer in the future\&. Returns \-1 if there was an error\&. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer)\&. -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer\&. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them\&. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client\&. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients\&. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket\&. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete\&. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time\&. This is a very fast operation\&. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer\&. We do not actually delete the ticket here, as -// other code may still refer to the ticket\&. We mark as deleted, and remove -// later and safely\&. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets\&. If you lower the -// delay and there are already tickets created, the results are undefined\&. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed\&. Setting more than a small -// number of timers (10\-100) can have a dramatic impact on the performance -// of the reactor\&. For high\-volume cases, use ticket timers\&. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error\&. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off\&. The default verbose setting is -// off (false)\&. -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal\&. This makes it impossible to shut\-down message based architectures -// like zactors\&. This method lets you switch off break handling\&. The default -// nonstop setting is off (false)\&. -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor\&. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns \-1\&. Event handlers may register new sockets and timers, and -// cancel sockets\&. Returns 0 if interrupted, \-1 if canceled by a handler\&. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zloop_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zloop\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zloop class provides an event\-driven reactor pattern\&. The reactor handles zmq_pollitem_t items (pollers or writers, sockets or fds), and once\-off or repeated timers\&. Its resolution is 1 msec\&. It uses a tickless timer to reduce CPU interrupts in inactive processes\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zloop\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zloop_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new (ZMQ_PAIR); -assert (output); -zsock_bind (output, "inproc://zloop\&.test"); - -zsock_t *input = zsock_new (ZMQ_PAIR); -assert (input); -zsock_connect (input, "inproc://zloop\&.test"); - -zloop_t *loop = zloop_new (); -assert (loop); -zloop_set_verbose (loop, verbose); - -// Create a timer that will be cancelled -int timer_id = zloop_timer (loop, 1000, 1, s_timer_event, NULL); -zloop_timer (loop, 5, 1, s_cancel_timer_event, &timer_id); - -// After 20 msecs, send a ping message to output3 -zloop_timer (loop, 20, 1, s_timer_event, output); - -// Set up some tickets that will never expire -zloop_set_ticket_delay (loop, 10000); -void *ticket1 = zloop_ticket (loop, s_timer_event, NULL); -void *ticket2 = zloop_ticket (loop, s_timer_event, NULL); -void *ticket3 = zloop_ticket (loop, s_timer_event, NULL); - -// When we get the ping message, end the reactor -rc = zloop_reader (loop, input, s_socket_event, NULL); -assert (rc == 0); -zloop_reader_set_tolerant (loop, input); -zloop_start (loop); - -zloop_ticket_delete (loop, ticket1); -zloop_ticket_delete (loop, ticket2); -zloop_ticket_delete (loop, ticket3); - -// Check whether loop properly ignores zsys_interrupted flag -// when asked to -zloop_destroy (&loop); -loop = zloop_new (); - -bool timer_event_called = false; -zloop_timer (loop, 1, 1, s_timer_event3, &timer_event_called); - -zsys_interrupted = 1; -zloop_start (loop); -// zloop returns immediately without giving any handler a chance to run -assert (!timer_event_called); - -zloop_set_nonstop (loop, true); -zloop_start (loop); -// zloop runs the handler which will terminate the loop -assert (timer_event_called); -zsys_interrupted = 0; - -// cleanup -zloop_destroy (&loop); -assert (loop == NULL); - -zsock_destroy (&input); -zsock_destroy (&output); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 deleted file mode 100644 index 8d716863d4..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 +++ /dev/null @@ -1,157 +0,0 @@ -'\" t -.\" Title: zmonitor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMONITOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmonitor \- socket event monitor -.SH "SYNOPSIS" -.sp -.nf -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance\&. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity\&. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, \&.\&.\&., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored\&. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmonitor\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zmonitor actor provides an API for obtaining socket events such as connected, listen, disconnected, etc\&. Socket events are only available for sockets connecting or bound to ipc:// and tcp:// endpoints\&. -.sp -This class wraps the ZMQ socket monitor API, see zmq_socket_monitor for details\&. Works on all versions of libzmq from 3\&.2 onwards\&. This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zmonitor_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsock_t *client = zsock_new (ZMQ_DEALER); -assert (client); -zactor_t *clientmon = zactor_new (zmonitor, client); -assert (clientmon); -if (verbose) - zstr_sendx (clientmon, "VERBOSE", NULL); -zstr_sendx (clientmon, "LISTEN", "LISTENING", "ACCEPTED", NULL); -zstr_sendx (clientmon, "START", NULL); -zsock_wait (clientmon); - -zsock_t *server = zsock_new (ZMQ_DEALER); -assert (server); -zactor_t *servermon = zactor_new (zmonitor, server); -assert (servermon); -if (verbose) - zstr_sendx (servermon, "VERBOSE", NULL); -zstr_sendx (servermon, "LISTEN", "CONNECTED", "DISCONNECTED", NULL); -zstr_sendx (servermon, "START", NULL); -zsock_wait (servermon); - -// Allow a brief time for the message to get there\&.\&.\&. -zmq_poll (NULL, 0, 200); - -// Check client is now listening -int port_nbr = zsock_bind (client, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -s_assert_event (clientmon, "LISTENING"); - -// Check server connected to client -zsock_connect (server, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -s_assert_event (servermon, "CONNECTED"); - -// Check client accepted connection -s_assert_event (clientmon, "ACCEPTED"); - -zactor_destroy (&clientmon); -zactor_destroy (&servermon); -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 deleted file mode 100644 index 40fde8be8d..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_dec -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_D" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_dec \- decrement an atomic counter -.SH "SYNOPSIS" -.sp -\fBint zmq_atomic_counter_dec (void *counter);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_dec\fR function decrements an atomic counter in a threadsafe fashion\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_dec()\fR function returns 1 if the counter is greater than zero after decrementing, or zero if the counter reached zero\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 deleted file mode 100644 index b37bd42407..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_destroy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_D" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_destroy \- destroy an atomic counter -.SH "SYNOPSIS" -.sp -\fBvoid zmq_atomic_counter_destroy (void **counter_p);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_destroy\fR function destroys an atomic counter and nullifies its reference\&. Pass the address of an atomic counter (void **) rather than the counter itself\&. You must destroy all counters that you create, to avoid memory leakage\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_destroy()\fR function has no return value\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 deleted file mode 100644 index 8d7064f9cc..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_inc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_I" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_inc \- increment an atomic counter -.SH "SYNOPSIS" -.sp -\fBint zmq_atomic_counter_inc (void *counter);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_inc\fR function increments an atomic counter in a threadsafe fashion\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_inc()\fR function returns the old value of the counter, before incrementing\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 deleted file mode 100644 index 124130917b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_new -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_N" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_new \- create a new atomic counter -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_atomic_counter_new (void);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_new\fR function creates a new atomic counter\&. You can use this in multithreaded applications to do, for example, reference counting of shared objects\&. The atomic counter is at least 32 bits large\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_new()\fR function returns the new atomic counter if successful\&. Otherwise it returns NULL\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 deleted file mode 100644 index 5cdac995d6..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_set -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_S" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_set \- set atomic counter to new value -.SH "SYNOPSIS" -.sp -\fBvoid zmq_atomic_counter_set (void *counter, int value);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_set\fR function sets the counter to a new value, in a threadsafe fashion\&. The largest value that is guaranteed to work across all platforms is 2^31\-1\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_set()\fR function has no return value\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 deleted file mode 100644 index f62f8b4714..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_atomic_counter_value -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ATOMIC_COUNTER_V" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_atomic_counter_value \- return value of atomic counter -.SH "SYNOPSIS" -.sp -\fBint zmq_atomic_counter_value (void *counter);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_atomic_counter_value\fR function returns the value of an atomic counter\&. This function uses platform specific atomic operations\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_atomic_counter_value()\fR function returns the new atomic counter if successful\&. Otherwise it returns NULL\&. -.SH "EXAMPLE" -.PP -\fBTest code for atomic counters\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *counter = zmq_atomic_counter_new (); -assert (zmq_atomic_counter_value (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 0); -assert (zmq_atomic_counter_inc (counter) == 1); -assert (zmq_atomic_counter_inc (counter) == 2); -assert (zmq_atomic_counter_value (counter) == 3); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_set (counter, 2); -assert (zmq_atomic_counter_dec (counter) == 1); -assert (zmq_atomic_counter_dec (counter) == 0); -zmq_atomic_counter_destroy (&counter); -return 0; -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_destroy\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 deleted file mode 100644 index 4729611865..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 +++ /dev/null @@ -1,200 +0,0 @@ -'\" t -.\" Title: zmq_bind -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_BIND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_bind \- accept incoming connections on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_bind (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_bind()\fR function binds the \fIsocket\fR to a local \fIendpoint\fR and then accepts incoming connections on that endpoint\&. -.sp -The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to bind to\&. -.sp -0MQ provides the the following transports: -.PP -\fItcp\fR -.RS 4 -unicast transport using TCP, see -\fBzmq_tcp\fR(7) -.RE -.PP -\fIipc\fR -.RS 4 -local inter\-process communication transport, see -\fBzmq_ipc\fR(7) -.RE -.PP -\fIinproc\fR -.RS 4 -local in\-process (inter\-thread) communication transport, see -\fBzmq_inproc\fR(7) -.RE -.PP -\fIpgm\fR, \fIepgm\fR -.RS 4 -reliable multicast transport using PGM, see -\fBzmq_pgm\fR(7) -.RE -.PP -\fIvmci\fR -.RS 4 -virtual machine communications interface (VMCI), see -\fBzmq_vmci\fR(7) -.RE -.sp -Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. -.sp -The \fIipc\fR, \fItcp\fR and \fIvmci\fR transports accept wildcard addresses: see \fBzmq_ipc\fR(7), \fBzmq_tcp\fR(7) and \fBzmq_vmci\fR(7) for details\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -the address syntax may be different for \fIzmq_bind()\fR and \fIzmq_connect()\fR especially for the \fItcp\fR, \fIpgm\fR and \fIepgm\fR transports\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -following a \fIzmq_bind()\fR, the socket enters a \fImute\fR state unless or until at least one incoming or outgoing connection is made, at which point the socket enters a \fIready\fR state\&. In the mute state, the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. By contrast, following a libzmq:zmq_connect[3], the socket enters the \fIready\fR state\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_bind()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. -.RE -.PP -\fBENOCOMPATPROTO\fR -.RS 4 -The requested -\fItransport\fR -protocol is not compatible with the socket type\&. -.RE -.PP -\fBEADDRINUSE\fR -.RS 4 -The requested -\fIaddress\fR -is already in use\&. -.RE -.PP -\fBEADDRNOTAVAIL\fR -.RS 4 -The requested -\fIaddress\fR -was not local\&. -.RE -.PP -\fBENODEV\fR -.RS 4 -The requested -\fIaddress\fR -specifies a nonexistent interface\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEMTHREAD\fR -.RS 4 -No I/O thread is available to accomplish the task\&. -.RE -.SH "EXAMPLE" -.PP -\fBBinding a publisher socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_PUB socket */ -void *socket = zmq_socket (context, ZMQ_PUB); -assert (socket); -/* Bind it to a in\-process transport with the address \*(Aqmy_publisher\*(Aq */ -int rc = zmq_bind (socket, "inproc://my_publisher"); -assert (rc == 0); -/* Bind it to a TCP transport on port 5555 of the \*(Aqeth0\*(Aq interface */ -rc = zmq_bind (socket, "tcp://eth0:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 deleted file mode 100644 index f3b45dc49e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" t -.\" Title: zmq_close -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CLOSE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_close \- close 0MQ socket -.SH "SYNOPSIS" -.sp -\fBint zmq_close (void \fR\fB\fI*socket\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_close()\fR function shall destroy the socket referenced by the \fIsocket\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_ctx_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_ctx_term\fR(3)\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_socket\fR(3) \fBzmq_ctx_term\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 deleted file mode 100644 index ba263b85f8..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 +++ /dev/null @@ -1,177 +0,0 @@ -'\" t -.\" Title: zmq_connect -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CONNECT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_connect \- create outgoing connection from socket -.SH "SYNOPSIS" -.sp -\fBint zmq_connect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_connect()\fR function connects the \fIsocket\fR to an \fIendpoint\fR and then accepts incoming connections on that endpoint\&. -.sp -The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -0MQ provides the the following transports: -.PP -\fItcp\fR -.RS 4 -unicast transport using TCP, see -\fBzmq_tcp\fR(7) -.RE -.PP -\fIipc\fR -.RS 4 -local inter\-process communication transport, see -\fBzmq_ipc\fR(7) -.RE -.PP -\fIinproc\fR -.RS 4 -local in\-process (inter\-thread) communication transport, see -\fBzmq_inproc\fR(7) -.RE -.PP -\fIpgm\fR, \fIepgm\fR -.RS 4 -reliable multicast transport using PGM, see -\fBzmq_pgm\fR(7) -.RE -.PP -\fIvmci\fR -.RS 4 -virtual machine communications interface (VMCI), see -\fBzmq_vmci\fR(7) -.RE -.sp -Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -for most transports and socket types the connection is not performed immediately but as needed by 0MQ\&. Thus a successful call to \fIzmq_connect()\fR does not mean that the connection was or could actually be established\&. Because of this, for most transports and socket types the order in which a \fIserver\fR socket is bound and a \fIclient\fR socket is connected to it does not matter\&. The first exception is when using the inproc:// transport: you must call \fIzmq_bind()\fR before calling \fIzmq_connect()\fR\&. The second exception are \fIZMQ_PAIR\fR sockets, which do not automatically reconnect to endpoints\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -following a \fIzmq_connect()\fR, for socket types except for ZMQ_ROUTER, the socket enters its normal \fIready\fR state\&. By contrast, following a \fIzmq_bind()\fR alone, the socket enters a \fImute\fR state in which the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. A ZMQ_ROUTER socket enters its normal \fIready\fR state for a specific peer only when handshaking is complete for that peer, which may take an arbitrary time\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_connect()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. -.RE -.PP -\fBENOCOMPATPROTO\fR -.RS 4 -The requested -\fItransport\fR -protocol is not compatible with the socket type\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEMTHREAD\fR -.RS 4 -No I/O thread is available to accomplish the task\&. -.RE -.SH "EXAMPLE" -.PP -\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to an in\-process transport with the address \*(Aqmy_publisher\*(Aq */ -int rc = zmq_connect (socket, "inproc://my_publisher"); -assert (rc == 0); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_connect (socket, "tcp://server001:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 deleted file mode 100644 index fef5be6649..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" t -.\" Title: zmq_ctx_get -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CTX_GET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_get \- get context options -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_get (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_get()\fR function shall return the option specified by the \fIoption_name\fR argument\&. -.sp -The \fIzmq_ctx_get()\fR function accepts the following option names: -.SS "ZMQ_IO_THREADS: Get number of I/O threads" -.sp -The \fIZMQ_IO_THREADS\fR argument returns the size of the 0MQ thread pool for this context\&. -.SS "ZMQ_MAX_SOCKETS: Get maximum number of sockets" -.sp -The \fIZMQ_MAX_SOCKETS\fR argument returns the maximum number of sockets allowed for this context\&. -.SS "ZMQ_MAX_MSGSZ: Get maximum message size" -.sp -The \fIZMQ_MAX_MSGSZ\fR argument returns the maximum size of a message allowed for this context\&. Default value is INT_MAX\&. -.SS "ZMQ_SOCKET_LIMIT: Get largest configurable number of sockets" -.sp -The \fIZMQ_SOCKET_LIMIT\fR argument returns the largest number of sockets that \fBzmq_ctx_set\fR(3) will accept\&. -.SS "ZMQ_IPV6: Set IPv6 option" -.sp -The \fIZMQ_IPV6\fR argument returns the IPv6 option for the context\&. -.SS "ZMQ_BLOCKY: Get blocky setting" -.sp -The \fIZMQ_BLOCKY\fR argument returns 1 if the context will block on terminate, zero if the "block forever on context termination" gambit was disabled by setting ZMQ_BLOCKY to false on all new contexts\&. -.SS "ZMQ_MSG_T_SIZE: Get the zmq_msg_t size at runtime" -.sp -The \fIZMQ_MSG_T_SIZE\fR argument returns the size of the zmq_msg_t structure at runtime, as defined in the include/zmq\&.h public header\&. This is useful for example for FFI bindings that can\(cqt simply do a sizeof()\&. NOTE: in DRAFT state, not yet available in stable releases\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_get()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBSetting a limit on the number of sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *context = zmq_ctx_new (); -zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); -int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); -assert (max_sockets == 256); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSwitching off the context deadlock gambit\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_ctx_set (ctx, ZMQ_BLOCKY, false); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_ctx_set\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 deleted file mode 100644 index 23d1af87f7..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 +++ /dev/null @@ -1,55 +0,0 @@ -'\" t -.\" Title: zmq_ctx_new -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CTX_NEW" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_new \- create new 0MQ context -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_ctx_new ();\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_new()\fR function creates a new 0MQ \fIcontext\fR\&. -.sp -This function replaces the deprecated function \fBzmq_init\fR(3)\&. -.PP -\fBThread safety\fR. A 0MQ -\fIcontext\fR -is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_new()\fR function shall return an opaque handle to the newly created \fIcontext\fR if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.sp -No error values are defined for this function\&. -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_ctx_set\fR(3) \fBzmq_ctx_get\fR(3) \fBzmq_ctx_term\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 deleted file mode 100644 index b7d3e39cbc..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 +++ /dev/null @@ -1,186 +0,0 @@ -'\" t -.\" Title: zmq_ctx_set -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CTX_SET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_set \- set context options -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_set (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, int \fR\fB\fIoption_value\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_set()\fR function shall set the option specified by the \fIoption_name\fR argument to the value of the \fIoption_value\fR argument\&. -.sp -The \fIzmq_ctx_set()\fR function accepts the following options: -.SS "ZMQ_BLOCKY: Fix blocky behavior" -.sp -By default the context will block, forever, on a zmq_ctx_term call\&. The assumption behind this behavior is that abrupt termination will cause message loss\&. Most real applications use some form of handshaking to ensure applications receive termination messages, and then terminate the context with \fIZMQ_LINGER\fR set to zero on all sockets\&. This setting is an easier way to get the same result\&. When \fIZMQ_BLOCKY\fR is set to false, all new sockets are given a linger timeout of zero\&. You must still close all sockets before calling zmq_ctx_term\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -true (old behavior) -T} -.TE -.sp 1 -.SS "ZMQ_IO_THREADS: Set number of I/O threads" -.sp -The \fIZMQ_IO_THREADS\fR argument specifies the size of the 0MQ thread pool to handle I/O operations\&. If your application is using only the \fIinproc\fR transport for messaging you may set this to zero, otherwise set it to at least one\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -.TE -.sp 1 -.SS "ZMQ_THREAD_SCHED_POLICY: Set scheduling policy for I/O threads" -.sp -The \fIZMQ_THREAD_SCHED_POLICY\fR argument sets the scheduling policy for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -.TE -.sp 1 -.SS "ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads" -.sp -The \fIZMQ_THREAD_PRIORITY\fR argument sets scheduling priority for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option depend on chosen scheduling policy\&. Details can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -.TE -.sp 1 -.SS "ZMQ_MAX_MSGSZ: Set maximum message size" -.sp -The \fIZMQ_MAX_MSGSZ\fR argument sets the maximum allowed size of a message sent in the context\&. You can query the maximal allowed value with \fBzmq_ctx_get\fR(3) using the \fIZMQ_MAX_MSGSZ\fR option\&. -.TS -tab(:); -lt lt -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -INT_MAX -T} -T{ -.sp -Maximum value -T}:T{ -.sp -INT_MAX -T} -.TE -.sp 1 -.SS "ZMQ_MAX_SOCKETS: Set maximum number of sockets" -.sp -The \fIZMQ_MAX_SOCKETS\fR argument sets the maximum number of sockets allowed on the context\&. You can query the maximal allowed value with \fBzmq_ctx_get\fR(3) using the \fIZMQ_SOCKET_LIMIT\fR option\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -1024 -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Set IPv6 option" -.sp -The \fIZMQ_IPV6\fR argument sets the IPv6 value for all sockets created in the context from this point onwards\&. A value of 1 means IPv6 is enabled, while 0 means the socket will use only IPv4\&. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt. -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_set()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBSetting a limit on the number of sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *context = zmq_ctx_new (); -zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); -int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); -assert (max_sockets == 256); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_ctx_get\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 deleted file mode 100644 index 1e1d21dea3..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 +++ /dev/null @@ -1,58 +0,0 @@ -'\" t -.\" Title: zmq_ctx_shutdown -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CTX_SHUTDOWN" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_shutdown \- shutdown a 0MQ context -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_shutdown (void \fR\fB\fI*context\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_shutdown()\fR function shall shutdown the 0MQ context \fIcontext\fR\&. -.sp -Context shutdown will cause any blocking operations currently in progress on sockets open within \fIcontext\fR to return immediately with an error code of ETERM\&. With the exception of \fIzmq_close()\fR, any further operations on sockets open within \fIcontext\fR shall fail with an error code of ETERM\&. -.sp -This function is optional, client code is still required to call the \fBzmq_ctx_term\fR(3) function to free all resources allocated by zeromq\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_shutdown()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -was invalid\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_ctx_term\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 deleted file mode 100644 index c7a5700f4e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 +++ /dev/null @@ -1,126 +0,0 @@ -'\" t -.\" Title: zmq_ctx_term -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CTX_TERM" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ctx_term \- terminate a 0MQ context -.SH "SYNOPSIS" -.sp -\fBint zmq_ctx_term (void \fR\fB\fI*context\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_ctx_term()\fR function shall destroy the 0MQ context \fIcontext\fR\&. -.sp -Context termination is performed in the following steps: -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -Any blocking operations currently in progress on sockets open within -\fIcontext\fR -shall return immediately with an error code of ETERM\&. With the exception of -\fIzmq_close()\fR, any further operations on sockets open within -\fIcontext\fR -shall fail with an error code of ETERM\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -After interrupting all blocking calls, -\fIzmq_ctx_term()\fR -shall -\fIblock\fR -until the following conditions are satisfied: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -All sockets open within -\fIcontext\fR -have been closed with -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For each socket within -\fIcontext\fR, all messages sent by the application with -\fIzmq_send()\fR -have either been physically transferred to a network peer, or the socket\(cqs linger period set with the -\fIZMQ_LINGER\fR -socket option has expired\&. -.RE -.RE -.sp -For further details regarding socket linger behaviour refer to the \fIZMQ_LINGER\fR option in \fBzmq_setsockopt\fR(3)\&. -.sp -This function replaces the deprecated functions \fBzmq_term\fR(3) and \fBzmq_ctx_destroy\fR(3)\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_ctx_term()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -Termination was interrupted by a signal\&. It can be restarted if needed\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 deleted file mode 100644 index 5a58963cff..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 +++ /dev/null @@ -1,69 +0,0 @@ -'\" t -.\" Title: zmq_curve_keypair -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CURVE_KEYPAIR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_curve_keypair \- generate a new CURVE keypair -.SH "SYNOPSIS" -.sp -\fBint zmq_curve_keypair (char *z85_public_key, char *z85_secret_key);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_curve_keypair()\fR function shall return a newly generated random keypair consisting of a public key and a secret key\&. The caller provides two buffers, each at least 41 octets large, in which this method will store the keys\&. The keys are encoded using \fBzmq_z85_encode\fR(3)\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_curve_keypair()\fR function shall return 0 if successful, else it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOTSUP\fR -.RS 4 -The libzmq library was not built with cryptographic support (libsodium)\&. -.RE -.SH "EXAMPLE" -.PP -\fBGenerating a new CURVE keypair\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -char public_key [41]; -char secret_key [41]; -int rc = zmq_curve_keypair (public_key, secret_key); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_z85_encode\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 deleted file mode 100644 index f7dceeb5d9..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 +++ /dev/null @@ -1,73 +0,0 @@ -'\" t -.\" Title: zmq_curve_public -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CURVE_PUBLIC" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_curve_public \- derive the public key from a private key -.SH "SYNOPSIS" -.sp -\fBint zmq_curve_public (char *z85_public_key, char *z85_secret_key);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_curve_public()\fR function shall derive the public key from a private key\&. The caller provides two buffers, each at least 41 octets large\&. In z85_secret_key the caller shall provide the private key, and the function will store the public key in z85_public_key\&. The keys are encoded using \fBzmq_z85_encode\fR(3)\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_curve_public()\fR function shall return 0 if successful, else it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOTSUP\fR -.RS 4 -The libzmq library was not built with cryptographic support (libsodium)\&. -.RE -.SH "EXAMPLE" -.PP -\fBDeriving the public key from a CURVE private key\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -char public_key [41]; -char secret_key [41]; -int rc = zmq_curve_keypair (public_key, secret_key); -assert (rc == 0); -char derived_public[41]; -rc = zmq_curve_public (derived_public, secret_key); -assert (rc == 0); -assert (!strcmp (derived_public, public_key)); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_z85_encode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 deleted file mode 100644 index ff5075fd31..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 +++ /dev/null @@ -1,113 +0,0 @@ -'\" t -.\" Title: zmq_disconnect -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_DISCONNECT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_disconnect \- Disconnect a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_disconnect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_disconnect()\fR function shall disconnect a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. -.sp -The \fIendpoint\fR argument is as described in \fBzmq_connect\fR(3) -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_ctx_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_ctx_term\fR(3)\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_disconnect()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBENOENT\fR -.RS 4 -The provided endpoint is not connected\&. -.RE -.SH "EXAMPLE" -.PP -\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_connect (socket, "tcp://server001:5555"); -assert (rc == 0); -/* Disconnect from the previously connected endpoint */ -rc = zmq_disconnect (socket, "tcp://server001:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 deleted file mode 100644 index b7cb977fd1..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_errno -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_ERRNO" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_errno \- retrieve value of errno for the calling thread -.SH "SYNOPSIS" -.sp -\fBint zmq_errno (void);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_errno()\fR function shall retrieve the value of the \fIerrno\fR variable for the calling thread\&. -.sp -The \fIzmq_errno()\fR function is provided to assist users on non\-POSIX systems who are experiencing issues with retrieving the correct value of \fIerrno\fR directly\&. Specifically, users on Win32 systems whose application is using a different C run\-time library from the C run\-time library in use by 0MQ will need to use \fIzmq_errno()\fR for correct operation\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.sp -Users not experiencing issues with retrieving the correct value of \fIerrno\fR should not use this function and should instead access the \fIerrno\fR variable directly\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_errno()\fR function shall return the value of the \fIerrno\fR variable for the calling thread\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 deleted file mode 100644 index 7a51c1e678..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 +++ /dev/null @@ -1,2298 +0,0 @@ -'\" t -.\" Title: zmq_getsockopt -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_GETSOCKOPT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_getsockopt \- get 0MQ socket options -.SH "SYNOPSIS" -.sp -\fBint zmq_getsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fI*option_len\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_getsockopt()\fR function shall retrieve the value for the option specified by the \fIoption_name\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument, and store it in the buffer pointed to by the \fIoption_value\fR argument\&. The \fIoption_len\fR argument is the size in bytes of the buffer pointed to by \fIoption_value\fR; upon successful completion \fIzmq_getsockopt()\fR shall modify the \fIoption_len\fR argument to indicate the actual size of the option value stored in the buffer\&. -.sp -The following options can be retrieved with the \fIzmq_getsockopt()\fR function: -.SS "ZMQ_AFFINITY: Retrieve I/O thread affinity" -.sp -The \fIZMQ_AFFINITY\fR option shall retrieve the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. -.sp -Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. -.sp -See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (bitmap) -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.SS "ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections" -.sp -The \fIZMQ_BACKLOG\fR option shall retrieve the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -connections -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout" -.sp -Retrieves how long to wait before timing\-out a connect() system call\&. The connect() system call normally takes a long time before it returns a time out error\&. Setting this option allows the library to time out the call at an earlier interval\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (disabled) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key" -.sp -Retrieves the current long term public key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key" -.sp -Retrieves the current long term secret key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key" -.sp -Retrieves the current server key for the client socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41\-byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -null -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_EVENTS: Retrieve socket event state" -.sp -The \fIZMQ_EVENTS\fR option shall retrieve the event state for the specified \fIsocket\fR\&. The returned value is a bit mask constructed by OR\(cqing a combination of the following event flags: -.PP -\fBZMQ_POLLIN\fR -.RS 4 -Indicates that at least one message may be received from the specified socket without blocking\&. -.RE -.PP -\fBZMQ_POLLOUT\fR -.RS 4 -Indicates that at least one message may be sent to the specified socket without blocking\&. -.RE -.sp -The combination of a file descriptor returned by the \fIZMQ_FD\fR option being ready for reading but no actual events returned by a subsequent retrieval of the \fIZMQ_EVENTS\fR option is valid; applications should simply ignore this case and restart their polling operation/event loop\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (flags) -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_FD: Retrieve file descriptor associated with the socket" -.sp -The \fIZMQ_FD\fR option shall retrieve the file descriptor associated with the specified \fIsocket\fR\&. The returned file descriptor can be used to integrate the socket into an existing event loop; the 0MQ library shall signal any pending events on the socket in an \fIedge\-triggered\fR fashion by making the file descriptor become ready for reading\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The ability to read from the returned file descriptor does not necessarily indicate that messages are available to be read from, or can be written to, the underlying socket; applications must retrieve the actual event state with a subsequent retrieval of the \fIZMQ_EVENTS\fR option\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The returned file descriptor is also used internally by the \fIzmq_send\fR and \fIzmq_recv\fR functions\&. As the descriptor is edge triggered, applications must update the state of \fIZMQ_EVENTS\fR after each invocation of \fIzmq_send\fR or \fIzmq_recv\fR\&.To be more explicit: after calling \fIzmq_send\fR the socket may become readable (and vice versa) without triggering a read event on the file descriptor\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The returned file descriptor is intended for use with a \fIpoll\fR or similar system call only\&. Applications must never attempt to read or write data to it directly, neither should they try to close it\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int on POSIX systems, SOCKET on Windows -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status" -.sp -Returns the \fIZMQ_GSSAPI_PLAINTEXT\fR option, if any, previously set on the socket\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal" -.sp -The \fIZMQ_GSSAPI_PRINCIPAL\fR option shall retrieve the principal name set for the GSSAPI security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role" -.sp -Returns the \fIZMQ_GSSAPI_SERVER\fR option, if any, previously set on the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal" -.sp -The \fIZMQ_GSSAPI_SERVICE_PRINCIPAL\fR option shall retrieve the principal name of the GSSAPI server to which a GSSAPI client socket intends to connect\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval" -.sp -The \fIZMQ_HANDSHAKE_IVL\fR option shall retrieve the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -30000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all but ZMQ_STREAM, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_IDENTITY: Retrieve socket identity" -.sp -The \fIZMQ_IDENTITY\fR option shall retrieve the identity of the specified \fIsocket\fR\&. Socket identity is used only by request/reply pattern\&. Namely, it can be used in tandem with ROUTER socket to route messages to the peer with specific identity\&. -.sp -Identity should be at least one byte and at most 255 bytes long\&. Identities starting with binary zero are reserved for use by 0MQ infrastructure\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REP, ZMQ_REQ, ZMQ_ROUTER, ZMQ_DEALER\&. -T} -.TE -.sp 1 -.SS "ZMQ_IMMEDIATE: Retrieve attach\-on\-connect value" -.sp -Retrieve the state of the attach on connect value\&. If set to 1, will delay the attachment of a pipe on connect until the underlying connection has completed\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, primarily when using TCP/IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_INVERT_MATCHING: Retrieve inverted filtering status" -.sp -Returns the value of the \fIZMQ_INVERT_MATCHING\fR option\&. A value of 1 means the socket uses inverted prefix matching\&. -.sp -On \fIPUB\fR and \fIXPUB\fR sockets, this causes messages to be sent to all connected sockets \fIexcept\fR those subscribed to a prefix that matches the message\&. On \fISUB\fR sockets, this causes only incoming messages that do \fInot\fR match any of the socket\(cqs subscriptions to be received by the user\&. -.sp -Whenever \fIZMQ_INVERT_MATCHING\fR is set to 1 on a \fIPUB\fR socket, all \fISUB\fR sockets connecting to it must also have the option set to 1\&. Failure to do so will have the \fISUB\fR sockets reject everything the \fIPUB\fR socket sends them\&. \fIXSUB\fR sockets do not need to do this because they do not filter incoming messages\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_IPV4ONLY: Retrieve IPv4\-only socket override status" -.sp -Retrieve the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -1 (true) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Retrieve IPv6 socket status" -.sp -Retrieve the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set" -.sp -The \fIZMQ_LAST_ENDPOINT\fR option shall retrieve the last endpoint bound for TCP and IPC transports\&. The returned value will be a string in the form of a ZMQ DSN\&. Note that if the TCP host is INADDR_ANY, indicated by a *, then the returned address will be 0\&.0\&.0\&.0 (for IPv4)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when binding TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_LINGER: Retrieve linger period for socket shutdown" -.sp -The \fIZMQ_LINGER\fR option shall retrieve the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_ctx_term\fR(3)\&. The following outlines the different behaviours: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The default value of -\fI\-1\fR -specifies an infinite linger period\&. Pending messages shall not be discarded after a call to -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_ctx_term()\fR -shall block until all pending messages have been sent to a peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The value of -\fI0\fR -specifies no linger period\&. Pending messages shall be discarded immediately when the socket is closed with -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_ctx_term()\fR -shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -Option value type -T}:T{ -int -T} -T{ -Option value unit -T}:T{ -milliseconds -T} -T{ -Default value -T}:T{ -\-1 (infinite) -T} -T{ -Applicable socket types -T}:T{ -all -T} -.TE -.sp 1 -.RE -.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" -.sp -The option shall retrieve limit for the inbound messages\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_MECHANISM: Retrieve current security mechanism" -.sp -The \fIZMQ_MECHANISM\fR option shall retrieve the current security mechanism for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -ZMQ_NULL, ZMQ_PLAIN, ZMQ_CURVE, or ZMQ_GSSAPI -T} -T{ -.sp -Default value -T}:T{ -.sp -ZMQ_NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" -.sp -The option shall retrieve time\-to\-live used for outbound multicast packets\&. The default of 1 means that the multicast packets don\(cqt leave the local network\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -network hops -T} -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets" -.sp -The \fIZMQ_MULTICAST_MAXTPDU\fR option shall retrieve the maximum transport data unit size used for outbound multicast packets\&. -.sp -This must be set at or below the minimum Maximum Transmission Unit (MTU) for all network paths over which multicast reception is required\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -1500 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_PASSWORD: Retrieve current password" -.sp -The \fIZMQ_PLAIN_PASSWORD\fR option shall retrieve the last password set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role" -.sp -Returns the \fIZMQ_PLAIN_SERVER\fR option, if any, previously set on the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -int -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username" -.sp -The \fIZMQ_PLAIN_USERNAME\fR option shall retrieve the last username set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP or IPC transports -T} -.TE -.sp 1 -.SS "ZMQ_USE_FD: Retrieve the pre\-allocated socket file descriptor" -.sp -The \fIZMQ_USE_FD\fR option shall retrieve the pre\-allocated file descriptor that has been assigned to a ZMQ socket, if any\&. \-1 shall be returned if a pre\-allocated file descriptor was not set for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -file descriptor -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all bound sockets, when using IPC or TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_RATE: Retrieve multicast data rate" -.sp -The \fIZMQ_RATE\fR option shall retrieve the maximum send or receive data rate for multicast transports using the specified \fIsocket\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -kilobits per second -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_RCVBUF: Retrieve kernel receive buffer size" -.sp -The \fIZMQ_RCVBUF\fR option shall retrieve the underlying kernel receive buffer size for the specified \fIsocket\fR\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -8192 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVHWM: Retrieve high water mark for inbound messages" -.sp -The \fIZMQ_RCVHWM\fR option shall return the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVMORE: More message data parts to follow" -.sp -The \fIZMQ_RCVMORE\fR option shall return True (1) if the message part last received from the \fIsocket\fR was a data part with more parts to follow\&. If there are no data parts to follow, this option shall return False (0)\&. -.sp -Refer to \fBzmq_send\fR(3) and \fBzmq_recv\fR(3) for a detailed description of multi\-part messages\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN" -.sp -Retrieve the timeout for recv operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL: Retrieve reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL\fR option shall retrieve the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL_MAX\fR option shall retrieve the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Values less than ZMQ_RECONNECT_IVL will be ignored\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (only use ZMQ_RECONNECT_IVL) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transport -T} -.TE -.sp 1 -.SS "ZMQ_RECOVERY_IVL: Get multicast recovery interval" -.sp -The \fIZMQ_RECOVERY_IVL\fR option shall retrieve the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -10000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_SNDBUF: Retrieve kernel transmit buffer size" -.sp -The \fIZMQ_SNDBUF\fR option shall retrieve the underlying kernel transmit buffer size for the specified \fIsocket\fR\&. For details refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -8192 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDHWM: Retrieves high water mark for outbound messages" -.sp -The \fIZMQ_SNDHWM\fR option shall return the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN" -.sp -Retrieve the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SOCKS_PROXY: Retrieve SOCKS5 proxy address" -.sp -The \fIZMQ_SOCKS_PROXY\fR option shall retrieve the SOCKS5 proxy address in string format\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -NULL\-terminated character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -null string -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" -.sp -Override \fISO_KEEPALIVE\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" -.sp -Override \fITCP_KEEPCNT\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)" -.sp -Override \fITCP_KEEPIDLE\fR(or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" -.sp -Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout" -.sp -On OSes where it is supported, retrieves how long before an unacknowledged TCP retransmit times out\&. The system normally attempts many TCP retransmits following an exponential backoff strategy\&. This means that after a network outage, it may take a long time before the session can be re\-established\&. Setting this option allows the timeout to happen at a shorter interval\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_THREAD_SAFE: Retrieve socket thread safety" -.sp -The \fIZMQ_THREAD_SAFE\fR option shall retrieve a boolean value indicating whether or not the socket is threadsafe\&. Currently \fIZMQ_CLIENT\fR and \fIZMQ_SERVER\fR sockets are threadsafe\&. -.TS -tab(:); -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -boolean -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_TOS: Retrieve the Type\-of\-Service socket override status" -.sp -Retrieve the IP_TOS option for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp ->0 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_TYPE: Retrieve socket type" -.sp -The \fIZMQ_TYPE\fR option shall retrieve the socket type for the specified \fIsocket\fR\&. The socket type is specified at socket creation time and cannot be modified afterwards\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain" -.sp -The \fIZMQ_ZAP_DOMAIN\fR option shall retrieve the last ZAP domain set for the socket\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_SIZE option shall retrieve the size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -65546 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_MIN_SIZE option shall retrieve the min size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -128 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_MAX_SIZE option shall retrieve the max size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -262144 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket" -.sp -The ZMQ_VMCI_CONNECT_TIMEOUT option shall retrieve connection timeout for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_getsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown, or the requested -\fIoption_len\fR -or -\fIoption_value\fR -is invalid, or the size of the buffer pointed to by -\fIoption_value\fR, as specified by -\fIoption_len\fR, is insufficient for storing the option value\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal\&. -.RE -.SH "EXAMPLE" -.PP -\fBRetrieving the high water mark for outgoing messages\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Retrieve high water mark into sndhwm */ -int sndhwm; -size_t sndhwm_size = sizeof (sndhwm); -rc = zmq_getsockopt (socket, ZMQ_SNDHWM, &sndhwm, &sndhwm_size); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_setsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 deleted file mode 100644 index 37a0100105..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 +++ /dev/null @@ -1,124 +0,0 @@ -'\" t -.\" Title: zmq_has -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_HAS" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_has \- check a ZMQ capability -.SH "SYNOPSIS" -.sp -\fBint zmq_has (const char *capability);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_has()\fR function shall report whether a specified capability is available in the library\&. This allows bindings and applications to probe a library directly, for transport and security options\&. -.sp -Capabilities shall be lowercase strings\&. The following capabilities are defined: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ipc \- the library supports the ipc:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -pgm \- the library supports the pgm:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -tipc \- the library supports the tipc:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -norm \- the library supports the norm:// protocol -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -curve \- the library supports the CURVE security mechanism -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -gssapi \- the library supports the GSSAPI security mechanism -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -draft \- the library is built with the draft api -.RE -.sp -When this method is provided, the zmq\&.h header file will define ZMQ_HAS_CAPABILITIES\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_has()\fR function shall return 1 if the specified capability is provided\&. Otherwise it shall return 0\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 deleted file mode 100644 index 098a5a8b3c..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" t -.\" Title: zmq_msg_close -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_CLOSE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_close \- release 0MQ message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_close (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_close()\fR function shall inform the 0MQ infrastructure that any resources associated with the message object referenced by \fImsg\fR are no longer required and may be released\&. Actual release of resources associated with the message object shall be postponed by 0MQ until all users of the message or underlying data buffer have indicated it is no longer required\&. -.sp -Applications should ensure that \fIzmq_msg_close()\fR is called once a message is no longer required, otherwise memory leaks may occur\&. Note that this is NOT necessary after a successful \fIzmq_msg_send()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 deleted file mode 100644 index d8136ef9aa..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" t -.\" Title: zmq_msg_copy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_COPY" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_copy \- copy content of a message to another message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_copy (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_copy()\fR function shall copy the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. The original content of \fIdest\fR, if any, shall be released\&. You must initialise \fIdest\fR before copying to it\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The implementation may choose not to physically copy the message content, rather to share the underlying buffer between \fIsrc\fR and \fIdest\fR\&. Avoid modifying message content after a message has been copied with \fIzmq_msg_copy()\fR, doing so can result in undefined behaviour\&. If what you need is an actual hard copy, allocate a new message using \fIzmq_msg_init_size()\fR and copy the message content using \fImemcpy()\fR\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_copy()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "EXAMPLE" -.PP -\fBCopying a message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -zmq_msg_init_size (&msg, 255); -memcpy (zmq_msg_data (&msg, "Hello, World", 12); -zmq_msg_t copy; -zmq_msg_init (©); -zmq_msg_copy (©, &msg); -\&.\&.\&. -zmq_msg_close (©); -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_move\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 deleted file mode 100644 index 7525f5cce8..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 +++ /dev/null @@ -1,65 +0,0 @@ -'\" t -.\" Title: zmq_msg_data -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_DATA" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_data \- retrieve pointer to message content -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_msg_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_data()\fR function shall return a pointer to the message content of the message object referenced by \fImsg\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, \fIzmq_msg_data()\fR shall return a pointer to the message content\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq_msg_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 deleted file mode 100644 index ec1764be38..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 +++ /dev/null @@ -1,104 +0,0 @@ -'\" t -.\" Title: zmq_msg_get -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_GET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_get \- get message property -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_get (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_get()\fR function shall return the value for the property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. -.sp -The following properties can be retrieved with the \fIzmq_msg_get()\fR function: -.PP -\fBZMQ_MORE\fR -.RS 4 -Indicates that there are more message frames to follow after the -\fImessage\fR\&. -.RE -.PP -\fBZMQ_SRCFD\fR -.RS 4 -Returns the file descriptor of the socket the -\fImessage\fR -was read from\&. This allows application to retrieve the remote endpoint via -\fIgetpeername(2)\fR\&. Be aware that the respective socket might be closed already, reused even\&. Currently only implemented for TCP sockets\&. -.RE -.PP -\fBZMQ_SHARED\fR -.RS 4 -Indicates that a message MAY share underlying storage with another copy of this message\&. -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_get()\fR function shall return the value for the property if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested -\fIproperty\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a multi-frame message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t frame; -while (true) { - // Create an empty 0MQ message to hold the message frame - int rc = zmq_msg_init (&frame); - assert (rc == 0); - // Block until a message is available to be received from socket - rc = zmq_msg_recv (socket, &frame, 0); - assert (rc != \-1); - if (zmq_msg_get (&frame, ZMQ_MORE)) - fprintf (stderr, "more\en"); - else { - fprintf (stderr, "end\en"); - break; - } - zmq_msg_close (&frame); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 deleted file mode 100644 index 2624896f60..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 +++ /dev/null @@ -1,93 +0,0 @@ -'\" t -.\" Title: zmq_msg_gets -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_GETS" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_gets \- get message metadata property -.SH "SYNOPSIS" -.sp -\fBconst char *zmq_msg_gets (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, const char *\fR\fB\fIproperty\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_gets()\fR function shall return the string value for the metadata property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. Both the \fIproperty\fR argument and the \fIvalue\fR shall be NULL\-terminated UTF8\-encoded strings\&. -.sp -Metadata is defined on a per\-connection basis during the ZeroMQ connection handshake as specified in \&. -.sp -The following ZMTP properties can be retrieved with the \fIzmq_msg_gets()\fR function: -.sp -.if n \{\ -.RS 4 -.\} -.nf -Socket\-Type -Identity -Resource -.fi -.if n \{\ -.RE -.\} -.sp -Additionally, when available for the underlying transport, the \fBPeer\-Address\fR property will return the IP address of the remote endpoint as returned by getnameinfo(2)\&. -.sp -Other properties may be defined based on the underlying security mechanism, see ZAP authenticated connection sample below\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_gets()\fR function shall return the string value for the property if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. The caller shall not modify or free the returned value, which shall be owned by the message\&. The encoding of the property and value shall be UTF8\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested -\fIproperty\fR -is unknown\&. -.RE -.SH "EXAMPLE" -.PP -\fBGetting the ZAP authenticated user id for a message:\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -zmq_msg_init (&msg); -rc = zmq_msg_recv (&msg, dealer, 0); -assert (rc != \-1); -const char *user_id = zmq_msg_gets (&msg, "User\-Id"); -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 deleted file mode 100644 index baf280b251..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 +++ /dev/null @@ -1,99 +0,0 @@ -'\" t -.\" Title: zmq_msg_init -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init \- initialise empty 0MQ message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_init (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init()\fR function shall initialise the message object referenced by \fImsg\fR to represent an empty message\&. This function is most useful when called before receiving a message with \fIzmq_recv()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init()\fR function always returns zero\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t msg; -rc = zmq_msg_init (&msg); -assert (rc == 0); -int nbytes = zmq_recv (socket, &msg, 0); -assert (nbytes != \-1); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 deleted file mode 100644 index 1130b76c72..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 +++ /dev/null @@ -1,146 +0,0 @@ -'\" t -.\" Title: zmq_msg_init_data -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT_DATA" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init_data \- initialise 0MQ message from a supplied buffer -.SH "SYNOPSIS" -.sp -\fBtypedef void (zmq_free_fn) (void \fR\fB\fI*data\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR -.sp -\fBint zmq_msg_init_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*data\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB, zmq_free_fn \fR\fB\fI*ffn\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init_data()\fR function shall initialise the message object referenced by \fImsg\fR to represent the content referenced by the buffer located at address \fIdata\fR, \fIsize\fR bytes long\&. No copy of \fIdata\fR shall be performed and 0MQ shall take ownership of the supplied buffer\&. -.sp -If provided, the deallocation function \fIffn\fR shall be called once the data buffer is no longer required by 0MQ, with the \fIdata\fR and \fIhint\fR arguments supplied to \fIzmq_msg_init_data()\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The deallocation function \fIffn\fR needs to be thread\-safe, since it will be called from an arbitrary thread\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -If the deallocation function is not provided, the allocated memory will not be freed, and this may cause a memory leak\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init_data()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOMEM\fR -.RS 4 -Insufficient storage space is available\&. -.RE -.SH "EXAMPLE" -.PP -\fBInitialising a message from a supplied buffer\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void my_free (void *data, void *hint) -{ - free (data); -} - - /* \&.\&.\&. */ - -void *data = malloc (6); -assert (data); -memcpy (data, "ABCDEF", 6); -zmq_msg_t msg; -rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 deleted file mode 100644 index f0f4eb51ed..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 +++ /dev/null @@ -1,86 +0,0 @@ -'\" t -.\" Title: zmq_msg_init_size -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_INIT_SIZE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_init_size \- initialise 0MQ message of a specified size -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_init_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_init_size()\fR function shall allocate any resources required to store a message \fIsize\fR bytes long and initialise the message object referenced by \fImsg\fR to represent the newly allocated message\&. -.sp -The implementation shall choose whether to store message content on the stack (small messages) or on the heap (large messages)\&. For performance reasons \fIzmq_msg_init_size()\fR shall not clear the message data\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_init_size()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBENOMEM\fR -.RS 4 -Insufficient storage space is available\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_init_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 deleted file mode 100644 index d10ff83f89..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 +++ /dev/null @@ -1,75 +0,0 @@ -'\" t -.\" Title: zmq_msg_more -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_MORE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_more \- indicate if there are more message parts to receive -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_more (zmq_msg_t \fR\fB\fI*message\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_more()\fR function indicates whether this is part of a multi\-part message, and there are further parts to receive\&. This method can safely be called after \fIzmq_msg_close()\fR\&. This method is identical to \fIzmq_msg_get()\fR with an argument of ZMQ_MORE\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_more()\fR function shall return zero if this is the final part of a multi\-part message, or the only part of a single\-part message\&. It shall return 1 if there are further parts to receive\&. -.SH "EXAMPLE" -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_msg_t part; -while (true) { - // Create an empty 0MQ message to hold the message part - int rc = zmq_msg_init (&part); - assert (rc == 0); - // Block until a message is available to be received from socket - rc = zmq_msg_recv (socket, &part, 0); - assert (rc != \-1); - if (zmq_msg_more (&part)) - fprintf (stderr, "more\en"); - else { - fprintf (stderr, "end\en"); - break; - } - zmq_msg_close (&part); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_get\fR(3) \fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 deleted file mode 100644 index 7328f99464..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 +++ /dev/null @@ -1,68 +0,0 @@ -'\" t -.\" Title: zmq_msg_move -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_MOVE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_move \- move content of a message to another message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_move (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_move()\fR function shall move the content of the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. No actual copying of message content is performed, \fIdest\fR is simply updated to reference the new content\&. \fIsrc\fR becomes an empty message after calling \fIzmq_msg_move()\fR\&. The original content of \fIdest\fR, if any, shall be released\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_move()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_copy\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 deleted file mode 100644 index 3f8b8a3e7b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 +++ /dev/null @@ -1,161 +0,0 @@ -'\" t -.\" Title: zmq_msg_recv -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_RECV" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_recv \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_recv (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_recv()\fR function is identical to \fBzmq_recvmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_recv()\fR is more consistent with other message manipulation functions\&. -.sp -The \fIzmq_msg_recv()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_msg_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_msg_recv()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_msg_recv()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_recv()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_msg_recv()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_msg_recv()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The message passed to the function was invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create an empty 0MQ message */ -zmq_msg_t msg; -int rc = zmq_msg_init (&msg); -assert (rc == 0); -/* Block until a message is available to be received from socket */ -rc = zmq_msg_recv (&msg, socket, 0); -assert (rc != \-1); -/* Release message */ -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int more; -size_t more_size = sizeof (more); -do { - /* Create an empty 0MQ message to hold the message part */ - zmq_msg_t part; - int rc = zmq_msg_init (&part); - assert (rc == 0); - /* Block until a message is available to be received from socket */ - rc = zmq_msg_recv (&part, socket, 0); - assert (rc != \-1); - /* Determine if more message parts are to follow */ - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - zmq_msg_close (&part); -} while (more); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 deleted file mode 100644 index 94a832143b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 +++ /dev/null @@ -1,76 +0,0 @@ -'\" t -.\" Title: zmq_msg_routing_id -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_ROUTING_ID" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_routing_id \- return routing ID for message, if any -.SH "SYNOPSIS" -.sp -\fBuint32_t zmq_msg_routing_id (zmq_msg_t \fR\fB\fI*message\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_routing_id()\fR function returns the routing ID for the message, if any\&. The routing ID is set on all messages received from a \fIZMQ_SERVER\fR socket\&. To send a message to a \fIZMQ_SERVER\fR socket you must set the routing ID of a connected \fIZMQ_CLIENT\fR peer\&. Routing IDs are transient\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_routing_id()\fR function shall return zero if there is no routing ID, otherwise it shall return an unsigned 32\-bit integer greater than zero\&. -.SH "EXAMPLE" -.PP -\fBReceiving a client message and routing ID\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *ctx = zmq_ctx_new (); -assert (ctx); - -void *server = zmq_socket (ctx, ZMQ_SERVER); -assert (server); -int rc = zmq_bind (server, "tcp://127\&.0\&.0\&.1:8080"); -assert (rc == 0); - -zmq_msg_t message; -rc = zmq_msg_init (&message); -assert (rc == 0); - -// Receive a message from socket -rc = zmq_msg_recv (server, &message, 0); -assert (rc != \-1); -uint32_t routing_id = zmq_msg_routing_id (&message); -assert (routing_id); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_msg_set_routing_id\fR(3) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 deleted file mode 100644 index a6070a8672..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 +++ /dev/null @@ -1,184 +0,0 @@ -'\" t -.\" Title: zmq_msg_send -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_SEND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_send \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_send (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_send()\fR function is identical to \fBzmq_sendmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_send()\fR is more consistent with other message manipulation functions\&. -.sp -The \fIzmq_msg_send()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_msg_send()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.sp -The \fIzmq_msg_t\fR structure passed to \fIzmq_msg_send()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_msg_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. You do not need to call \fIzmq_msg_close()\fR after a successful \fIzmq_msg_send()\fR\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_msg_send()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEINVAL\fR -.RS 4 -The sender tried to send multipart data, which the socket type does not allow\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_msg_send()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBFilling in a message and sending it to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a new message, allocating 6 bytes for message content */ -zmq_msg_t msg; -int rc = zmq_msg_init_size (&msg, 6); -assert (rc == 0); -/* Fill in message content with \*(AqAAAAAA\*(Aq */ -memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); -/* Send the message to the socket */ -rc = zmq_msg_send (&msg, socket, 0); -assert (rc == 6); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_msg_send (&part1, socket, ZMQ_SNDMORE); -rc = zmq_msg_send (&part2, socket, ZMQ_SNDMORE); -/* Final part; no more parts to follow */ -rc = zmq_msg_send (&part3, socket, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 deleted file mode 100644 index a2c5da543b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 +++ /dev/null @@ -1,56 +0,0 @@ -'\" t -.\" Title: zmq_msg_set -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_SET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_set \- set message property -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_set (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB, int \fR\fB\fIvalue\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_set()\fR function shall set the property specified by the \fIproperty\fR argument to the value of the \fIvalue\fR argument for the 0MQ message fragment pointed to by the \fImessage\fR argument\&. -.sp -Currently the \fIzmq_msg_set()\fR function does not support any property names\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_set()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested property -\fIproperty\fR -is unknown\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_get\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 deleted file mode 100644 index c11c84cd67..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 +++ /dev/null @@ -1,54 +0,0 @@ -'\" t -.\" Title: zmq_msg_set_routing_id -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_SET_ROUTING_" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_set_routing_id \- set routing ID property on message -.SH "SYNOPSIS" -.sp -\fBint zmq_msg_set_routing_id (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, uint32_t \fR\fB\fIrouting_id\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_set_routing_id()\fR function sets the \fIrouting_id\fR specified, on the the message pointed to by the \fImessage\fR argument\&. The \fIrouting_id\fR must be greater than zero\&. To get a valid routing ID, you must receive a message from a \fIZMQ_SERVER\fR socket, and use the libzmq:zmq_msg_routing_id method\&. Routing IDs are transient\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_msg_set_routing_id()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The provided -\fIrouting_id\fR -is zero\&. -.RE -.SH "SEE ALSO" -.sp -\fBzmq_msg_routing_id\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 deleted file mode 100644 index 7e808b7223..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 +++ /dev/null @@ -1,65 +0,0 @@ -'\" t -.\" Title: zmq_msg_size -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_MSG_SIZE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_msg_size \- retrieve message content size in bytes -.SH "SYNOPSIS" -.sp -\fBsize_t zmq_msg_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_msg_size()\fR function shall return the size in bytes of the content of the message object referenced by \fImsg\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, \fIzmq_msg_size()\fR shall return the size of the message content in bytes\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "SEE ALSO" -.sp -\fBzmq_msg_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 deleted file mode 100644 index 928bde440e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 +++ /dev/null @@ -1,182 +0,0 @@ -'\" t -.\" Title: zmq_poll -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_POLL" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_poll \- input/output multiplexing -.SH "SYNOPSIS" -.sp -\fBint zmq_poll (zmq_pollitem_t \fR\fB\fI*items\fR\fR\fB, int \fR\fB\fInitems\fR\fR\fB, long \fR\fB\fItimeout\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_poll()\fR function provides a mechanism for applications to multiplex input/output events in a level\-triggered fashion over a set of sockets\&. Each member of the array pointed to by the \fIitems\fR argument is a \fBzmq_pollitem_t\fR structure\&. The \fInitems\fR argument specifies the number of items in the \fIitems\fR array\&. The \fBzmq_pollitem_t\fR structure is defined as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf -typedef struct -{ - void \fI*socket\fR; - int \fIfd\fR; - short \fIevents\fR; - short \fIrevents\fR; -} zmq_pollitem_t; -.fi -.if n \{\ -.RE -.\} -.sp -For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall examine either the 0MQ socket referenced by \fIsocket\fR \fBor\fR the standard socket specified by the file descriptor \fIfd\fR, for the event(s) specified in \fIevents\fR\&. If both \fIsocket\fR and \fIfd\fR are set in a single \fBzmq_pollitem_t\fR, the 0MQ socket referenced by \fIsocket\fR shall take precedence and the value of \fIfd\fR shall be ignored\&. -.sp -For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall first clear the \fIrevents\fR member, and then indicate any requested events that have occurred by setting the bit corresponding to the event condition in the \fIrevents\fR member\&. -.sp -If none of the requested events have occurred on any \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall wait \fItimeout\fR milliseconds for an event to occur on any of the requested items\&. If the value of \fItimeout\fR is 0, \fIzmq_poll()\fR shall return immediately\&. If the value of \fItimeout\fR is \-1, \fIzmq_poll()\fR shall block indefinitely until a requested event has occurred on at least one \fBzmq_pollitem_t\fR\&. -.sp -The \fIevents\fR and \fIrevents\fR members of \fBzmq_pollitem_t\fR are bit masks constructed by OR\(cqing a combination of the following event flags: -.PP -\fBZMQ_POLLIN\fR -.RS 4 -For 0MQ sockets, at least one message may be received from the -\fIsocket\fR -without blocking\&. For standard sockets this is equivalent to the -\fIPOLLIN\fR -flag of the -\fIpoll()\fR -system call and generally means that at least one byte of data may be read from -\fIfd\fR -without blocking\&. -.RE -.PP -\fBZMQ_POLLOUT\fR -.RS 4 -For 0MQ sockets, at least one message may be sent to the -\fIsocket\fR -without blocking\&. For standard sockets this is equivalent to the -\fIPOLLOUT\fR -flag of the -\fIpoll()\fR -system call and generally means that at least one byte of data may be written to -\fIfd\fR -without blocking\&. -.RE -.PP -\fBZMQ_POLLERR\fR -.RS 4 -For standard sockets, this flag is passed through -\fIzmq_poll()\fR -to the underlying -\fIpoll()\fR -system call and generally means that some sort of error condition is present on the socket specified by -\fIfd\fR\&. For 0MQ sockets this flag has no effect if set in -\fIevents\fR, and shall never be returned in -\fIrevents\fR -by -\fIzmq_poll()\fR\&. -.RE -.PP -\fBZMQ_POLLPRI\fR -.RS 4 -For 0MQ sockets this flags is of no use\&. For standard sockets this means there is urgent data to read\&. Refer to the POLLPRI flag for more informations\&. For file descriptor, refer to your use case: as an example, GPIO interrupts are signaled through a POLLPRI event\&. This flag has no effect on Windows\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The \fIzmq_poll()\fR function may be implemented or emulated using operating system interfaces other than \fIpoll()\fR, and as such may be subject to the limits of those interfaces in ways not defined in this documentation\&. -.sp .5v -.RE -.SH "RETURN VALUE" -.sp -Upon successful completion, the \fIzmq_poll()\fR function shall return the number of \fBzmq_pollitem_t\fR structures with events signaled in \fIrevents\fR or 0 if no events have been signaled\&. Upon failure, \fIzmq_poll()\fR shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBETERM\fR -.RS 4 -At least one of the members of the -\fIitems\fR -array refers to a -\fIsocket\fR -whose associated 0MQ -\fIcontext\fR -was terminated\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIitems\fR -was not valid (NULL)\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before any events were available\&. -.RE -.SH "EXAMPLE" -.PP -\fBPolling indefinitely for input events on both a 0MQ socket and a standard socket.\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zmq_pollitem_t items [2]; -/* First item refers to 0MQ socket \*(Aqsocket\*(Aq */ -items[0]\&.socket = socket; -items[0]\&.events = ZMQ_POLLIN; -/* Second item refers to standard socket \*(Aqfd\*(Aq */ -items[1]\&.socket = NULL; -items[1]\&.fd = fd; -items[1]\&.events = ZMQ_POLLIN; -/* Poll for events indefinitely */ -int rc = zmq_poll (items, 2, \-1); -assert (rc >= 0); -/* Returned events will be stored in items[]\&.revents */ -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_socket\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq\fR(7) -.sp -Your operating system documentation for the \fIpoll()\fR system call\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 deleted file mode 100644 index 73b244b7f3..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 +++ /dev/null @@ -1,89 +0,0 @@ -'\" t -.\" Title: zmq_proxy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_PROXY" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_proxy \- start built\-in 0MQ proxy -.SH "SYNOPSIS" -.sp -\fBint zmq_proxy (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_proxy()\fR function starts the built\-in 0MQ proxy in the current application thread\&. -.sp -The proxy connects a frontend socket to a backend socket\&. Conceptually, data flows from frontend to backend\&. Depending on the socket types, replies may flow in the opposite direction\&. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend\&. -.sp -Before calling \fIzmq_proxy()\fR you must set any socket options, and connect or bind both frontend and backend sockets\&. The two conventional proxy models are: -.sp -\fIzmq_proxy()\fR runs in the current thread and returns only if/when the current context is closed\&. -.sp -If the capture socket is not NULL, the proxy shall send all messages, received on both frontend and backend, to the capture socket\&. The capture socket should be a \fIZMQ_PUB\fR, \fIZMQ_DEALER\fR, \fIZMQ_PUSH\fR, or \fIZMQ_PAIR\fR socket\&. -.sp -Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. -.SH "EXAMPLE USAGE" -.SS "Shared Queue" -.sp -When the frontend is a ZMQ_ROUTER socket, and the backend is a ZMQ_DEALER socket, the proxy shall act as a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services\&. Requests shall be fair\-queued from frontend connections and distributed evenly across backend connections\&. Replies shall automatically return to the client that made the original request\&. -.SS "Forwarder" -.sp -When the frontend is a ZMQ_XSUB socket, and the backend is a ZMQ_XPUB socket, the proxy shall act as a message forwarder that collects messages from a set of publishers and forwards these to a set of subscribers\&. This may be used to bridge networks transports, e\&.g\&. read on tcp:// and forward on pgm://\&. -.SS "Streamer" -.sp -When the frontend is a ZMQ_PULL socket, and the backend is a ZMQ_PUSH socket, the proxy shall collect tasks from a set of clients and forwards these to a set of workers using the pipeline pattern\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_proxy()\fR function always returns \-1 and \fIerrno\fR set to \fBETERM\fR or \fBEINTR\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. -.SH "EXAMPLE" -.PP -\fBCreating a shared queue proxy\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create frontend and backend sockets -void *frontend = zmq_socket (context, ZMQ_ROUTER); -assert (backend); -void *backend = zmq_socket (context, ZMQ_DEALER); -assert (frontend); -// Bind both sockets to TCP ports -assert (zmq_bind (frontend, "tcp://*:5555") == 0); -assert (zmq_bind (backend, "tcp://*:5556") == 0); -// Start the queue proxy, which runs until ETERM -zmq_proxy (frontend, backend, NULL); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 deleted file mode 100644 index 2cf1209e9c..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 +++ /dev/null @@ -1,112 +0,0 @@ -'\" t -.\" Title: zmq_proxy_steerable -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_PROXY_STEERABLE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_proxy_steerable \- built\-in 0MQ proxy with control flow -.SH "SYNOPSIS" -.sp -\fBint zmq_proxy_steerable (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB, const void \fR\fB\fI*control\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_proxy_steerable()\fR function starts the built\-in 0MQ proxy in the current application thread, as \fIzmq_proxy()\fR do\&. Please, refer to this function for the general description and usage\&. We describe here only the additional control flow provided by the socket passed as the fourth argument "control"\&. -.sp -If the control socket is not NULL, the proxy supports control flow\&. If \fIPAUSE\fR is received on this socket, the proxy suspends its activities\&. If \fIRESUME\fR is received, it goes on\&. If \fITERMINATE\fR is received, it terminates smoothly\&. At start, the proxy runs normally as if zmq_proxy was used\&. -.sp -If the control socket is NULL, the function behave exactly as if zmq_proxy had been called\&. -.sp -Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. Refer to \fBzmq_proxy\fR(3) for a description of the zmq_proxy\&. -.SH "EXAMPLE USAGE" -.sp -cf zmq_proxy -.SH "RETURN VALUE" -.sp -The \fIzmq_proxy_steerable()\fR function returns 0 if TERMINATE is sent to its control socket\&. Otherwise, it returns \-1 and \fIerrno\fR set to \fBETERM\fR or \fBEINTR\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. -.SH "EXAMPLE" -.PP -\fBCreating a shared queue proxy\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create frontend, backend and control sockets -void *frontend = zmq_socket (context, ZMQ_ROUTER); -assert (backend); -void *backend = zmq_socket (context, ZMQ_DEALER); -assert (frontend); -void *control = zmq_socket (context, ZMQ_SUB); -assert (control); - -// Bind sockets to TCP ports -assert (zmq_bind (frontend, "tcp://*:5555") == 0); -assert (zmq_bind (backend, "tcp://*:5556") == 0); -assert (zmq_connect (control, "tcp://*:5557") == 0); - -// Subscribe to the control socket since we have chosen SUB here -assert (zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0)); - -// Start the queue proxy, which runs until ETERM or "TERMINATE" -// received on the control socket -zmq_proxy_steerable (frontend, backend, NULL, control); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSet up a controller in another node, process or whatever\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *control = zmq_socket (context, ZMQ_PUB); -assert (control); -assert (zmq_bind (control, "tcp://*:5557") == 0); - -// pause the proxy -assert (zmq_send (control, "PAUSE", 5, 0) == 0); - -// resume the proxy -assert (zmq_send (control, "RESUME", 6, 0) == 0); - -// terminate the proxy -assert (zmq_send (control, "TERMINATE", 9, 0) == 0); -\-\-\- - - -SEE ALSO -.fi -.if n \{\ -.RE -.\} -.sp -\fBzmq_proxy\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 deleted file mode 100644 index f90366ae30..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 +++ /dev/null @@ -1,122 +0,0 @@ -'\" t -.\" Title: zmq_recv -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_RECV" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_recv \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_recv (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_recv()\fR function shall receive a message from the socket referenced by the \fIsocket\fR argument and store it in the buffer referenced by the \fIbuf\fR argument\&. Any bytes exceeding the length specified by the \fIlen\fR argument shall be truncated\&. If there are no messages available on the specified \fIsocket\fR the \fIzmq_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: The \fIbuf\fR argument may be null if len is zero\&. -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_recv()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recv()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_recv()\fR function shall return number of bytes in the message if successful\&. Note that the value can exceed the value of the \fIlen\fR parameter in case the message was truncated\&. If not successful the function shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_recv()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_recv()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -char buf [256]; -nbytes = zmq_recv (socket, buf, 256, 0); -assert (nbytes != \-1); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 deleted file mode 100644 index c3b0b44bb1..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 +++ /dev/null @@ -1,175 +0,0 @@ -'\" t -.\" Title: zmq_recvmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_RECVMSG" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_recvmsg \- receive a message part from a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_recvmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_recvmsg()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_recvmsg()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified -\fIsocket\fR, the -\fIzmq_recvmsg()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -this API method is deprecated in favor of zmq_msg_recv(3)\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recvmsg()\fR to determine if there are further parts to receive\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_recvmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and no messages are available at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_recvmsg()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_recvmsg()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before a message was available\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The message passed to the function was invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBReceiving a message from a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create an empty 0MQ message */ -zmq_msg_t msg; -int rc = zmq_msg_init (&msg); -assert (rc == 0); -/* Block until a message is available to be received from socket */ -rc = zmq_recvmsg (socket, &msg, 0); -assert (rc != \-1); -/* Release message */ -zmq_msg_close (&msg); -.fi -.if n \{\ -.RE -.\} -.PP -\fBReceiving a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int more; -size_t more_size = sizeof (more); -do { - /* Create an empty 0MQ message to hold the message part */ - zmq_msg_t part; - int rc = zmq_msg_init (&part); - assert (rc == 0); - /* Block until a message is available to be received from socket */ - rc = zmq_recvmsg (socket, &part, 0); - assert (rc != \-1); - /* Determine if more message parts are to follow */ - rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - assert (rc == 0); - zmq_msg_close (&part); -} while (more); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 deleted file mode 100644 index f0bb2adadb..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 +++ /dev/null @@ -1,158 +0,0 @@ -'\" t -.\" Title: zmq_send -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SEND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_send \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_send (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_send()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_send()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_send()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEINVAL\fR -.RS 4 -The sender tried to send multipart data, which the socket type does not allow\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_send()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_send (socket, "ABC", 3, ZMQ_SNDMORE); -assert (rc == 3); -rc = zmq_send (socket, "DEFGH", 5, ZMQ_SNDMORE); -assert (rc == 5); -/* Final part; no more parts to follow */ -rc = zmq_send (socket, "JK", 2, 0); -assert (rc == 2); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send_const\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 deleted file mode 100644 index 11175ff326..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 +++ /dev/null @@ -1,153 +0,0 @@ -'\" t -.\" Title: zmq_send_const -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SEND_CONST" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_send_const \- send a constant\-memory message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_send_const (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_send_const()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The message buffer is assumed to be constant\-memory and will therefore not be copied or deallocated in any way\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_send_const()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_send_const()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_send_const()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_send_const()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_send_const()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_send_const (socket, "ABC", 3, ZMQ_SNDMORE); -assert (rc == 3); -rc = zmq_send_const (socket, "DEFGH", 5, ZMQ_SNDMORE); -assert (rc == 5); -/* Final part; no more parts to follow */ -rc = zmq_send_const (socket, "JK", 2, 0); -assert (rc == 2); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 deleted file mode 100644 index 4074be3a45..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 +++ /dev/null @@ -1,198 +0,0 @@ -'\" t -.\" Title: zmq_sendmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SENDMSG" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_sendmsg \- send a message part on a socket -.SH "SYNOPSIS" -.sp -\fBint zmq_sendmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_sendmsg()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: -.PP -\fBZMQ_DONTWAIT\fR -.RS 4 -For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the -\fIsocket\fR, the -\fIzmq_sendmsg()\fR -function shall fail with -\fIerrno\fR -set to EAGAIN\&. -.RE -.PP -\fBZMQ_SNDMORE\fR -.RS 4 -Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. -.RE -.sp -The \fIzmq_msg_t\fR structure passed to \fIzmq_sendmsg()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -A successful invocation of \fIzmq_sendmsg()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -this API method is deprecated in favor of zmq_msg_send(3)\&. -.sp .5v -.RE -.SS "Multi\-part messages" -.sp -A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. -.sp -An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_sendmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEAGAIN\fR -.RS 4 -Non\-blocking mode was requested and the message cannot be sent at the moment\&. -.RE -.PP -\fBENOTSUP\fR -.RS 4 -The -\fIzmq_sendmsg()\fR -operation is not supported by this socket type\&. -.RE -.PP -\fBEINVAL\fR -.RS 4 -The sender tried to send multipart data, which the socket type does not allow\&. -.RE -.PP -\fBEFSM\fR -.RS 4 -The -\fIzmq_sendmsg()\fR -operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the -\fImessaging patterns\fR -section of -\fBzmq_socket\fR(3) -for more information\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal before the message was sent\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -Invalid message\&. -.RE -.PP -\fBEHOSTUNREACH\fR -.RS 4 -The message cannot be routed\&. -.RE -.SH "EXAMPLE" -.PP -\fBFilling in a message and sending it to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a new message, allocating 6 bytes for message content */ -zmq_msg_t msg; -int rc = zmq_msg_init_size (&msg, 6); -assert (rc == 0); -/* Fill in message content with \*(AqAAAAAA\*(Aq */ -memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); -/* Send the message to the socket */ -rc = zmq_sendmsg (socket, &msg, 0); -assert (rc == 6); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSending a multi-part message\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Send a multi\-part message consisting of three parts to socket */ -rc = zmq_sendmsg (socket, &part1, ZMQ_SNDMORE); -rc = zmq_sendmsg (socket, &part2, ZMQ_SNDMORE); -/* Final part; no more parts to follow */ -rc = zmq_sendmsg (socket, &part3, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 deleted file mode 100644 index af381286e8..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 +++ /dev/null @@ -1,3201 +0,0 @@ -'\" t -.\" Title: zmq_setsockopt -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SETSOCKOPT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_setsockopt \- set 0MQ socket options -.SH "SYNOPSIS" -.sp -\fBint zmq_setsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, const void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fIoption_len\fR\fR\fB);\fR -.sp -Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE, ZMQ_LINGER, ZMQ_ROUTER_HANDOVER, ZMQ_ROUTER_MANDATORY, ZMQ_PROBE_ROUTER, ZMQ_XPUB_VERBOSE, ZMQ_XPUB_VERBOSER, ZMQ_REQ_CORRELATE, ZMQ_REQ_RELAXED, ZMQ_SNDHWM and ZMQ_RCVHWM, only take effect for subsequent socket bind/connects\&. -.sp -Specifically, security options take effect for subsequent bind/connect calls, and can be changed at any time to affect subsequent binds and/or connects\&. -.SH "DESCRIPTION" -.sp -The \fIzmq_setsockopt()\fR function shall set the option specified by the \fIoption_name\fR argument to the value pointed to by the \fIoption_value\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument\&. The \fIoption_len\fR argument is the size of the option value in bytes\&. For options taking a value of type "character string", the provided byte data should either contain no zero bytes, or end in a single zero byte (terminating ASCII NUL character)\&. -.sp -The following socket options can be set with the \fIzmq_setsockopt()\fR function: -.SS "ZMQ_AFFINITY: Set I/O thread affinity" -.sp -The \fIZMQ_AFFINITY\fR option shall set the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. -.sp -Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. -.sp -See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A (bitmap) -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.SS "ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections" -.sp -The \fIZMQ_BACKLOG\fR option shall set the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -connections -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_CONNECT_RID: Assign the next outbound connection id" -.sp -The \fIZMQ_CONNECT_RID\fR option sets the peer id of the next host connected via the zmq_connect() call, and immediately readies that connection for data transfer with the named id\&. This option applies only to the first subsequent call to zmq_connect(), calls thereafter use default connection behaviour\&. -.sp -Typical use is to set this socket option ahead of each zmq_connect() attempt to a new host\&. Each connection MUST be assigned a unique name\&. Assigning a name that is already in use is not allowed\&. -.sp -Useful when connecting ROUTER to ROUTER, or STREAM to STREAM, as it allows for immediate sending to peers\&. Outbound id framing requirements for ROUTER and STREAM sockets apply\&. -.sp -The peer id should be from 1 to 255 bytes long and MAY NOT start with binary zero\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER, ZMQ_STREAM -T} -.TE -.sp 1 -.SS "ZMQ_CONFLATE: Keep only last message" -.sp -If set, a socket shall keep only one message in its inbound/outbound queue, this message being the last message received/the last message to be sent\&. Ignores \fIZMQ_RCVHWM\fR and \fIZMQ_SNDHWM\fR options\&. Does not support multi\-part messages, in particular, only one part of it is kept in the socket internal queue\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_PULL, ZMQ_PUSH, ZMQ_SUB, ZMQ_PUB, ZMQ_DEALER -T} -.TE -.sp 1 -.SS "ZMQ_CONNECT_TIMEOUT: Set connect() timeout" -.sp -Sets how long to wait before timing\-out a connect() system call\&. The connect() system call normally takes a long time before it returns a time out error\&. Setting this option allows the library to time out the call at an earlier interval\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (disabled) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_PUBLICKEY: Set CURVE public key" -.sp -Sets the socket\(cqs long term public key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. The public key must always be used with the matching secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. To derive the public key from a secret key, use \fBzmq_curve_public\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SECRETKEY: Set CURVE secret key" -.sp -Sets the socket\(cqs long term secret key\&. You must set this on both CURVE client and server sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. To derive the public key from a secret key, use \fBzmq_curve_public\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVER: Set CURVE server role" -.sp -Defines whether the socket will act as server for CURVE security, see \fBzmq_curve\fR(7)\&. A value of \fI1\fR means the socket will act as CURVE server\&. A value of \fI0\fR means the socket will not act as CURVE server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. When you set this you must also set the server\(cqs secret key using the ZMQ_CURVE_SECRETKEY option\&. A server socket does not need to know its own public key\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_CURVE_SERVERKEY: Set CURVE server key" -.sp -Sets the socket\(cqs long term server key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. This key must have been generated together with the server\(cqs secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -an option value size of 40 is supported for backwards compatibility, though is deprecated\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data or Z85 text string -T} -T{ -.sp -Option value size -T}:T{ -.sp -32 or 41 -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption" -.sp -Defines whether communications on the socket will be encrypted, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal" -.sp -Sets the name of the principal for whom GSSAPI credentials should be acquired\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVER: Set GSSAPI server role" -.sp -Defines whether the socket will act as server for GSSAPI security, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means the socket will act as GSSAPI server\&. A value of \fI0\fR means the socket will act as GSSAPI client\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal" -.sp -Sets the name of the principal of the GSSAPI server to which a GSSAPI client intends to connect\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_HANDSHAKE_IVL: Set maximum handshake interval" -.sp -The \fIZMQ_HANDSHAKE_IVL\fR option shall set the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -30000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all but ZMQ_STREAM, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats" -.sp -The \fIZMQ_HEARTBEAT_IVL\fR option shall set the interval between sending ZMTP heartbeats for the specified \fIsocket\fR\&. If this option is set and is greater than 0, then a \fIPING\fR ZMTP command will be sent every \fIZMQ_HEARTBEAT_IVL\fR milliseconds\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats" -.sp -The \fIZMQ_HEARTBEAT_TIMEOUT\fR option shall set how long to wait before timing\-out a connection after sending a \fIPING\fR ZMTP command and not receiving any traffic\&. This option is only valid if \fIZMQ_HEARTBEAT_IVL\fR is also set, and is greater than 0\&. The connection will time out if there is no traffic received after sending the \fIPING\fR command, but the received traffic does not have to be a \fIPONG\fR command \- any received traffic will cancel the timeout\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats" -.sp -The \fIZMQ_HEARTBEAT_TTL\fR option shall set the timeout on the remote peer for ZMTP heartbeats\&. If this option is greater than 0, the remote side shall time out the connection if it does not receive any more traffic within the TTL period\&. This option does not have any effect if \fIZMQ_HEARTBEAT_IVL\fR is not set or is 0\&. Internally, this value is rounded down to the nearest decisecond, any value less than 100 will have no effect\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_IDENTITY: Set socket identity" -.sp -The \fIZMQ_IDENTITY\fR option shall set the identity of the specified \fIsocket\fR when connecting to a ROUTER socket\&. The identity should be from 1 to 255 bytes long and may contain any values\&. -.sp -If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ, ZMQ_REP, ZMQ_ROUTER, ZMQ_DEALER\&. -T} -.TE -.sp 1 -.SS "ZMQ_IMMEDIATE: Queue messages only to completed connections" -.sp -By default queues will fill on outgoing connections even if the connection has not completed\&. This can lead to "lost" messages on sockets with round\-robin routing (REQ, PUSH, DEALER)\&. If this option is set to 1, messages shall be queued only to completed connections\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_INVERT_MATCHING: Invert message filtering" -.sp -Reverses the filtering behavior of PUB\-SUB sockets, when set to 1\&. -.sp -On \fIPUB\fR and \fIXPUB\fR sockets, this causes messages to be sent to all connected sockets \fIexcept\fR those subscribed to a prefix that matches the message\&. On \fISUB\fR sockets, this causes only incoming messages that do \fInot\fR match any of the socket\(cqs subscriptions to be received by the user\&. -.sp -Whenever \fIZMQ_INVERT_MATCHING\fR is set to 1 on a \fIPUB\fR socket, all \fISUB\fR sockets connecting to it must also have the option set to 1\&. Failure to do so will have the \fISUB\fR sockets reject everything the \fIPUB\fR socket sends them\&. \fIXSUB\fR sockets do not need to do this because they do not filter incoming messages\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_IPV6: Enable IPv6 on socket" -.sp -Set the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (false) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_LINGER: Set linger period for socket shutdown" -.sp -The \fIZMQ_LINGER\fR option shall set the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is disconnected with \fBzmq_disconnect\fR(3) or closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_ctx_term\fR(3)\&. The following outlines the different behaviours: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A value of -\fI\-1\fR -specifies an infinite linger period\&. Pending messages shall not be discarded after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_ctx_term()\fR -shall block until all pending messages have been sent to a peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The value of -\fI0\fR -specifies no linger period\&. Pending messages shall be discarded immediately after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to -\fIzmq_disconnect()\fR -or -\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with -\fIzmq_ctx_term()\fR -shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -Option value type -T}:T{ -int -T} -T{ -Option value unit -T}:T{ -milliseconds -T} -T{ -Default value -T}:T{ -30000 (thirty seconds) -T} -T{ -Applicable socket types -T}:T{ -all -T} -.TE -.sp 1 -.RE -.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" -.sp -Limits the size of the inbound message\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" -.sp -Sets the time\-to\-live field in every multicast packet sent from this socket\&. The default is 1 which means that the multicast packets don\(cqt leave the local network\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -network hops -T} -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets" -.sp -Sets the maximum transport data unit size used for outbound multicast packets\&. -.sp -This must be set at or below the minimum Maximum Transmission Unit (MTU) for all network paths over which multicast reception is required\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -1500 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_PASSWORD: Set PLAIN security password" -.sp -Sets the password for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_SERVER: Set PLAIN server role" -.sp -Defines whether the socket will act as server for PLAIN security, see \fBzmq_plain\fR(7)\&. A value of \fI1\fR means the socket will act as PLAIN server\&. A value of \fI0\fR means the socket will not act as PLAIN server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PLAIN_USERNAME: Set PLAIN security username" -.sp -Sets the username for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_USE_FD: Set the pre\-allocated socket file descriptor" -.sp -When set to a positive integer value before zmq_bind is called on the socket, the socket shall use the corresponding file descriptor for connections over TCP or IPC instead of allocating a new file descriptor\&. Useful for writing systemd socket activated services\&. If set to \-1 (default), a new file descriptor will be allocated instead (default behaviour)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -if set after calling zmq_bind, this option shall have no effect\&. NOTE: the file descriptor passed through MUST have been ran through the "bind" and "listen" system calls beforehand\&. Also, socket option that would normally be passed through zmq_setsockopt like TCP buffers length, IP_TOS or SO_REUSEADDR MUST be set beforehand by the caller, as they must be set before the socket is bound\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -file descriptor -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all bound sockets, when using IPC or TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets" -.sp -When set to 1, the socket will automatically send an empty message when a new connection is made or accepted\&. You may set this on REQ, DEALER, or ROUTER sockets connected to a ROUTER socket\&. The application must filter such empty messages\&. The ZMQ_PROBE_ROUTER option in effect provides the ROUTER application with an event signaling the arrival of a new peer\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -do not set this option on a socket that talks to any other socket types: the results are undefined\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER, ZMQ_DEALER, ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_RATE: Set multicast data rate" -.sp -The \fIZMQ_RATE\fR option shall set the maximum send or receive data rate for multicast transports such as \fBzmq_pgm\fR(7) using the specified \fIsocket\fR\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -kilobits per second -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_RCVBUF: Set kernel receive buffer size" -.sp -The \fIZMQ_RCVBUF\fR option shall set the underlying kernel receive buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of \-1 means leave the OS default unchanged\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVHWM: Set high water mark for inbound messages" -.sp -The \fIZMQ_RCVHWM\fR option shall set the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN" -.sp -Sets the timeout for receive operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL: Set reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL\fR option shall set the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -100 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval" -.sp -The \fIZMQ_RECONNECT_IVL_MAX\fR option shall set the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Values less than ZMQ_RECONNECT_IVL will be ignored\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (only use ZMQ_RECONNECT_IVL) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_RECOVERY_IVL: Set multicast recovery interval" -.sp -The \fIZMQ_RECOVERY_IVL\fR option shall set the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -Exercise care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -10000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using multicast transports -T} -.TE -.sp 1 -.SS "ZMQ_REQ_CORRELATE: match replies with requests" -.sp -The default behaviour of REQ sockets is to rely on the ordering of messages to match requests and responses and that is usually sufficient\&. When this option is set to 1, the REQ socket will prefix outgoing messages with an extra frame containing a request id\&. That means the full message is (request id, 0, user frames\&...)\&. The REQ socket will discard all incoming messages that don\(cqt begin with these two frames\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_REQ_RELAXED: relax strict alternation between request and reply" -.sp -By default, a REQ socket does not allow initiating a new request with \fIzmq_send(3)\fR until the reply to the previous one has been received\&. When set to 1, sending another message is allowed and previous replies will be discarded if any\&. The request\-reply state machine is reset and a new request is sent to the next available peer\&. -.sp -If set to 1, also enable ZMQ_REQ_CORRELATE to ensure correct matching of requests and replies\&. Otherwise a late reply to an aborted request can be reported as the reply to the superseding request\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_REQ -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets" -.sp -If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets" -.sp -Sets the ROUTER socket behaviour when an unroutable message is encountered\&. A value of 0 is the default and discards the message silently when it cannot be routed or the peers SNDHWM is reached\&. A value of 1 returns an \fIEHOSTUNREACH\fR error code if the message cannot be routed or \fIEAGAIN\fR error code if the SNDHWM is reached and ZMQ_DONTWAIT was used\&. Without ZMQ_DONTWAIT it will block until the SNDTIMEO is reached or a spot in the send queue opens up\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode" -.sp -Sets the raw mode on the ROUTER, when set to 1\&. When the ROUTER socket is in raw mode, and when using the tcp:// transport, it will read and write TCP data without 0MQ framing\&. This lets 0MQ applications talk to non\-0MQ applications\&. When using raw mode, you cannot set explicit identities, and the ZMQ_SNDMORE flag is ignored when sending data messages\&. In raw mode you can close a specific connection by sending it a zero\-length message (following the identity frame)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use ZMQ_STREAM sockets instead\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_ROUTER -T} -.TE -.sp 1 -.SS "ZMQ_SNDBUF: Set kernel transmit buffer size" -.sp -The \fIZMQ_SNDBUF\fR option shall set the underlying kernel transmit buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of \-1 means leave the OS default unchanged\&. For details please refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDHWM: Set high water mark for outbound messages" -.sp -The \fIZMQ_SNDHWM\fR option shall set the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. -.sp -If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -0MQ does not guarantee that the socket will accept as many as ZMQ_SNDHWM messages, and the actual limit may be as much as 60\-70% lower depending on the flow of messages on the socket\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -messages -T} -T{ -.sp -Default value -T}:T{ -.sp -1000 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN" -.sp -Sets the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (infinite) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all -T} -.TE -.sp 1 -.SS "ZMQ_SOCKS_PROXY: Set SOCKS5 proxy address" -.sp -Sets the SOCKS5 proxy address that shall be used by the socket for the TCP connection(s)\&. Does not support SOCKS5 authentication\&. If the endpoints are domain names instead of addresses they shall not be resolved and they shall be forwarded unchanged to the SOCKS proxy service in the client connection request message (address type 0x03 domain name)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_STREAM_NOTIFY: send connect and disconnect notifications" -.sp -Enables connect and disconnect notifications on a STREAM socket, when set to 1\&. When notifications are enabled, the socket delivers a zero\-length message when a peer connects or disconnects\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_STREAM -T} -.TE -.sp 1 -.SS "ZMQ_SUBSCRIBE: Establish message filter" -.sp -The \fIZMQ_SUBSCRIBE\fR option shall establish a new message filter on a \fIZMQ_SUB\fR socket\&. Newly created \fIZMQ_SUB\fR sockets shall filter out all incoming messages, therefore you should call this option to establish an initial message filter\&. -.sp -An empty \fIoption_value\fR of length zero shall subscribe to all incoming messages\&. A non\-empty \fIoption_value\fR shall subscribe to all messages beginning with the specified prefix\&. Multiple filters may be attached to a single \fIZMQ_SUB\fR socket, in which case a message shall be accepted if it matches at least one filter\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" -.sp -Override \fISO_KEEPALIVE\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,0,1 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" -.sp -Override \fITCP_KEEPCNT\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)" -.sp -Override \fITCP_KEEPIDLE\fR (or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" -.sp -Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -\-1,>0 -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout" -.sp -On OSes where it is supported, sets how long before an unacknowledged TCP retransmit times out\&. The system normally attempts many TCP retransmits following an exponential backoff strategy\&. This means that after a network outage, it may take a long time before the session can be re\-established\&. Setting this option allows the timeout to happen at a shorter interval\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -0 (leave to OS default) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_TOS: Set the Type\-of\-Service on socket" -.sp -Sets the ToS fields (Differentiated services (DS) and Explicit Congestion Notification (ECN) field of the IP header\&. The ToS field is typically used to specify a packets priority\&. The availability of this option is dependent on intermediate network equipment that inspect the ToS field and provide a path for low\-delay, high\-throughput, highly\-reliable service, etc\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp ->0 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, only for connection\-oriented transports -T} -.TE -.sp 1 -.SS "ZMQ_UNSUBSCRIBE: Remove message filter" -.sp -The \fIZMQ_UNSUBSCRIBE\fR option shall remove an existing message filter on a \fIZMQ_SUB\fR socket\&. The filter specified must match an existing filter previously established with the \fIZMQ_SUBSCRIBE\fR option\&. If the socket has several instances of the same filter attached the \fIZMQ_UNSUBSCRIBE\fR option shall remove only one instance, leaving the rest in place and functional\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -N/A -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_SUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_VERBOSE: pass subscribe messages on XPUB socket" -.sp -Sets the \fIXPUB\fR socket behaviour on new subscriptions\&. If enabled, the socket passes all subscribe messages to the caller\&. If disabled, these are not visible to the caller\&. The default is 0 (disabled)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket" -.sp -Sets the \fIXPUB\fR socket behaviour on new subscriptions and ubsubscriptions\&. If enabled, the socket passes all subscribe and unsubscribe messages to the caller\&. If disabled, these are not visible to the caller\&. The default is 0 (disabled)\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_MANUAL: change the subscription handling to manual" -.sp -Sets the \fIXPUB\fR socket subscription handling mode manual/automatic\&. A value of \fI0\fR is the default and subscription requests will be handled automatically\&. A value of \fI1\fR will change the subscription requests handling to manual, with manual mode subscription requests are not added to the subscription list\&. To add subscription the user need to call setsockopt with ZMQ_SUBSCRIBE on XPUB socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached" -.sp -Sets the \fIXPUB\fR socket behaviour to return error EAGAIN if SENDHWM is reached and the message could not be send\&. -.sp -A value of 0 is the default and drops the message silently when the peers SNDHWM is reached\&. A value of 1 returns an \fIEAGAIN\fR error code if the SNDHWM is reached and ZMQ_DONTWAIT was used\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -0, 1 -T} -T{ -.sp -Default value -T}:T{ -.sp -0 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB, ZMQ_PUB -T} -.TE -.sp 1 -.SS "ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by subscriber when connecting" -.sp -Sets a welcome message the will be recieved by subscriber when connecting\&. Subscriber must subscribe to the Welcome message before connecting\&. Welcome message will also be sent on reconnecting\&. For welcome message to work well user must poll on incoming subscription messages on the XPUB socket and handle them\&. -.sp -Use NULL and lenght of zero to disable welcome message\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -NULL -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -ZMQ_XPUB -T} -.TE -.sp 1 -.SS "ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain" -.sp -Sets the domain for ZAP (ZMQ RFC 27) authentication\&. For NULL security (the default on all tcp:// connections), ZAP authentication only happens if you set a non\-empty domain\&. For PLAIN and CURVE security, ZAP requests are always made, if there is a ZAP handler present\&. See \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:27\fR\m[] for more details\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -character string -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -not set -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transport -T} -.TE -.sp 1 -.SS "ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections" -.sp -Assign an arbitrary number of filters that will be applied for each new TCP transport connection on a listening socket\&. If no filters are applied, then the TCP transport allows connections from any IP address\&. If at least one filter is applied then new connection source ip should be matched\&. To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0)\&. Filter is a null\-terminated string with ipv6 or ipv4 CIDR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IP address whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -binary data -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all GID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_GID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -GID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -gid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all PID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_PID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -PID filters are only available on platforms supporting the SO_PEERCRED socket option (currently only Linux)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -pid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections" -.sp -Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all UID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_UID, NULL, 0)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -UID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. -.sp .5v -.RE -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uid_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -N/A -T} -T{ -.sp -Default value -T}:T{ -.sp -no filters (allow from all) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all listening sockets, when using IPC transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_IPV4ONLY: Use IPv4\-only on socket" -.sp -Set the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -boolean -T} -T{ -.sp -Default value -T}:T{ -.sp -1 (true) -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using TCP transports\&. -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_SIZE option shall set the size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -65546 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_MIN_SIZE option shall set the min size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -128 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket" -.sp -The ZMQ_VMCI_BUFFER_MAX_SIZE option shall set the max size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -uint64_t -T} -T{ -.sp -Option value unit -T}:T{ -.sp -bytes -T} -T{ -.sp -Default value -T}:T{ -.sp -262144 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SS "ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket" -.sp -The ZMQ_VMCI_CONNECT_TIMEOUT option shall set connection timeout for the socket\&. -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Option value type -T}:T{ -.sp -int -T} -T{ -.sp -Option value unit -T}:T{ -.sp -milliseconds -T} -T{ -.sp -Default value -T}:T{ -.sp -\-1 -T} -T{ -.sp -Applicable socket types -T}:T{ -.sp -all, when using VMCI transport -T} -.TE -.sp 1 -.SH "RETURN VALUE" -.sp -The \fIzmq_setsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested option -\fIoption_name\fR -is unknown, or the requested -\fIoption_len\fR -or -\fIoption_value\fR -is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBEINTR\fR -.RS 4 -The operation was interrupted by delivery of a signal\&. -.RE -.SH "EXAMPLE" -.PP -\fBSubscribing to messages on a ZMQ_SUB socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Subscribe to all messages */ -rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0); -assert (rc == 0); -/* Subscribe to messages prefixed with "ANIMALS\&.CATS" */ -rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS\&.CATS", 12); -.fi -.if n \{\ -.RE -.\} -.PP -\fBSetting I/O thread affinity\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int64_t affinity; -/* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */ -affinity = 1; -rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); -assert (rc); -rc = zmq_bind (socket, "tcp://lo:5555"); -assert (rc); -/* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */ -affinity = 2; -rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); -assert (rc); -rc = zmq_bind (socket, "tcp://lo:5556"); -assert (rc); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 deleted file mode 100644 index eaf039a03f..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 +++ /dev/null @@ -1,1403 +0,0 @@ -'\" t -.\" Title: zmq_socket -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SOCKET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_socket \- create 0MQ socket -.SH "SYNOPSIS" -.sp -\fBvoid *zmq_socket (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fItype\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_socket()\fR function shall create a 0MQ socket within the specified \fIcontext\fR and return an opaque handle to the newly created socket\&. The \fItype\fR argument specifies the socket type, which determines the semantics of communication over the socket\&. -.sp -The newly created socket is initially unbound, and not associated with any endpoints\&. In order to establish a message flow a socket must first be connected to at least one endpoint with \fBzmq_connect\fR(3), or at least one endpoint must be created for accepting incoming connections with \fBzmq_bind\fR(3)\&. -.PP -\fBKey differences to conventional sockets\fR. Generally speaking, conventional sockets present a -\fIsynchronous\fR -interface to either connection\-oriented reliable byte streams (SOCK_STREAM), or connection\-less unreliable datagrams (SOCK_DGRAM)\&. In comparison, 0MQ sockets present an abstraction of an asynchronous -\fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. Where conventional sockets transfer streams of bytes or discrete datagrams, 0MQ sockets transfer discrete -\fImessages\fR\&. -.sp -0MQ sockets being \fIasynchronous\fR means that the timings of the physical connection setup and tear down, reconnect and effective delivery are transparent to the user and organized by 0MQ itself\&. Further, messages may be \fIqueued\fR in the event that a peer is unavailable to receive them\&. -.sp -Conventional sockets allow only strict one\-to\-one (two peers), many\-to\-one (many clients, one server), or in some cases one\-to\-many (multicast) relationships\&. With the exception of \fIZMQ_PAIR\fR, 0MQ sockets may be connected \fBto multiple endpoints\fR using \fIzmq_connect()\fR, while simultaneously accepting incoming connections \fBfrom multiple endpoints\fR bound to the socket using \fIzmq_bind()\fR, thus allowing many\-to\-many relationships\&. -.PP -\fBThread safety\fR. 0MQ has both thread safe socket type and -\fInot\fR -thread safe socket types\&. Applications MUST NOT use a -\fInot\fR -thread safe socket from multiple threads except after migrating a socket from one thread to another with a "full fence" memory barrier\&. -.sp -Following are the thread safe sockets: * ZMQ_CLIENT * ZMQ_SERVER * ZMQ_DISH * ZMQ_RADIO * ZMQ_SCATTER * ZMQ_GATHER -.PP -\fBSocket types\fR. The following sections present the socket types defined by 0MQ, grouped by the general -\fImessaging pattern\fR -which is built from related socket types\&. -.SS "Client\-server pattern" -.sp -The client\-server pattern is used to allow a single \fIZMQ_SERVER\fR \fIserver\fR talk to one or more \fIZMQ_CLIENT\fR \fIclients\fR\&. The client always starts the conversation, after which either peer can send messages asynchronously, to the other\&. -.sp -The client\-server pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:41\fR\m[]\&. -.sp -Note: this pattern is meant to eventually deprecate the use of \fIZMQ_DEALER\fR and \fIZMQ_ROUTER\fR to build client\-server architectures, as well as \fIZMQ_REP\fR and \fIZMQ_REQ\fR for request\-reply\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_CLIENT\fR -.RS 4 -.sp -A \fIZMQ_CLIENT\fR socket talks to a \fIZMQ_SERVER\fR socket\&. Either peer can connect, though the usual and recommended model is to bind the \fIZMQ_SERVER\fR and connect the \fIZMQ_CLIENT\fR\&. -.sp -If the \fIZMQ_CLIENT\fR socket has established a connection, \fBzmq_send\fR(3) will accept messages, queue them, and send them as rapidly as the network allows\&. The outgoing buffer limit is defined by the high water mark for the socket\&. If the outgoing buffer is full, or if there is no connected peer, \fBzmq_send\fR(3) will block, by default\&. The \fIZMQ_CLIENT\fR socket will not drop messages\&. -.sp -When a \fIZMQ_CLIENT\fR socket is connected to multiple \fIZMQ_SERVER\fR sockets, outgoing messages are distributed between connected peers on a round\-robin basis\&. Likewise, the \fIZMQ_CLIENT\fR socket receives messages fairly from each connected peer\&. This usage is sensible only for stateless protocols\&. -.sp -\fIZMQ_CLIENT\fR sockets are threadsafe and can be used from multiple threads at the same time\&. Note that replies from a \fIZMQ_SERVER\fR socket will go to the first client thread that calls libzmq:zmq_msg_recv\&. If you need to get replies back to the originating thread, use one \fIZMQ_CLIENT\fR socket per thread\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_CLIENT\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends not ZMQ_RCVMORE on receives\&. This limits them to single part data\&. The intention is to extend the API to allow scatter/gather of multi\-part data\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&1.\ \&Summary of ZMQ_CLIENT characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_SERVER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_SERVER\fR -.RS 4 -.sp -A \fIZMQ_SERVER\fR socket talks to a set of \fIZMQ_CLIENT\fR sockets\&. A \fIZMQ_SERVER\fR socket can only reply to an incoming message: the \fIZMQ_CLIENT\fR peer must always initiate a conversation\&. -.sp -Each received message has a \fIrouting_id\fR that is a 32\-bit unsigned integer\&. The application can fetch this with \fBzmq_msg_routing_id\fR(3)\&. To send a message to a given \fIZMQ_CLIENT\fR peer the application must set the peer\(cqs \fIrouting_id\fR on the message, using \fBzmq_msg_set_routing_id\fR(3)\&. -.sp -If the \fIrouting_id\fR is not specified, or does not refer to a connected client peer, the send call will fail with EHOSTUNREACH\&. If the outgoing buffer for the client peer is full, the send call shall block, unless ZMQ_DONT_WAIT is used in the send, in which case it shall fail with EAGAIN\&. The \fIZMQ_SERVER\fR socket shall not drop messages in any case\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_SERVER\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends not ZMQ_RCVMORE on receives\&. This limits them to single part data\&. The intention is to extend the API to allow scatter/gather of multi\-part data\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&2.\ \&Summary of ZMQ_SERVER characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_CLIENT\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -See text -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Return EAGAIN -T} -.TE -.sp 1 -.RE -.SS "Radio\-dish pattern" -.sp -The radio\-dish pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. -.sp -Radio\-dish is using groups (vs Pub\-sub topics), Dish sockets can join a group and each message sent by Radio sockets belong to a group\&. -.sp -Groups are null terminated strings limited to 16 chars length (including null)\&. The intention is to increase the length to 40 chars (including null)\&. -.sp -Groups are matched using exact matching (vs prefix matching of PubSub)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Radio\-dish is still in draft phase\&. -.sp .5v -.RE -.sp -Note: this pattern is meant to eventually deprecate the use of \fIZMQ_PUB\fR and \fIZMQ_SUB\fR to build pub\-sub architectures\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_RADIO\fR -.RS 4 -.sp -A socket of type \fIZMQ_RADIO\fR is used by a \fIpublisher\fR to distribute data\&. Each message belong to a group, a group is specified with linkzmq_zmq_msg_set_group[3]\&. Messages are distributed to all members of a group\&. The \fBzmq_recv\fR(3) function is not implemented for this socket type\&. -.sp -When a \fIZMQ_RADIO\fR socket enters the \fImute\fR state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the mute state ends\&. The \fIzmq_send()\fR function shall never block for this socket type\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_RADIO\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends\&. This limits them to single part data\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&3.\ \&Summary of ZMQ_RADIO characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_DISH\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Fan out -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_DISH\fR -.RS 4 -.sp -A socket of type \fIZMQ_DISH\fR is used by a \fIsubscriber\fR to subscribe to groups distributed by a \fIradio\fR\&. Initially a \fIZMQ_DISH\fR socket is not subscribed to any groups, use \fBzmq_join\fR(3) to join a group\&. To get the group the message belong to call \fBzmq_msg_group\fR(3)\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_DISH\fR sockets are threadsafe\&. They do not accept ZMQ_RCVMORE on receives\&. This limits them to single part data\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&4.\ \&Summary of ZMQ_DISH characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_RADIO\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.RE -.SS "Publish\-subscribe pattern" -.sp -The publish\-subscribe pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. -.sp -The publish\-subscribe pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:29\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PUB\fR -.RS 4 -.sp -A socket of type \fIZMQ_PUB\fR is used by a \fIpublisher\fR to distribute data\&. Messages sent are distributed in a fan out fashion to all connected peers\&. The \fBzmq_recv\fR(3) function is not implemented for this socket type\&. -.sp -When a \fIZMQ_PUB\fR socket enters the \fImute\fR state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the mute state ends\&. The \fIzmq_send()\fR function shall never block for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&5.\ \&Summary of ZMQ_PUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Fan out -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_SUB\fR -.RS 4 -.sp -A socket of type \fIZMQ_SUB\fR is used by a \fIsubscriber\fR to subscribe to data distributed by a \fIpublisher\fR\&. Initially a \fIZMQ_SUB\fR socket is not subscribed to any messages, use the \fIZMQ_SUBSCRIBE\fR option of \fBzmq_setsockopt\fR(3) to specify which messages to subscribe to\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&6.\ \&Summary of ZMQ_SUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_XPUB\fR -.RS 4 -.sp -Same as ZMQ_PUB except that you can receive subscriptions from the peers in form of incoming messages\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix are also received, but have no effect on subscription status\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&7.\ \&Summary of ZMQ_XPUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send messages, receive subscriptions -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Fan out -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_XSUB\fR -.RS 4 -.sp -Same as ZMQ_SUB except that you subscribe by sending subscription messages to the socket\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix may also be sent, but have no effect on subscription status\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&8.\ \&Summary of ZMQ_XSUB characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive messages, send subscriptions -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop -T} -.TE -.sp 1 -.RE -.SS "Pipeline pattern" -.sp -The pipeline pattern is used for distributing data to \fInodes\fR arranged in a pipeline\&. Data always flows down the pipeline, and each stage of the pipeline is connected to at least one \fInode\fR\&. When a pipeline stage is connected to multiple \fInodes\fR data is round\-robined among all connected \fInodes\fR\&. -.sp -The pipeline pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:30\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PUSH\fR -.RS 4 -.sp -A socket of type \fIZMQ_PUSH\fR is used by a pipeline \fInode\fR to send messages to downstream pipeline \fInodes\fR\&. Messages are round\-robined to all connected downstream \fInodes\fR\&. The \fIzmq_recv()\fR function is not implemented for this socket type\&. -.sp -When a \fIZMQ_PUSH\fR socket enters the \fImute\fR state due to having reached the high water mark for all downstream \fInodes\fR, or if there are no downstream \fInodes\fR at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one downstream \fInode\fR becomes available for sending; messages are not discarded\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&9.\ \&Summary of ZMQ_PUSH characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PULL\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PULL\fR -.RS 4 -.sp -A socket of type \fIZMQ_PULL\fR is used by a pipeline \fInode\fR to receive messages from upstream pipeline \fInodes\fR\&. Messages are fair\-queued from among all connected upstream \fInodes\fR\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&10.\ \&Summary of ZMQ_PULL characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PUSH\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Unidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive only -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.SS "Exclusive pair pattern" -.sp -The exclusive pair pattern is used to connect a peer to precisely one other peer\&. This pattern is used for inter\-thread communication across the inproc transport\&. -.sp -The exclusive pair pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:31\fR\m[]\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_PAIR\fR -.RS 4 -.sp -A socket of type \fIZMQ_PAIR\fR can only be connected to a single peer at any one time\&. No message routing or filtering is performed on messages sent over a \fIZMQ_PAIR\fR socket\&. -.sp -When a \fIZMQ_PAIR\fR socket enters the \fImute\fR state due to having reached the high water mark for the connected peer, or if no peer is connected, then any \fBzmq_send\fR(3) operations on the socket shall block until the peer becomes available for sending; messages are not discarded\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -\fIZMQ_PAIR\fR sockets are designed for inter\-thread communication across the \fBzmq_inproc\fR(7) transport and do not implement functionality such as auto\-reconnection\&. -.sp .5v -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&11.\ \&Summary of ZMQ_PAIR characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_PAIR\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -N/A -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.SS "Native Pattern" -.sp -The native pattern is used for communicating with TCP peers and allows asynchronous requests and replies in either direction\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_STREAM\fR -.RS 4 -.sp -A socket of type \fIZMQ_STREAM\fR is used to send and receive TCP data from a non\-0MQ peer, when using the tcp:// transport\&. A \fIZMQ_STREAM\fR socket can act as client and/or server, sending and/or receiving TCP data asynchronously\&. -.sp -When receiving TCP data, a \fIZMQ_STREAM\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. -.sp -When sending TCP data, a \fIZMQ_STREAM\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error\&. -.sp -To open a connection to a server, use the zmq_connect call, and then fetch the socket identity using the ZMQ_IDENTITY zmq_getsockopt call\&. -.sp -To close a specific connection, send the identity frame followed by a zero\-length message (see EXAMPLE section)\&. -.sp -When a connection is made, a zero\-length message will be received by the application\&. Similarly, when the peer disconnects (or the connection is lost), a zero\-length message will be received by the application\&. -.sp -You must send one identity frame followed by one data frame\&. The ZMQ_SNDMORE flag is required for identity frames but is ignored on data frames\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&12.\ \&Summary of ZMQ_STREAM characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -none\&. -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -See text -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -EAGAIN -T} -.TE -.sp 1 -.RE -.SS "Request\-reply pattern" -.sp -The request\-reply pattern is used for sending requests from a ZMQ_REQ \fIclient\fR to one or more ZMQ_REP \fIservices\fR, and receiving subsequent replies to each request sent\&. -.sp -The request\-reply pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:28\fR\m[]\&. -.sp -Note: this pattern will be deprecated in favor of the client\-server pattern\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_REQ\fR -.RS 4 -.sp -A socket of type \fIZMQ_REQ\fR is used by a \fIclient\fR to send requests to and receive replies from a \fIservice\fR\&. This socket type allows only an alternating sequence of \fIzmq_send(request)\fR and subsequent \fIzmq_recv(reply)\fR calls\&. Each request sent is round\-robined among all \fIservices\fR, and each reply received is matched with the last issued request\&. -.sp -If no services are available, then any send operation on the socket shall block until at least one \fIservice\fR becomes available\&. The REQ socket shall not discard messages\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&13.\ \&Summary of ZMQ_REQ characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_REP\fR, \fIZMQ_ROUTER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Send, Receive, Send, Receive, \&... -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Last peer -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_REP\fR -.RS 4 -.sp -A socket of type \fIZMQ_REP\fR is used by a \fIservice\fR to receive requests from and send replies to a \fIclient\fR\&. This socket type allows only an alternating sequence of \fIzmq_recv(request)\fR and subsequent \fIzmq_send(reply)\fR calls\&. Each request received is fair\-queued from among all \fIclients\fR, and each reply sent is routed to the \fIclient\fR that issued the last request\&. If the original requester does not exist any more the reply is silently discarded\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&14.\ \&Summary of ZMQ_REP characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_REQ\fR, \fIZMQ_DEALER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Receive, Send, Receive, Send, \&... -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Last peer -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_DEALER\fR -.RS 4 -.sp -A socket of type \fIZMQ_DEALER\fR is an advanced pattern used for extending request/reply sockets\&. Each message sent is round\-robined among all connected peers, and each message received is fair\-queued from all connected peers\&. -.sp -When a \fIZMQ_DEALER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, or if there are no peers at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one peer becomes available for sending; messages are not discarded\&. -.sp -When a \fIZMQ_DEALER\fR socket is connected to a \fIZMQ_REP\fR socket each message sent must consist of an empty message part, the \fIdelimiter\fR, followed by one or more \fIbody parts\fR\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&15.\ \&Summary of ZMQ_DEALER characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_ROUTER\fR, \fIZMQ_REP\fR, \fIZMQ_DEALER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -Round\-robin -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Block -T} -.TE -.sp 1 -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBZMQ_ROUTER\fR -.RS 4 -.sp -A socket of type \fIZMQ_ROUTER\fR is an advanced socket type used for extending request/reply sockets\&. When receiving messages a \fIZMQ_ROUTER\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. When sending messages a \fIZMQ_ROUTER\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to\&. If the peer does not exist anymore the message shall be silently discarded by default, unless \fIZMQ_ROUTER_MANDATORY\fR socket option is set to \fI1\fR\&. -.sp -When a \fIZMQ_ROUTER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, then any messages sent to the socket shall be dropped until the mute state ends\&. Likewise, any messages routed to a peer for which the individual high water mark has been reached shall also be dropped, unless \fIZMQ_ROUTER_MANDATORY\fR socket option is set\&. -.sp -When a \fIZMQ_REQ\fR socket is connected to a \fIZMQ_ROUTER\fR socket, in addition to the \fIidentity\fR of the originating peer each message received shall contain an empty \fIdelimiter\fR message part\&. Hence, the entire structure of each received message as seen by the application becomes: one or more \fIidentity\fR parts, \fIdelimiter\fR part, one or more \fIbody parts\fR\&. When sending replies to a \fIZMQ_REQ\fR socket the application must include the \fIdelimiter\fR part\&. -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.B Table\ \&16.\ \&Summary of ZMQ_ROUTER characteristics -.TS -tab(:); -lt lt -lt lt -lt lt -lt lt -lt lt -lt lt. -T{ -.sp -Compatible peer sockets -T}:T{ -.sp -\fIZMQ_DEALER\fR, \fIZMQ_REQ\fR, \fIZMQ_ROUTER\fR -T} -T{ -.sp -Direction -T}:T{ -.sp -Bidirectional -T} -T{ -.sp -Send/receive pattern -T}:T{ -.sp -Unrestricted -T} -T{ -.sp -Outgoing routing strategy -T}:T{ -.sp -See text -T} -T{ -.sp -Incoming routing strategy -T}:T{ -.sp -Fair\-queued -T} -T{ -.sp -Action in mute state -T}:T{ -.sp -Drop (see text) -T} -.TE -.sp 1 -.RE -.SH "RETURN VALUE" -.sp -The \fIzmq_socket()\fR function shall return an opaque handle to the newly created socket if successful\&. Otherwise, it shall return NULL and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The requested socket -\fItype\fR -is invalid\&. -.RE -.PP -\fBEFAULT\fR -.RS 4 -The provided -\fIcontext\fR -is invalid\&. -.RE -.PP -\fBEMFILE\fR -.RS 4 -The limit on the total number of open 0MQ sockets has been reached\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The context specified was terminated\&. -.RE -.SH "EXAMPLE" -.PP -\fBCreating a simple HTTP server using ZMQ_STREAM\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *ctx = zmq_ctx_new (); -assert (ctx); -/* Create ZMQ_STREAM socket */ -void *socket = zmq_socket (ctx, ZMQ_STREAM); -assert (socket); -int rc = zmq_bind (socket, "tcp://*:8080"); -assert (rc == 0); -/* Data structure to hold the ZMQ_STREAM ID */ -uint8_t id [256]; -size_t id_size = 256; -/* Data structure to hold the ZMQ_STREAM received data */ -uint8_t raw [256]; -size_t raw_size = 256; -while (1) { - /* Get HTTP request; ID frame and then request */ - id_size = zmq_recv (socket, id, 256, 0); - assert (id_size > 0); - do { - raw_size = zmq_recv (socket, raw, 256, 0); - assert (raw_size >= 0); - } while (raw_size == 256); - /* Prepares the response */ - char http_response [] = - "HTTP/1\&.0 200 OK\er\en" - "Content\-Type: text/plain\er\en" - "\er\en" - "Hello, World!"; - /* Sends the ID frame followed by the response */ - zmq_send (socket, id, id_size, ZMQ_SNDMORE); - zmq_send (socket, http_response, strlen (http_response), 0); - /* Closes the connection by sending the ID frame followed by a zero response */ - zmq_send (socket, id, id_size, ZMQ_SNDMORE); - zmq_send (socket, 0, 0, 0); -} -zmq_close (socket); -zmq_ctx_destroy (ctx); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_init\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_inproc\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 deleted file mode 100644 index 26664be708..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 +++ /dev/null @@ -1,241 +0,0 @@ -'\" t -.\" Title: zmq_socket_monitor -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_SOCKET_MONITOR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_socket_monitor \- monitor socket events -.SH "SYNOPSIS" -.sp -\fBint zmq_socket_monitor (void \fR\fB\fI*socket\fR\fR\fB, char \fR\fB\fI*endpoint\fR\fR\fB, int \fR\fB\fIevents\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_socket_monitor()\fR method lets an application thread track socket events (like connects) on a ZeroMQ socket\&. Each call to this method creates a \fIZMQ_PAIR\fR socket and binds that to the specified inproc:// \fIendpoint\fR\&. To collect the socket events, you must create your own \fIZMQ_PAIR\fR socket, and connect that to the endpoint\&. -.sp -The \fIevents\fR argument is a bitmask of the socket events you wish to monitor, see \fISupported events\fR below\&. To monitor all events, use the event value ZMQ_EVENT_ALL\&. NOTE: as new events are added, the catch\-all value will start returning them\&. An application that relies on a strict and fixed sequence of events must not use ZMQ_EVENT_ALL in order to guarantee compatibility with future versions\&. -.sp -Each event is sent as two frames\&. The first frame contains an event number (16 bits), and an event value (32 bits) that provides additional data according to the event number\&. The second frame contains a string that specifies the affected TCP or IPC endpoint\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -The _zmq_socket_monitor()_ method supports only connection\-oriented -transports, that is, TCP, IPC, and TIPC\&. -.fi -.if n \{\ -.RE -.\} -.SH "SUPPORTED EVENTS" -.SS "ZMQ_EVENT_CONNECTED" -.sp -The socket has successfully connected to a remote peer\&. The event value is the file descriptor (FD) of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_CONNECT_DELAYED" -.sp -A connect request on the socket is pending\&. The event value is unspecified\&. -.SS "ZMQ_EVENT_CONNECT_RETRIED" -.sp -A connect request failed, and is now being retried\&. The event value is the reconnect interval in milliseconds\&. Note that the reconnect interval is recalculated at each retry\&. -.SS "ZMQ_EVENT_LISTENING" -.sp -The socket was successfully bound to a network interface\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_BIND_FAILED" -.sp -The socket could not bind to a given interface\&. The event value is the errno generated by the system bind call\&. -.SS "ZMQ_EVENT_ACCEPTED" -.sp -The socket has accepted a connection from a remote peer\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. -.SS "ZMQ_EVENT_ACCEPT_FAILED" -.sp -The socket has rejected a connection from a remote peer\&. The event value is the errno generated by the accept call\&. -.SS "ZMQ_EVENT_CLOSED" -.sp -The socket was closed\&. The event value is the FD of the (now closed) network socket\&. -.SS "ZMQ_EVENT_CLOSE_FAILED" -.sp -The socket close failed\&. The event value is the errno returned by the system call\&. Note that this event occurs only on IPC transports\&. -.SS "ZMQ_EVENT_DISCONNECTED" -.sp -The socket was disconnected unexpectedly\&. The event value is the FD of the underlying network socket\&. Warning: this socket will be closed\&. -.SS "ZMQ_EVENT_MONITOR_STOPPED" -.sp -Monitoring on this socket ended\&. -.SS "ZMQ_EVENT_HANDSHAKE_FAILED" -.sp -The ZMTP security mechanism handshake failed\&. The event value is unspecified\&. NOTE: in DRAFT state, not yet available in stable releases\&. -.SS "ZMQ_EVENT_HANDSHAKE_SUCCEED" -.sp -The ZMTP security mechanism handshake succeeded\&. The event value is unspecified\&. NOTE: in DRAFT state, not yet available in stable releases\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_socket_monitor()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBEPROTONOSUPPORT\fR -.RS 4 -The requested -\fItransport\fR -protocol is not supported\&. Monitor sockets are required to use the inproc:// transport\&. -.RE -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.SH "EXAMPLE" -.PP -\fBMonitoring client and server sockets\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Read one event off the monitor socket; return value and address -// by reference, if not null, and event number by value\&. Returns \-1 -// in case of error\&. - -static int -get_monitor_event (void *monitor, int *value, char **address) -{ - // First frame in message contains event number and value - zmq_msg_t msg; - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == \-1) - return \-1; // Interrupted, presumably - assert (zmq_msg_more (&msg)); - - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - uint16_t event = *(uint16_t *) (data); - if (value) - *value = *(uint32_t *) (data + 2); - - // Second frame in message contains event address - zmq_msg_init (&msg); - if (zmq_msg_recv (&msg, monitor, 0) == \-1) - return \-1; // Interrupted, presumably - assert (!zmq_msg_more (&msg)); - - if (address) { - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); - size_t size = zmq_msg_size (&msg); - *address = (char *) malloc (size + 1); - memcpy (*address, data, size); - (*address)[size] = 0; - } - return event; -} - -int main (void) -{ - void *ctx = zmq_ctx_new (); - assert (ctx); - - // We\*(Aqll monitor these two sockets - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - - // Socket monitoring only works over inproc:// - int rc = zmq_socket_monitor (client, "tcp://127\&.0\&.0\&.1:9999", 0); - assert (rc == \-1); - assert (zmq_errno () == EPROTONOSUPPORT); - - // Monitor all events on client and server sockets - rc = zmq_socket_monitor (client, "inproc://monitor\-client", ZMQ_EVENT_ALL); - assert (rc == 0); - rc = zmq_socket_monitor (server, "inproc://monitor\-server", ZMQ_EVENT_ALL); - assert (rc == 0); - - // Create two sockets for collecting monitor events - void *client_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (client_mon); - void *server_mon = zmq_socket (ctx, ZMQ_PAIR); - assert (server_mon); - - // Connect these to the inproc endpoints so they\*(Aqll get events - rc = zmq_connect (client_mon, "inproc://monitor\-client"); - assert (rc == 0); - rc = zmq_connect (server_mon, "inproc://monitor\-server"); - assert (rc == 0); - - // Now do a basic ping test - rc = zmq_bind (server, "tcp://127\&.0\&.0\&.1:9998"); - assert (rc == 0); - rc = zmq_connect (client, "tcp://127\&.0\&.0\&.1:9998"); - assert (rc == 0); - bounce (client, server); - - // Close client and server - close_zero_linger (client); - close_zero_linger (server); - - // Now collect and check events from both sockets - int event = get_monitor_event (client_mon, NULL, NULL); - if (event == ZMQ_EVENT_CONNECT_DELAYED) - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CONNECTED); - event = get_monitor_event (client_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // This is the flow of server events - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_LISTENING); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_ACCEPTED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_CLOSED); - event = get_monitor_event (server_mon, NULL, NULL); - assert (event == ZMQ_EVENT_MONITOR_STOPPED); - - // Close down the sockets - close_zero_linger (client_mon); - close_zero_linger (server_mon); - zmq_ctx_term (ctx); - - return 0 ; -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 deleted file mode 100644 index f77803861e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_strerror -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_STRERROR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_strerror \- get 0MQ error message string -.SH "SYNOPSIS" -.sp -\fBconst char *zmq_strerror (int \fR\fB\fIerrnum\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_strerror()\fR function shall return a pointer to an error message string corresponding to the error number specified by the \fIerrnum\fR argument\&. As 0MQ defines additional error numbers over and above those defined by the operating system, applications should use \fIzmq_strerror()\fR in preference to the standard \fIstrerror()\fR function\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_strerror()\fR function shall return a pointer to an error message string\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBDisplaying an error message when a 0MQ context cannot be initialised\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -void *ctx = zmq_init (1, 1, 0); -if (!ctx) { - printf ("Error occurred during zmq_init(): %s\en", zmq_strerror (errno)); - abort (); -} -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 deleted file mode 100644 index bef9c5002b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 +++ /dev/null @@ -1,125 +0,0 @@ -'\" t -.\" Title: zmq_unbind -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_UNBIND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_unbind \- Stop accepting connections on a socket -.SH "SYNOPSIS" -.sp -int zmq_unbind (void \fI*socket\fR, const char \fI*endpoint\fR); -.SH "DESCRIPTION" -.sp -The \fIzmq_unbind()\fR function shall unbind a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. -.sp -The \fIendpoint\fR argument is as described in \fBzmq_bind\fR(3) -.SS "Unbinding wild\-card address from a socket" -.sp -When wild\-card * \fIendpoint\fR (described in \fBzmq_tcp\fR(7), \fBzmq_ipc\fR(7) and \fBzmq_vmci\fR(7)) was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_unbind()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. -.SH "ERRORS" -.PP -\fBEINVAL\fR -.RS 4 -The endpoint supplied is invalid\&. -.RE -.PP -\fBETERM\fR -.RS 4 -The 0MQ -\fIcontext\fR -associated with the specified -\fIsocket\fR -was terminated\&. -.RE -.PP -\fBENOTSOCK\fR -.RS 4 -The provided -\fIsocket\fR -was invalid\&. -.RE -.PP -\fBENOENT\fR -.RS 4 -The endpoint supplied was not previously bound\&. -.RE -.SH "EXAMPLES" -.PP -\fBUnbind a subscriber socket from a TCP transport\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Connect it to the host server001, port 5555 using a TCP transport */ -rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -/* Disconnect from the previously connected endpoint */ -rc = zmq_unbind (socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBUnbind wild-card * binded socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -/* Create a ZMQ_SUB socket */ -void *socket = zmq_socket (context, ZMQ_SUB); -assert (socket); -/* Bind it to the system\-assigned ephemeral port using a TCP transport */ -rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:*"); -assert (rc == 0); -/* Obtain real endpoint */ -const size_t buf_size = 32; -char buf[buf_size]; -rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size); -assert (rc == 0); -/* Unbind socket by real endpoint */ -rc = zmq_unbind (socket, buf); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 deleted file mode 100644 index 2b0316947e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" t -.\" Title: zmq_version -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_VERSION" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_version \- report 0MQ library version -.SH "SYNOPSIS" -.sp -\fBvoid zmq_version (int \fR\fB\fI*major\fR\fR\fB, int \fR\fB\fI*minor\fR\fR\fB, int \fR\fB\fI*patch\fR\fR\fB);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_version()\fR function shall fill in the integer variables pointed to by the \fImajor\fR, \fIminor\fR and \fIpatch\fR arguments with the major, minor and patch level components of the 0MQ library version\&. -.sp -This functionality is intended for applications or language bindings dynamically linking to the 0MQ library that wish to determine the actual version of the 0MQ library they are using\&. -.SH "RETURN VALUE" -.sp -There is no return value\&. -.SH "ERRORS" -.sp -No errors are defined\&. -.SH "EXAMPLE" -.PP -\fBPrinting out the version of the 0MQ library\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -int major, minor, patch; -zmq_version (&major, &minor, &patch); -printf ("Current 0MQ version is %d\&.%d\&.%d\en", major, minor, patch); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 deleted file mode 100644 index a8c054b8f3..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 +++ /dev/null @@ -1,64 +0,0 @@ -'\" t -.\" Title: zmq_z85_decode -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_Z85_DECODE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_z85_decode \- decode a binary key from Z85 printable text -.SH "SYNOPSIS" -.sp -\fBuint8_t *zmq_z85_decode (uint8_t *dest, const char *string);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_z85_decode()\fR function shall decode \fIstring\fR into \fIdest\fR\&. The length of \fIstring\fR shall be divisible by 5\&. \fIdest\fR must be large enough for the decoded value (0\&.8 x strlen (string))\&. -.sp -The encoding shall follow the ZMQ RFC 32 specification\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_z85_decode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. -.SH "EXAMPLE" -.PP -\fBDecoding a CURVE key\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -const char decoded [] = "rq:rM>}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7"; -uint8_t public_key [32]; -zmq_z85_decode (public_key, decoded); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve_public\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 deleted file mode 100644 index 442f6bb827..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 +++ /dev/null @@ -1,69 +0,0 @@ -'\" t -.\" Title: zmq_z85_encode -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_Z85_ENCODE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_z85_encode \- encode a binary key as Z85 printable text -.SH "SYNOPSIS" -.sp -\fBchar *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);\fR -.SH "DESCRIPTION" -.sp -The \fIzmq_z85_encode()\fR function shall encode the binary block specified by \fIdata\fR and \fIsize\fR into a string in \fIdest\fR\&. The size of the binary block must be divisible by 4\&. The \fIdest\fR must have sufficient space for size * 1\&.25 plus 1 for a null terminator\&. A 32\-byte CURVE key is encoded as 40 ASCII characters plus a null terminator\&. -.sp -The encoding shall follow the ZMQ RFC 32 specification\&. -.SH "RETURN VALUE" -.sp -The \fIzmq_z85_encode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. -.SH "EXAMPLE" -.PP -\fBEncoding a CURVE key\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -#include -uint8_t public_key [32]; -uint8_t secret_key [32]; -int rc = crypto_box_keypair (public_key, secret_key); -assert (rc == 0); -char encoded [41]; -zmq_z85_encode (encoded, public_key, 32); -puts (encoded); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve_public\fR(3) \fBzmq_curve\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 deleted file mode 100644 index 0be48b58cf..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 +++ /dev/null @@ -1,545 +0,0 @@ -'\" t -.\" Title: zmsg -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZMSG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmsg \- working with multipart messages -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted\&. Does a blocking recv\&. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving\&. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message\&. -// Returns NULL if the message could not be loaded\&. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object\&. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work\&. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status\&. A signal is a short -// message carrying a 1\-byte success/failure code (by convention, 0 means -// OK)\&. Signals are encoded to be distinguishable from "normal" messages\&. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully\&. If the message has no frames, sends nothing but destroys -// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as -// it is a destructor)\&. -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully\&. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part\&. If the message has no frames, sends nothing but destroys -// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as -// it is a destructor)\&. -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i\&.e\&. number of frames (0 or more)\&. -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message\&. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i\&.e\&. before all other frames\&. -// Message takes ownership of frame, will destroy it when message is sent\&. -// Returns 0 on success, \-1 on error\&. Deprecates zmsg_push, which did not -// nullify the caller\*(Aqs frame reference\&. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i\&.e\&. after all other frames\&. -// Message takes ownership of frame, will destroy it when message is sent\&. -// Returns 0 on success\&. Deprecates zmsg_add, which did not nullify the -// caller\*(Aqs frame reference\&. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any\&. Returns frame, or NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message\&. -// Returns 0 on success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string\&. If there were -// no more frames in the message, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame\&. Message takes ownership of -// submessage, so the original is destroyed in this call\&. Returns 0 on -// success, \-1 on error\&. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any\&. Returns zmsg_t, or NULL if -// decoding was not successful\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present\&. Does not destroy frame\&. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message\&. Returns frame, or NULL, if the -// message is empty\&. Use this to navigate the frames as a list\&. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame\&. If there are no more frames, returns NULL\&. To move -// to the first frame call zmsg_first()\&. Advances the cursor\&. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame\&. If there are no frames, returns NULL\&. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else \-1\&. The message is -// saved as a series of frames, each with length and data\&. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ\&. The file format is at present undocumented and liable -// to arbitrary change\&. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame\&. Use this method -// to send structured messages across transports that do not support -// multipart data\&. Allocates and returns a new frame containing the -// serialized message\&. To decode a serialized message frame, use -// zmsg_decode ()\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object\&. Returns a fresh zmsg_t -// object\&. If message is null, or memory was exhausted, returns null\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream)\&. -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message\&. As with zframe_eq, return false if either message is NULL\&. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, \-1 if not\&. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t\&. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket\&. -// Else returns zero\&. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message\&. This is used if/when the message is sent to a -// ZMQ_SERVER socket\&. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmsg\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zmsg class provides methods to send and receive multipart messages across 0MQ sockets\&. This class provides a list\-like container interface, with methods to work with the overall container\&. zmsg_t messages are composed of zero or more zframe_t frames\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmsg\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zmsg_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@inproc://zmsg\&.test"); -assert (output); -zsock_t *input = zsock_new_pair (">inproc://zmsg\&.test"); -assert (input); - -// Test send and receive of single\-frame message -zmsg_t *msg = zmsg_new (); -assert (msg); -zframe_t *frame = zframe_new ("Hello", 5); -assert (frame); -zmsg_prepend (msg, &frame); -assert (zmsg_size (msg) == 1); -assert (zmsg_content_size (msg) == 5); -rc = zmsg_send (&msg, output); -assert (msg == NULL); -assert (rc == 0); - -msg = zmsg_recv (input); -assert (msg); -assert (zmsg_size (msg) == 1); -assert (zmsg_content_size (msg) == 5); -zmsg_destroy (&msg); - -// Test send and receive of multi\-frame message -msg = zmsg_new (); -assert (msg); -rc = zmsg_addmem (msg, "Frame0", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame1", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame2", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame3", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame4", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame5", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame6", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame7", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame8", 6); -assert (rc == 0); -rc = zmsg_addmem (msg, "Frame9", 6); -assert (rc == 0); -zmsg_t *copy = zmsg_dup (msg); -assert (copy); -rc = zmsg_send (©, output); -assert (rc == 0); -rc = zmsg_send (&msg, output); -assert (rc == 0); - -copy = zmsg_recv (input); -assert (copy); -assert (zmsg_size (copy) == 10); -assert (zmsg_content_size (copy) == 60); -zmsg_destroy (©); - -msg = zmsg_recv (input); -assert (msg); -assert (zmsg_size (msg) == 10); -assert (zmsg_content_size (msg) == 60); - -// Save to a file, read back -FILE *file = fopen ("zmsg\&.test", "w"); -assert (file); -rc = zmsg_save (msg, file); -assert (rc == 0); -fclose (file); - -file = fopen ("zmsg\&.test", "r"); -rc = zmsg_save (msg, file); -assert (rc == \-1); -fclose (file); -zmsg_destroy (&msg); - -file = fopen ("zmsg\&.test", "r"); -msg = zmsg_load (file); -assert (msg); -fclose (file); -remove ("zmsg\&.test"); -assert (zmsg_size (msg) == 10); -assert (zmsg_content_size (msg) == 60); - -// Remove all frames except first and last -int frame_nbr; -for (frame_nbr = 0; frame_nbr < 8; frame_nbr++) { - zmsg_first (msg); - frame = zmsg_next (msg); - zmsg_remove (msg, frame); - zframe_destroy (&frame); -} -// Test message frame manipulation -assert (zmsg_size (msg) == 2); -frame = zmsg_last (msg); -assert (zframe_streq (frame, "Frame9")); -assert (zmsg_content_size (msg) == 12); -frame = zframe_new ("Address", 7); -assert (frame); -zmsg_prepend (msg, &frame); -assert (zmsg_size (msg) == 3); -rc = zmsg_addstr (msg, "Body"); -assert (rc == 0); -assert (zmsg_size (msg) == 4); -frame = zmsg_pop (msg); -zframe_destroy (&frame); -assert (zmsg_size (msg) == 3); -char *body = zmsg_popstr (msg); -assert (streq (body, "Frame0")); -free (body); -zmsg_destroy (&msg); - -// Test encoding/decoding -msg = zmsg_new (); -assert (msg); -byte *blank = (byte *) zmalloc (100000); -assert (blank); -rc = zmsg_addmem (msg, blank, 0); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 1); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 253); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 254); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 255); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 256); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65535); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65536); -assert (rc == 0); -rc = zmsg_addmem (msg, blank, 65537); -assert (rc == 0); -free (blank); -assert (zmsg_size (msg) == 9); -frame = zmsg_encode (msg); -zmsg_destroy (&msg); -msg = zmsg_decode (frame); -assert (msg); -zmsg_destroy (&msg); -zframe_destroy (&frame); - -// Test submessages -msg = zmsg_new (); -assert (msg); -zmsg_t *submsg = zmsg_new (); -zmsg_pushstr (msg, "matr"); -zmsg_pushstr (submsg, "joska"); -rc = zmsg_addmsg (msg, &submsg); -assert (rc == 0); -assert (submsg == NULL); -submsg = zmsg_popmsg (msg); -assert (submsg == NULL); // string "matr" is not encoded zmsg_t, so was discarded -submsg = zmsg_popmsg (msg); -assert (submsg); -body = zmsg_popstr (submsg); -assert (streq (body, "joska")); -free (body); -zmsg_destroy (&submsg); -frame = zmsg_pop (msg); -assert (frame == NULL); -zmsg_destroy (&msg); - -// Test comparison of two messages -msg = zmsg_new (); -zmsg_addstr (msg, "One"); -zmsg_addstr (msg, "Two"); -zmsg_addstr (msg, "Three"); -zmsg_t *msg_other = zmsg_new (); -zmsg_addstr (msg_other, "One"); -zmsg_addstr (msg_other, "Two"); -zmsg_addstr (msg_other, "One\-Hundred"); -zmsg_t *msg_dup = zmsg_dup (msg); -zmsg_t *empty_msg = zmsg_new (); -zmsg_t *empty_msg_2 = zmsg_new (); -assert (zmsg_eq (msg, msg_dup)); -assert (!zmsg_eq (msg, msg_other)); -assert (zmsg_eq (empty_msg, empty_msg_2)); -assert (!zmsg_eq (msg, NULL)); -assert (!zmsg_eq (NULL, empty_msg)); -assert (!zmsg_eq (NULL, NULL)); -zmsg_destroy (&msg); -zmsg_destroy (&msg_other); -zmsg_destroy (&msg_dup); -zmsg_destroy (&empty_msg); -zmsg_destroy (&empty_msg_2); - -// Test signal messages -msg = zmsg_new_signal (0); -assert (zmsg_signal (msg) == 0); -zmsg_destroy (&msg); -msg = zmsg_new_signal (\-1); -assert (zmsg_signal (msg) == 255); -zmsg_destroy (&msg); - -// Now try methods on an empty message -msg = zmsg_new (); -assert (msg); -assert (zmsg_size (msg) == 0); -assert (zmsg_unwrap (msg) == NULL); -assert (zmsg_first (msg) == NULL); -assert (zmsg_last (msg) == NULL); -assert (zmsg_next (msg) == NULL); -assert (zmsg_pop (msg) == NULL); -// Sending an empty message is valid and destroys the message -assert (zmsg_send (&msg, output) == 0); -assert (!msg); - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Create server and client sockets and connect over inproc -zsock_t *server = zsock_new_server ("inproc://zmsg\-test\-routing"); -assert (server); -zsock_t *client = zsock_new_client ("inproc://zmsg\-test\-routing"); -assert (client); - -// Send request from client to server -zmsg_t *request = zmsg_new (); -assert (request); -zmsg_addstr (request, "Hello"); -rc = zmsg_send (&request, client); -assert (rc == 0); -assert (!request); - -// Read request and send reply -request = zmsg_recv (server); -assert (request); -char *string = zmsg_popstr (request); -assert (streq (string, "Hello")); -assert (zmsg_routing_id (request)); -zstr_free (&string); - -zmsg_t *reply = zmsg_new (); -assert (reply); -zmsg_addstr (reply, "World"); -zmsg_set_routing_id (reply, zmsg_routing_id (request)); -rc = zmsg_send (&reply, server); -assert (rc == 0); -zmsg_destroy (&request); - -// Read reply -reply = zmsg_recv (client); -string = zmsg_popstr (reply); -assert (streq (string, "World")); -assert (zmsg_routing_id (reply) == 0); -zmsg_destroy (&reply); -zstr_free (&string); - -// Client and server disallow multipart -msg = zmsg_new (); -zmsg_addstr (msg, "One"); -zmsg_addstr (msg, "Two"); -rc = zmsg_send (&msg, client); -assert (rc == \-1); -assert (zmsg_size (msg) == 2); -rc = zmsg_send (&msg, server); -assert (rc == \-1); -assert (zmsg_size (msg) == 2); -zmsg_destroy (&msg); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 deleted file mode 100644 index 33e0170d5e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 +++ /dev/null @@ -1,216 +0,0 @@ -'\" t -.\" Title: zpoller -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPOLLER" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zpoller \- trivial socket poller class -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create new poller, specifying zero or more readers\&. The list of -// readers ends in a NULL\&. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle\&. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, \&.\&.\&.); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled\&. Returns 0 if OK, \-1 on failure\&. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance\&. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, \-1 on failure\&. The reader -// must have been passed during construction, or in an zpoller_add () call\&. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal\&. This makes it impossible to shut\-down message based architectures -// like zactors\&. This method lets you switch off break handling\&. The default -// nonstop setting is off (false)\&. -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input\&. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add\&. The timeout should be -// zero or greater, or \-1 to wait indefinitely\&. Socket priority is defined -// by their order in the poll list\&. If you need a balanced poll, use the low -// level zmq_poll method directly\&. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL\&. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated ()\&. The timeout is in msec\&. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error\&. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed\&. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zpoller\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zpoller class provides a minimalist interface to ZeroMQ\(cqs zmq_poll API, for the very common case of reading from a number of sockets\&. It does not provide polling for output, nor polling on file handles\&. If you need either of these, use the zmq_poll API directly\&. -.sp -The class implements the poller using the zmq_poller API if that exists, else does the work itself\&. -.SH "EXAMPLE" -.PP -\fBFrom zpoller_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create a few sockets -zsock_t *vent = zsock_new (ZMQ_PUSH); -assert (vent); -int port_nbr = zsock_bind (vent, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -zsock_t *sink = zsock_new (ZMQ_PULL); -assert (sink); -int rc = zsock_connect (sink, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); -zsock_t *bowl = zsock_new (ZMQ_PULL); -assert (bowl); -zsock_t *dish = zsock_new (ZMQ_PULL); -assert (dish); - -// Set up poller -zpoller_t *poller = zpoller_new (bowl, dish, NULL); -assert (poller); - -// Add a reader to the existing poller -rc = zpoller_add (poller, sink); -assert (rc == 0); - -zstr_send (vent, "Hello, World"); - -// We expect a message only on the sink -zsock_t *which = (zsock_t *) zpoller_wait (poller, \-1); -assert (which == sink); -assert (zpoller_expired (poller) == false); -assert (zpoller_terminated (poller) == false); -char *message = zstr_recv (which); -assert (streq (message, "Hello, World")); -zstr_free (&message); - -// Stop polling reader -rc = zpoller_remove (poller, sink); -assert (rc == 0); - -// Check we can poll an FD -rc = zsock_connect (bowl, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); -SOCKET fd = zsock_fd (bowl); -rc = zpoller_add (poller, (void *) &fd); -assert (rc != \-1); -zstr_send (vent, "Hello again, world"); -assert (zpoller_wait (poller, 500) == &fd); - -// Check zpoller_set_nonstop () -zsys_interrupted = 1; -zpoller_wait (poller, 0); -assert (zpoller_terminated (poller)); -zpoller_set_nonstop (poller, true); -zpoller_wait (poller, 0); -assert (!zpoller_terminated (poller)); -zsys_interrupted = 0; - -zpoller_destroy (&poller); -zsock_destroy (&vent); -zsock_destroy (&sink); -zsock_destroy (&bowl); -zsock_destroy (&dish); - -#ifdef ZMQ_SERVER -// Check thread safe sockets -zpoller_destroy (&poller); -zsock_t *client = zsock_new (ZMQ_CLIENT); -assert (client); -zsock_t *server = zsock_new (ZMQ_SERVER); -assert (server); -poller = zpoller_new (client, server, NULL); -assert (poller); -port_nbr = zsock_bind (server, "tcp://127\&.0\&.0\&.1:*"); -assert (port_nbr != \-1); -rc = zsock_connect (client, "tcp://127\&.0\&.0\&.1:%d", port_nbr); -assert (rc != \-1); - -zstr_send (client, "Hello, World"); - -// We expect a message only on the server -which = (zsock_t *) zpoller_wait (poller, \-1); -assert (which == server); -assert (zpoller_expired (poller) == false); -assert (zpoller_terminated (poller) == false); -message = zstr_recv (which); -assert (streq (message, "Hello, World")); -zstr_free (&message); - -zpoller_destroy (&poller); -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 deleted file mode 100644 index 9bfcfa9c84..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 +++ /dev/null @@ -1,208 +0,0 @@ -'\" t -.\" Title: zproc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPROC" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zproc \- process configuration and status -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6\-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch\&. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal\&. -// It is good practice to use this method to exit any infinite loop -// processing messages\&. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security\&. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints\&. -// If the host name is not resolvable, returns NULL\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background\&. The precise effect -// depends on the operating system\&. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP\&. On Windows, does nothing\&. Returns 0 if OK, \-1 if there -// was an error\&. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user\&. Any of the -// arguments may be null, indicating a no\-op\&. Returns 0 on success, -// \-1 on failure\&. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID\&. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use\&. A good -// rule of thumb is one thread per gigabit of traffic in or out\&. The -// default is 1, sufficient for most applications\&. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow\&. The default -// is 1024\&. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon\&. -// This lets the interface be configured for test environments where required\&. -// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is -// the default when there is no specified interface\&. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name\&. -// Setting the interface to "*" means "use all available interfaces"\&. -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set\&. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process\&. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set\&. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint\&. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint\&. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout\&. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints\&. To disable the sender, call -// this method with a null argument\&. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows)\&. By default this is disabled\&. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition \- highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition \- high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition \- normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log informational message \- low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log debug\-level message \- lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, \&.\&.\&.) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -zproc \- process configuration and status -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zproc\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zproc_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 deleted file mode 100644 index 037d3da6bb..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 +++ /dev/null @@ -1,402 +0,0 @@ -'\" t -.\" Title: zproxy -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZPROXY" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zproxy \- run a steerable proxy in the background -.SH "SYNOPSIS" -.sp -.nf -// Create new zproxy actor instance\&. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance\&. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command\&. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type \-\- see zsock_type_str () \-\- and attach to -// endpoints, see zsock_attach ()\&. Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type \-\- see zsock_type_str () \-\- and attach to -// endpoints, see zsock_attach ()\&. Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy\&. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high\-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy\&. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_zap_domain ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_plain_server ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket \-\- see zsock_set_curve_server () \-\- specifying both the public and -// secret keys of a certificate as Z85 armored strings \-\- see -// zcert_public_txt () and zcert_secret_txt ()\&. Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproxy\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -A zproxy actor switches messages between a frontend and a backend socket\&. It acts much like the zmq_proxy_steerable method, though it makes benefit of CZMQ\(cqs facilities, to be somewhat simpler to set\-up\&. -.sp -This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. -.SH "EXAMPLE" -.PP -\fBFrom zproxy_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create and configure our proxy -zactor_t *proxy = zactor_new (zproxy, NULL); -assert (proxy); -if (verbose) { - zstr_sendx (proxy, "VERBOSE", NULL); - zsock_wait (proxy); -} -zstr_sendx (proxy, "FRONTEND", "PULL", "inproc://frontend", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "BACKEND", "PUSH", "inproc://backend", NULL); -zsock_wait (proxy); - -// Connect application sockets to proxy -zsock_t *faucet = zsock_new_push (">inproc://frontend"); -assert (faucet); -zsock_t *sink = zsock_new_pull (">inproc://backend"); -assert (sink); - -// Send some messages and check they arrived -char *hello, *world; -zstr_sendx (faucet, "Hello", "World", NULL); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -// Test pause/resume functionality -zstr_sendx (proxy, "PAUSE", NULL); -zsock_wait (proxy); -zstr_sendx (faucet, "Hello", "World", NULL); -zsock_set_rcvtimeo (sink, 100); -zstr_recvx (sink, &hello, &world, NULL); -assert (!hello && !world); - -zstr_sendx (proxy, "RESUME", NULL); -zsock_wait (proxy); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -// Test capture functionality -zsock_t *capture = zsock_new_pull ("inproc://capture"); -assert (capture); - -// Switch on capturing, check that it works -zstr_sendx (proxy, "CAPTURE", "inproc://capture", NULL); -zsock_wait (proxy); -zstr_sendx (faucet, "Hello", "World", NULL); -zstr_recvx (sink, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -zstr_recvx (capture, &hello, &world, NULL); -assert (streq (hello, "Hello")); -assert (streq (world, "World")); -zstr_free (&hello); -zstr_free (&world); - -zsock_destroy (&faucet); -zsock_destroy (&sink); -zsock_destroy (&capture); -zactor_destroy (&proxy); - -// Test socket creation dependency -proxy = zactor_new (zproxy, NULL); -assert (proxy); - -sink = zsock_new_sub (">ipc://backend", "whatever"); -assert (sink); - -zstr_sendx (proxy, "BACKEND", "XPUB", "ipc://backend", NULL); -zsock_wait (proxy); - -zsock_destroy(&sink); -zactor_destroy(&proxy); - -#if (ZMQ_VERSION_MAJOR == 4) -// Test authentication functionality -# define TESTDIR "\&.test_zproxy" - -// Create temporary directory for test files -zsys_dir_create (TESTDIR); - -char *frontend = NULL; -char *backend = NULL; - -// Check there\*(Aqs no authentication -s_create_test_sockets (&proxy, &faucet, &sink, verbose); -s_bind_test_sockets (proxy, &frontend, &backend); -bool success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Install the authenticator -zactor_t *auth = zactor_new (zauth, NULL); -assert (auth); -if (verbose) { - zstr_sendx (auth, "VERBOSE", NULL); - zsock_wait (auth); -} - -// Check there\*(Aqs no authentication on a default NULL server -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// When we set a domain on the server, we switch on authentication -// for NULL sockets, but with no policies, the client connection -// will be allowed\&. -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Blacklist 127\&.0\&.0\&.1, connection should fail -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -// Whitelist our address, which overrides the blacklist -zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "DOMAIN", "BACKEND", "global", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Try PLAIN authentication - -// Test negative case (no server\-side passwords defined) -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Password"); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -// Test positive case (server\-side passwords defined) -FILE *password = fopen (TESTDIR "/password\-file", "w"); -assert (password); -fprintf (password, "admin=Password\en"); -fclose (password); -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Password"); -zsock_set_plain_username (sink, "admin"); -zsock_set_plain_password (sink, "Password"); -zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); -zsock_wait (auth); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Test negative case (bad client password) -zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); -zsock_wait (proxy); -s_bind_test_sockets (proxy, &frontend, &backend); -zsock_set_plain_username (faucet, "admin"); -zsock_set_plain_password (faucet, "Bogus"); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (!success); - -if (zsys_has_curve ()) { - // We\*(Aqll create two new certificates and save the client public - // certificate on disk - zcert_t *server_cert = zcert_new (); - assert (server_cert); - zcert_t *client_cert = zcert_new (); - assert (client_cert); - const char *public_key = zcert_public_txt (server_cert); - const char *secret_key = zcert_secret_txt (server_cert); - - // Try CURVE authentication - - // Test without setting\-up any authentication - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (!success); - - // Test CURVE_ALLOW_ANY - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); - zsock_wait (auth); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (success); - - // Test with client certificate file in authentication folder - zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); - zsock_wait (proxy); - zstr_sendx (proxy, "CURVE", "BACKEND", public_key, secret_key, NULL); - zsock_wait (proxy); - s_bind_test_sockets (proxy, &frontend, &backend); - zcert_apply (client_cert, faucet); - zsock_set_curve_serverkey (faucet, public_key); - zcert_apply (client_cert, sink); - zsock_set_curve_serverkey (sink, public_key); - zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); - zstr_sendx (auth, "CURVE", TESTDIR, NULL); - zsock_wait (auth); - success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); - assert (success); - - zcert_destroy (&server_cert); - zcert_destroy (&client_cert); -} - -// Remove the authenticator and check a normal connection works -zactor_destroy (&auth); -s_bind_test_sockets (proxy, &frontend, &backend); -success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); -assert (success); - -// Cleanup -zsock_destroy (&faucet); -zsock_destroy (&sink); -zactor_destroy (&proxy); -zstr_free (&frontend); -zstr_free (&backend); - -// Delete temporary directory and test files -zsys_file_delete (TESTDIR "/password\-file"); -zsys_file_delete (TESTDIR "/mycert\&.txt"); -zsys_dir_delete (TESTDIR); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 deleted file mode 100644 index 99c7337d40..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 +++ /dev/null @@ -1,199 +0,0 @@ -'\" t -.\" Title: zrex -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZREX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zrex \- work with regular expressions -.SH "SYNOPSIS" -.sp -.nf -// Constructor\&. Optionally, sets an expression against which we can match -// text and capture hits\&. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror()\&. If you -// set a pattern, you can call zrex_matches() to test it against text\&. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors\&. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression\&. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression\&. -// Use this method to compare one expression against many strings\&. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression\&. Use this -// method to compare one string against several expressions\&. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq\&. If the text -// matched, returns 1 plus the number of capture groups\&. If the text did -// not match, returns zero\&. To retrieve individual capture groups, call -// zrex_hit ()\&. -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits()\&. Capture group 0 is the -// whole matching string\&. Sequence 1 is the first capture group, if any, -// and so on\&. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index\&. Caller should not modify nor -// free the returned values\&. Returns number of strings returned\&. This -// method starts at hit 1, i\&.e\&. first capture group, as hit 0 is always -// the original matched string\&. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, \&.\&.\&.); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zrex\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -Wraps a very simple regular expression library (SLRE) as a CZMQ class\&. Supports this syntax: -.sp -.if n \{\ -.RS 4 -.\} -.nf -^ Match beginning of a buffer -$ Match end of a buffer -() Grouping and substring capturing -[\&.\&.\&.] Match any character from set -[^\&.\&.\&.] Match any character but ones from set -\&. Match any character -\es Match whitespace -\eS Match non\-whitespace -\ed Match decimal digit -\eD Match non decimal digit -\ea Match alphabetic character -\eA Match non\-alphabetic character -\ew Match alphanumeric character -\eW Match non\-alphanumeric character -\er Match carriage return -\en Match newline -+ Match one or more times (greedy) -+? Match one or more times (non\-greedy) -* Match zero or more times (greedy) -*? Match zero or more times (non\-greedy) -? Match zero or once -\exDD Match byte with hex value 0xDD -\emeta Match one of the meta character: ^$()\&.[*+?\e -.fi -.if n \{\ -.RE -.\} -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zrex\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zrex_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// This shows the pattern of matching many lines to a single pattern -zrex_t *rex = zrex_new ("\e\ed+\-\e\ed+\-\e\ed+"); -assert (rex); -assert (zrex_valid (rex)); -bool matches = zrex_matches (rex, "123\-456\-789"); -assert (matches); -assert (zrex_hits (rex) == 1); -assert (streq (zrex_hit (rex, 0), "123\-456\-789")); -assert (zrex_hit (rex, 1) == NULL); -zrex_destroy (&rex); - -// Here we pick out hits using capture groups -rex = zrex_new ("(\e\ed+)\-(\e\ed+)\-(\e\ed+)"); -assert (rex); -assert (zrex_valid (rex)); -matches = zrex_matches (rex, "123\-456\-ABC"); -assert (!matches); -matches = zrex_matches (rex, "123\-456\-789"); -assert (matches); -assert (zrex_hits (rex) == 4); -assert (streq (zrex_hit (rex, 0), "123\-456\-789")); -assert (streq (zrex_hit (rex, 1), "123")); -assert (streq (zrex_hit (rex, 2), "456")); -assert (streq (zrex_hit (rex, 3), "789")); -zrex_destroy (&rex); - -// This shows the pattern of matching one line against many -// patterns and then handling the case when it hits -rex = zrex_new (NULL); // No initial pattern -assert (rex); -char *input = "Mechanism: CURVE"; -matches = zrex_eq (rex, input, "Version: (\&.+)"); -assert (!matches); -assert (zrex_hits (rex) == 0); -matches = zrex_eq (rex, input, "Mechanism: (\&.+)"); -assert (matches); -assert (zrex_hits (rex) == 2); -const char *mechanism; -zrex_fetch (rex, &mechanism, NULL); -assert (streq (zrex_hit (rex, 1), "CURVE")); -assert (streq (mechanism, "CURVE")); -zrex_destroy (&rex); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 deleted file mode 100644 index fc4a7e8b44..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 +++ /dev/null @@ -1,1469 +0,0 @@ -'\" t -.\" Title: zsock -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsock \- high\-level socket API that hides libzmq contexts and sockets -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Create a new socket\&. Returns the new socket, or NULL if the new socket -// could not be created\&. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection\&. This can have -// performance implications if you use a LOT of sockets\&. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK\&. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string\&. Default -// action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket\&. You must use this for any socket created via the -// zsock_new method\&. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint\&. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*"\&. By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535)\&. -// To override this range, follow the "*" with "[first\-last]"\&. Either or -// both first and last may be empty\&. To bind to a random port within the -// range, use "!" in place of "*"\&. -// -// Examples: -// tcp://127\&.0\&.0\&.1:* bind to first free port from C000 up -// tcp://127\&.0\&.0\&.1:! bind to random port from C000 to FFFF -// tcp://127\&.0\&.0\&.1:*[60000\-] bind to first free port from 60000 up -// tcp://127\&.0\&.0\&.1:![\-60000] bind to random port from C000 to 60000 -// tcp://127\&.0\&.0\&.1:![55000\-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports\&. On failure, returns \-1\&. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware\&. Protocols that run on ephemeral ports should take -// this into account\&. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any\&. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint\&. -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid\&. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, \-1 if the endpoint was invalid or the function -// isn\*(Aqt supported\&. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints\&. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// \*(Aq@\*(Aq (to bind the socket) or \*(Aq>\*(Aq (to connect the socket)\&. Returns 0 if all -// endpoints were valid, or \-1 if there was a syntax error\&. If the endpoint -// does not start with \*(Aq@\*(Aq or \*(Aq>\*(Aq, the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false)\&. -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string\&. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. The picture is a -// string that defines the type of each frame\&. This makes it easy to send -// a complex multiframe message in one call\&. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero\-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe\&. Does not change or take ownership of -// any arguments\&. Returns 0 if successful, \-1 if sending failed for any -// reason\&. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, \&.\&.\&.); - -// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details\&. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a \*(Aqpicture\*(Aq message to the socket (or actor)\&. See zsock_send for -// the format and meaning of the picture\&. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32\-bit unsigned integer) -// 8 = uint64_t * (stores 64\-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them\&. The supplied pointers do not need -// to be initialized\&. Returns 0 if successful, or \-1 if it failed to recv -// a message, in which case the pointers are not modified\&. When message -// frames are truncated (a short message), sets return values to zero/null\&. -// If an argument pointer is NULL, does not store any value (skips it)\&. -// An \*(Aqn\*(Aq picture matches an empty frame; if the message does not match, -// the method will return \-1\&. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, \&.\&.\&.); - -// Receive a \*(Aqpicture\*(Aq message from the socket (or actor)\&. This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details\&. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded \*(Aqpicture\*(Aq message to the socket (or actor)\&. This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations\&. The pattern argument is a string that defines the -// type of each argument\&. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0\-255 chars type = "string" -// S char *, 0\-2^32\-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments\&. Returns 0 if -// successful, \-1 if sending failed for any reason\&. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, \&.\&.\&.); - -// Receive a binary encoded \*(Aqpicture\*(Aq message from the socket (or actor)\&. -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations\&. The pattern argument is a string that defines -// the type of each argument\&. See zsock_bsend for the supported argument -// types\&. All arguments must be pointers; this call sets them to point to -// values held on a per\-socket basis\&. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them\&. The supplied pointers do not need -// to be initialized\&. Returns 0 if successful, or \-1 if it failed to read -// a message\&. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, \&.\&.\&.); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory\&. This method works -// across all versions of ZeroMQ\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket\&. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK)\&. Signals are encoded -// to be distinguishable from "normal" messages\&. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, \-1 if the signal could -// not be sent\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal\&. Use this to coordinate between threads, over pipe -// pairs\&. Blocks until the signal is received\&. Returns \-1 on error, 0 or -// greater on success\&. Accepts a zsock_t or a zactor_t as argument\&. -// Takes a polymorphic socket reference\&. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it\&. This is useful when reading partial messages, to get specific -// message types\&. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t\&. -// Takes a polymorphic socket reference\&. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference\&. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value\&. Takes a polymorphic socket reference\&. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`\&. -// Available from libzmq 4\&.2\&.0\&. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32\-octet binary -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`\&. -// Available from libzmq 4\&.1\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`\&. -// Available from libzmq 4\&.1\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32\-octet binary -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`\&. -// Available from libzmq 4\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`\&. -// Available from libzmq 4\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`\&. -// Available from libzmq 3\&.0\&.0\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`\&. -// Available from libzmq 3\&.0\&.0\&. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class\&. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket\&. Default action is bind\&. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket\&. Default action is connect\&. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any\&. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it\&. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket\&. The socket MUST be of type ZMQ_SERVER\&. -// This will be used when sending messages on the socket via the zsock API\&. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. -// Returns 0 if OK, \-1 if failed\&. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. -// Returns 0 if OK, \-1 if failed\&. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsock\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zsock class wraps the libzmq socket handle (a void *) with a proper structure that follows the CLASS rules for construction and destruction\&. Some zsock methods take a void * "polymorphic" reference, which can be either a zsock_t or a zactor_t reference, or a libzmq void *\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsock\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zsock_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsock_t *writer = zsock_new_push ("@tcp://127\&.0\&.0\&.1:5560"); -assert (writer); -assert (zsock_resolve (writer) != writer); -assert (streq (zsock_type_str (writer), "PUSH")); - -int rc; -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) -// Check unbind -rc = zsock_unbind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); -assert (rc == 0); - -// In some cases and especially when running under Valgrind, doing -// a bind immediately after an unbind causes an EADDRINUSE error\&. -// Even a short sleep allows the OS to release the port for reuse\&. -zclock_sleep (100); - -// Bind again -rc = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); -assert (rc == 5560); -assert (streq (zsock_endpoint (writer), "tcp://127\&.0\&.0\&.1:5560")); -#endif - -zsock_t *reader = zsock_new_pull (">tcp://127\&.0\&.0\&.1:5560"); -assert (reader); -assert (zsock_resolve (reader) != reader); -assert (streq (zsock_type_str (reader), "PULL")); - -// Basic Hello, World -zstr_send (writer, "Hello, World"); -zmsg_t *msg = zmsg_recv (reader); -assert (msg); -char *string = zmsg_popstr (msg); -assert (streq (string, "Hello, World")); -free (string); -zmsg_destroy (&msg); - -// Test resolve libzmq socket -#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) -void *zmq_ctx = zmq_ctx_new (); -#else -void *zmq_ctx = zmq_ctx_new (1); -#endif -assert (zmq_ctx); -void *zmq_sock = zmq_socket (zmq_ctx, ZMQ_PUB); -assert (zmq_sock); -assert (zsock_resolve (zmq_sock) == zmq_sock); -zmq_close (zmq_sock); -zmq_ctx_term (zmq_ctx); - -// Test resolve zsock -zsock_t *resolve = zsock_new_pub("@tcp://127\&.0\&.0\&.1:5561"); -assert (resolve); -assert (zsock_resolve (resolve) == resolve\->handle); -zsock_destroy (&resolve); - -// Test resolve FD -SOCKET fd = zsock_fd (reader); -assert (zsock_resolve ((void *) &fd) == NULL); - -// Test binding to ephemeral ports, sequential and random -int port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*"); -assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[50000\-]"); -assert (port >= 50000 && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[\-50001]"); -assert (port >= DYNAMIC_FIRST && port <= 50001); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[60000\-60050]"); -assert (port >= 60000 && port <= 60050); - -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:!"); -assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![50000\-]"); -assert (port >= 50000 && port <= DYNAMIC_LAST); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![\-50001]"); -assert (port >= DYNAMIC_FIRST && port <= 50001); -port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![60000\-60050]"); -assert (port >= 60000 && port <= 60050); - -// Test zsock_attach method -zsock_t *server = zsock_new (ZMQ_DEALER); -assert (server); -rc = zsock_attach (server, "@inproc://myendpoint,tcp://127\&.0\&.0\&.1:5556,inproc://others", true); -assert (rc == 0); -rc = zsock_attach (server, "", false); -assert (rc == 0); -rc = zsock_attach (server, NULL, true); -assert (rc == 0); -rc = zsock_attach (server, ">a,@b, c,, ", false); -assert (rc == \-1); -zsock_destroy (&server); - -// Test zsock_endpoint method -rc = zsock_bind (writer, "inproc://test\&.%s", "writer"); -assert (rc == 0); -assert (streq (zsock_endpoint (writer), "inproc://test\&.writer")); - -// Test error state when connecting to an invalid socket type -// (\*(Aqtxp://\*(Aq instead of \*(Aqtcp://\*(Aq, typo intentional) -rc = zsock_connect (reader, "txp://127\&.0\&.0\&.1:5560"); -assert (rc == \-1); - -// Test signal/wait methods -rc = zsock_signal (writer, 123); -assert (rc == 0); -rc = zsock_wait (reader); -assert (rc == 123); - -// Test zsock_send/recv pictures -uint8_t number1 = 123; -uint16_t number2 = 123 * 123; -uint32_t number4 = 123 * 123; -number4 *= 123; -uint32_t number4_MAX = UINT32_MAX; -uint64_t number8 = 123 * 123; -number8 *= 123; -number8 *= 123; -uint64_t number8_MAX = UINT64_MAX; - -zchunk_t *chunk = zchunk_new ("HELLO", 5); -assert (chunk); -zframe_t *frame = zframe_new ("WORLD", 5); -assert (frame); -zhashx_t *hash = zhashx_new (); -assert (hash); -zuuid_t *uuid = zuuid_new (); -assert (uuid); -zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); -zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); -zhashx_insert (hash, "1", "value A"); -zhashx_insert (hash, "2", "value B"); -char *original = "pointer"; - -// Test zsock_recv into each supported type -zsock_send (writer, "i124488zsbcfUhp", - \-12345, number1, number2, number4, number4_MAX, - number8, number8_MAX, - "This is a string", "ABCDE", 5, - chunk, frame, uuid, hash, original); -char *uuid_str = strdup (zuuid_str (uuid)); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zuuid_destroy (&uuid); -zhashx_destroy (&hash); - -int integer; -byte *data; -size_t size; -char *pointer; -number8_MAX = number8 = number4_MAX = number4 = number2 = number1 = 0ULL; -rc = zsock_recv (reader, "i124488zsbcfUhp", - &integer, &number1, &number2, &number4, &number4_MAX, - &number8, &number8_MAX, &string, &data, &size, &chunk, - &frame, &uuid, &hash, &pointer); -assert (rc == 0); -assert (integer == \-12345); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number4_MAX == UINT32_MAX); -assert (number8 == 123 * 123 * 123 * 123); -assert (number8_MAX == UINT64_MAX); -assert (streq (string, "This is a string")); -assert (memcmp (data, "ABCDE", 5) == 0); -assert (size == 5); -assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); -assert (zchunk_size (chunk) == 5); -assert (streq (uuid_str, zuuid_str (uuid))); -assert (memcmp (zframe_data (frame), "WORLD", 5) == 0); -assert (zframe_size (frame) == 5); -char *value = (char *) zhashx_lookup (hash, "1"); -assert (streq (value, "value A")); -value = (char *) zhashx_lookup (hash, "2"); -assert (streq (value, "value B")); -assert (original == pointer); -free (string); -free (data); -free (uuid_str); -zframe_destroy (&frame); -zchunk_destroy (&chunk); -zhashx_destroy (&hash); -zuuid_destroy (&uuid); - -// Test zsock_recv of short message; this lets us return a failure -// with a status code and then nothing else; the receiver will get -// the status code and NULL/zero for all other values -zsock_send (writer, "i", \-1); -zsock_recv (reader, "izsbcfp", - &integer, &string, &data, &size, &chunk, &frame, &pointer); -assert (integer == \-1); -assert (string == NULL); -assert (data == NULL); -assert (size == 0); -assert (chunk == NULL); -assert (frame == NULL); -assert (pointer == NULL); - -msg = zmsg_new (); -zmsg_addstr (msg, "frame 1"); -zmsg_addstr (msg, "frame 2"); -zsock_send (writer, "szm", "header", msg); -zmsg_destroy (&msg); - -zsock_recv (reader, "szm", &string, &msg); - -assert (streq ("header", string)); -assert (zmsg_size (msg) == 2); -assert (zframe_streq (zmsg_first (msg), "frame 1")); -assert (zframe_streq (zmsg_next (msg), "frame 2")); -zstr_free (&string); -zmsg_destroy (&msg); - -// Test zsock_recv with null arguments -chunk = zchunk_new ("HELLO", 5); -assert (chunk); -frame = zframe_new ("WORLD", 5); -assert (frame); -zsock_send (writer, "izsbcfp", - \-12345, "This is a string", "ABCDE", 5, chunk, frame, original); -zframe_destroy (&frame); -zchunk_destroy (&chunk); -zsock_recv (reader, "izsbcfp", &integer, NULL, NULL, NULL, &chunk, NULL, NULL); -assert (integer == \-12345); -assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); -assert (zchunk_size (chunk) == 5); -zchunk_destroy (&chunk); - -// Test zsock_bsend/brecv pictures with binary encoding -frame = zframe_new ("Hello", 5); -chunk = zchunk_new ("World", 5); - -msg = zmsg_new (); -zmsg_addstr (msg, "Hello"); -zmsg_addstr (msg, "World"); - -zsock_bsend (writer, "1248sSpcfm", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk, frame, msg); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zmsg_destroy (&msg); - -number8 = number4 = number2 = number1 = 0; -char *longstr; -zsock_brecv (reader, "1248sSpcfm", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk, &frame, &msg); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -zstr_free (&longstr); -zchunk_destroy (&chunk); -zframe_destroy (&frame); -zmsg_destroy (&msg); - -#ifdef ZMQ_SERVER - -// Test zsock_bsend/brecv pictures with binary encoding on SERVER and CLIENT sockets -server = zsock_new_server ("tcp://127\&.0\&.0\&.1:5561"); -assert (server); -zsock_t* client = zsock_new_client ("tcp://127\&.0\&.0\&.1:5561"); -assert (client); - -// From client to server -chunk = zchunk_new ("World", 5); -zsock_bsend (client, "1248sSpc", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk); -zchunk_destroy (&chunk); - -number8 = number4 = number2 = number1 = 0; -zsock_brecv (server, "1248sSpc", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -assert (zsock_routing_id (server)); -zstr_free (&longstr); -zchunk_destroy (&chunk); - -// From server to client -chunk = zchunk_new ("World", 5); -zsock_bsend (server, "1248sSpc", - number1, number2, number4, number8, - "Hello, World", - "Goodbye cruel World!", - original, - chunk); -zchunk_destroy (&chunk); - -number8 = number4 = number2 = number1 = 0; -zsock_brecv (client, "1248sSpc", - &number1, &number2, &number4, &number8, - &string, &longstr, - &pointer, - &chunk); -assert (number1 == 123); -assert (number2 == 123 * 123); -assert (number4 == 123 * 123 * 123); -assert (number8 == 123 * 123 * 123 * 123); -assert (streq (string, "Hello, World")); -assert (streq (longstr, "Goodbye cruel World!")); -assert (pointer == original); -assert (zsock_routing_id (client) == 0); -zstr_free (&longstr); -zchunk_destroy (&chunk); - -zsock_destroy (&client); -zsock_destroy (&server); - -#endif - -#ifdef ZMQ_SCATTER - -zsock_t* gather = zsock_new_gather ("inproc://test\-gather\-scatter"); -assert (gather); -zsock_t* scatter = zsock_new_scatter ("inproc://test\-gather\-scatter"); -assert (scatter); - -rc = zstr_send (scatter, "HELLO"); -assert (rc == 0); - -char* message; -message = zstr_recv (gather); -assert (streq(message, "HELLO")); -zstr_free (&message); - -zsock_destroy (&gather); -zsock_destroy (&scatter); - -#endif - -// Check that we can send a zproto format message -zsock_bsend (writer, "1111sS4", 0xAA, 0xA0, 0x02, 0x01, "key", "value", 1234); -zgossip_msg_t *gossip = zgossip_msg_new (); -zgossip_msg_recv (gossip, reader); -assert (zgossip_msg_id (gossip) == ZGOSSIP_MSG_PUBLISH); -zgossip_msg_destroy (&gossip); - -zsock_destroy (&reader); -zsock_destroy (&writer); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 deleted file mode 100644 index c4ea427545..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 +++ /dev/null @@ -1,242 +0,0 @@ -'\" t -.\" Title: zstr -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSTR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zstr \- sending and receiving strings -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// This class has draft methods, which may change over time\&. They are not -// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. -// Receive C string from socket\&. Caller must free returned string using -// zstr_free()\&. Returns NULL if the context is being terminated or the -// process was interrupted\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data\&. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL\&. -// Returns \-1 if the message could not be read, else returns the -// number of strings filled, zero or more\&. Free each returned string -// using zstr_free()\&. If not enough strings are provided, remaining -// multipart frames in the message are dropped\&. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, \&.\&.\&.); - -// Send a C string to a socket, as a frame\&. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string\&. String -// may be NULL, which is sent as ""\&. -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi\-part message\&. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket\&. Note that you should NOT use -// user\-supplied strings in the format (they may contain \*(Aq%\*(Aq which -// will create security holes)\&. -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi\-part -// message\&. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or \-1 on error\&. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, \&.\&.\&.); - -// Free a provided string, and nullify the parent pointer\&. Safe to call on -// a null pointer\&. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class\&. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string\&. If source -// is null, returns an empty string\&. -// Caller owns return value and must destroy it when done\&. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zstr\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zstr class provides utility functions for sending and receiving C strings across 0MQ sockets\&. It sends strings without a terminating null, and appends a null byte on received strings\&. This class is for simple message sending\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf - Memory Wire - +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -Send | S t r i n g | 0 | \-\-\-\-> | 6 | S t r i n g | - +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.sp -.if n \{\ -.RS 4 -.\} -.nf - Wire Heap - +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ -Recv | 6 | S t r i n g | \-\-\-\-> | S t r i n g | 0 | - +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBFrom zstr_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create two PAIR sockets and connect over inproc -zsock_t *output = zsock_new_pair ("@inproc://zstr\&.test"); -assert (output); -zsock_t *input = zsock_new_pair (">inproc://zstr\&.test"); -assert (input); - -// Send ten strings, five strings with MORE flag and then END -int string_nbr; -for (string_nbr = 0; string_nbr < 10; string_nbr++) - zstr_sendf (output, "this is string %d", string_nbr); -zstr_sendx (output, "This", "is", "almost", "the", "very", "END", NULL); - -// Read and count until we receive END -string_nbr = 0; -for (string_nbr = 0;; string_nbr++) { - char *string = zstr_recv (input); - assert (string); - if (streq (string, "END")) { - zstr_free (&string); - break; - } - zstr_free (&string); -} -assert (string_nbr == 15); - -zsock_destroy (&input); -zsock_destroy (&output); - -#if defined (ZMQ_SERVER) -// Test SERVER/CLIENT over zstr -zsock_t *server = zsock_new_server ("inproc://zstr\-test\-routing"); -zsock_t *client = zsock_new_client ("inproc://zstr\-test\-routing");; -assert (server); -assert (client); - -// Try normal ping\-pong to check reply routing ID -int rc = zstr_send (client, "Hello"); -assert (rc == 0); -char *request = zstr_recv (server); -assert (streq (request, "Hello")); -assert (zsock_routing_id (server)); -free (request); - -rc = zstr_send (server, "World"); -assert (rc == 0); -char *reply = zstr_recv (client); -assert (streq (reply, "World")); -free (reply); - -rc = zstr_sendf (server, "%s", "World"); -assert (rc == 0); -reply = zstr_recv (client); -assert (streq (reply, "World")); -free (reply); - -// Try ping\-pong using sendx and recx -rc = zstr_sendx (client, "Hello", NULL); -assert (rc == 0); -rc = zstr_recvx (server, &request, NULL); -assert (rc >= 0); -assert (streq (request, "Hello")); -free (request); - -rc = zstr_sendx (server, "World", NULL); -assert (rc == 0); -rc = zstr_recvx (client, &reply, NULL); -assert (rc >= 0); -assert (streq (reply, "World")); -free (reply); - -// Client and server disallow multipart -rc = zstr_sendm (client, "Hello"); -assert (rc == \-1); -rc = zstr_sendm (server, "World"); -assert (rc == \-1); - -zsock_destroy (&client); -zsock_destroy (&server); -#endif -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 deleted file mode 100644 index 2d4f5c2e45..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 +++ /dev/null @@ -1,539 +0,0 @@ -'\" t -.\" Title: zsys -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZSYS" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zsys \- system\-level methods -.SH "SYNOPSIS" -.sp -.nf -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e\&.g\&. logging is properly set\-up before you start working\&. -// Not threadsafe, so call only from main thread\&. Safe to call multiple -// times\&. Returns global CZMQ context\&. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls\&. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time\&. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock\&. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket\&. You should call this for every socket you -// create using zsys_socket()\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc\&. -// The pipe is configured to use the zsys_pipehwm setting\&. Returns the -// frontend socket successful, NULL if failed\&. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them\&. If you call this multiple times -// then the last handler will take affect\&. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ\&. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl\-C or SIGTERM will set -// zsys_interrupted\&. Idempotent; safe to call multiple times\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or \-1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time\&. Returns 0 if the file does not exist\&. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes\&. -// Returns a mode_t cast to int, or \-1 in case of error\&. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file\&. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is \*(Aqstable\*(Aq -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn\*(Aqt exist\&. The file path is treated as a -// printf format\&. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, \&.\&.\&.); - -// Remove a file path if empty; the pathname is treated as printf format\&. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, \&.\&.\&.); - -// Move to a specified working directory\&. Returns 0 if OK, \-1 if this failed\&. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only\&. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults\&. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run\-time API detection; returns version -// number into provided fields, providing reference isn\*(Aqt null in each case\&. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned -// string using zstr_free()\&. -CZMQ_EXPORT char * - zsys_sprintf (const char *format, \&.\&.\&.); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned -// string using zstr_free()\&. -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast\&. This method -// and related ones might _eventually_ be moved to a zudp class\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return \-1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors\&. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints\&. Caller gets -// a freshly allocated string, should free it using zstr_free()\&. If the host -// name is not resolvable, returns NULL\&. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background\&. The precise effect depends -// on the operating system\&. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP\&. On -// Windows, does nothing\&. Returns 0 if OK, \-1 if there was an error\&. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user\&. Any of the arguments -// may be null, indicating a no\-op\&. Returns 0 on success, \-1 on failure\&. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID\&. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security\&. -// Uses a heuristic probe according to the version of libzmq being used\&. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use\&. A good -// rule of thumb is one thread per gigabit of traffic in or out\&. The -// default is 1, sufficient for most applications\&. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow\&. The default -// is 1024\&. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. -// Note that this method is valid only before any socket is created\&. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support\&. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent\&. -// The default is INT_MAX\&. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size\&. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// linger time is zero, i\&.e\&. any pending messages will be dropped\&. If the -// environment variable ZSYS_LINGER is defined, that provides the default\&. -// Note that process exit will typically be delayed by the linger time\&. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default\&. Note that a value of -// zero means no limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances\&. -// You can also set this separately on each zsock_t instance\&. The default -// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default\&. Note that a value of -// zero means no limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm)\&. The default HWM is -// 1,000, on all versions of ZeroMQ\&. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default\&. Note that a value of zero means no -// limit, i\&.e\&. infinite memory consumption\&. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes\&. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances\&. By default sockets accept -// and make only IPv4 connections\&. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers\&. You can override the setting on -// each zsock_t instance\&. The default is IPv4 only (ipv6 set to 0)\&. If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default\&. Note: has no effect on ZMQ v2\&. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances\&. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon\&. -// This lets the interface be configured for test environments where required\&. -// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is -// the default when there is no specified interface\&. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name\&. -// Setting the interface to "*" means "use all available interfaces"\&. -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set\&. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon\&. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface\&. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address\&. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set\&. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages\&. This needs -// to be set if IPv6 is enabled\&. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address\&. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set\&. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre\-allocated FDs when creating new sockets\&. -// If 0 (default), nothing will happen\&. Else, when a new socket is bound, the -// system API will be used to check if an existing pre\-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket\&. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre\-allocated FDs for zsock instances\&. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process\&. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set\&. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic\&. By default, log traffic is sent to -// stdout\&. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility)\&. -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint\&. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint\&. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout\&. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints\&. To disable the sender, call -// this method with a null argument\&. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows)\&. By default this is disabled\&. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition \- highest priority -CZMQ_EXPORT void - zsys_error (const char *format, \&.\&.\&.); - -// Log warning condition \- high priority -CZMQ_EXPORT void - zsys_warning (const char *format, \&.\&.\&.); - -// Log normal, but significant, condition \- normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, \&.\&.\&.); - -// Log informational message \- low priority -CZMQ_EXPORT void - zsys_info (const char *format, \&.\&.\&.); - -// Log debug\-level message \- lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, \&.\&.\&.); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl\-C or the process -// gets a SIGTERM signal\&. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsys\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zsys class provides a portable wrapper for system calls\&. We collect them here to reduce the number of weird #ifdefs in other classes\&. As far as possible, the bulk of CZMQ classes are fully portable\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsys\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zsys_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -zsys_catch_interrupts (); - -// Check capabilities without using the return value -int rc = zsys_has_curve (); - -if (verbose) { - char *hostname = zsys_hostname (); - zsys_info ("host name is %s", hostname); - free (hostname); - zsys_info ("system limit is %zu ZeroMQ sockets", zsys_socket_limit ()); -} -zsys_set_linger (0); -zsys_set_sndhwm (1000); -zsys_set_rcvhwm (1000); -zsys_set_pipehwm (2500); -assert (zsys_pipehwm () == 2500); -zsys_set_ipv6 (0); - -// Test pipe creation -zsock_t *pipe_back; -zsock_t *pipe_front = zsys_create_pipe (&pipe_back); -zstr_send (pipe_front, "Hello"); -char *string = zstr_recv (pipe_back); -assert (streq (string, "Hello")); -free (string); -zsock_destroy (&pipe_back); -zsock_destroy (&pipe_front); - -// Test file manipulation -rc = zsys_file_delete ("nosuchfile"); -assert (rc == \-1); - -bool rc_bool = zsys_file_exists ("nosuchfile"); -assert (rc_bool != true); - -rc = (int) zsys_file_size ("nosuchfile"); -assert (rc == \-1); - -time_t when = zsys_file_modified ("\&."); -assert (when > 0); - -int mode = zsys_file_mode ("\&."); -assert (S_ISDIR (mode)); -assert (mode & S_IRUSR); -assert (mode & S_IWUSR); - -zsys_file_mode_private (); -rc = zsys_dir_create ("%s/%s", "\&.", "\&.testsys/subdir"); -assert (rc == 0); -when = zsys_file_modified ("\&./\&.testsys/subdir"); -assert (when > 0); -assert (!zsys_file_stable ("\&./\&.testsys/subdir")); -rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys/subdir"); -assert (rc == 0); -rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys"); -assert (rc == 0); -zsys_file_mode_default (); -assert (zsys_dir_change ("\&.") == 0); - -int major, minor, patch; -zsys_version (&major, &minor, &patch); -assert (major == CZMQ_VERSION_MAJOR); -assert (minor == CZMQ_VERSION_MINOR); -assert (patch == CZMQ_VERSION_PATCH); - -string = zsys_sprintf ("%s %02x", "Hello", 16); -assert (streq (string, "Hello 10")); -free (string); - -char *str64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,\&."; -int num10 = 1234567890; -string = zsys_sprintf ("%s%s%s%s%d", str64, str64, str64, str64, num10); -assert (strlen (string) == (4 * 64 + 10)); -free (string); - -// Test logging system -zsys_set_logident ("czmq_selftest"); -zsys_set_logsender ("inproc://logging"); -void *logger = zsys_socket (ZMQ_SUB, NULL, 0); -assert (logger); -rc = zmq_connect (logger, "inproc://logging"); -assert (rc == 0); -rc = zmq_setsockopt (logger, ZMQ_SUBSCRIBE, "", 0); -assert (rc == 0); - -if (verbose) { - zsys_error ("This is an %s message", "error"); - zsys_warning ("This is a %s message", "warning"); - zsys_notice ("This is a %s message", "notice"); - zsys_info ("This is a %s message", "info"); - zsys_debug ("This is a %s message", "debug"); - zsys_set_logident ("hello, world"); - zsys_info ("This is a %s message", "info"); - zsys_debug ("This is a %s message", "debug"); - - // Check that logsender functionality is working - char *received = zstr_recv (logger); - assert (received); - zstr_free (&received); -} -zsys_close (logger, NULL, 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 deleted file mode 100644 index 1eaa5ab949..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 +++ /dev/null @@ -1,180 +0,0 @@ -'\" t -.\" Title: ztimerset -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZTIMERSET" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ztimerset \- timer set -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event\&. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set\&. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set\&. Returns timer id if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer\&. Returns 0 if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval\&. Returns 0 if OK, \-1 on failure\&. -// This method is slow, canceling the timer and adding a new one yield better performance\&. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time\&. Returns 0 if OK, \-1 on failure\&. -// This method is slow, canceling the timer and adding a new one yield better performance\&. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval\&. -// Should be used as timeout parameter for the zpoller wait method\&. -// The timeout is in msec\&. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed\&. -// Should be call after zpoller wait method\&. -// Returns 0 if OK, \-1 on failure\&. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztimerset\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -ztimerset \- timer set -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ztimerset\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom ztimerset_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Simple create/destroy test -ztimerset_t *self = ztimerset_new (); -assert (self); - -// Adding timer -bool timer_invoked = false; -int timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -int rc = ztimerset_execute (self); -assert (rc == 0); -assert (!timer_invoked); -int timeout = ztimerset_timeout (self); -assert (timeout > 0); -zclock_sleep (timeout); -rc = ztimerset_execute (self); -assert (rc == 0); -assert (timer_invoked); - -// Cancel timer -timeout = ztimerset_timeout (self); -assert (timeout > 0); -rc = ztimerset_cancel (self, timer_id); -assert (rc == 0); -timeout = ztimerset_timeout (self); -assert(timeout == \-1); - -// Reset a timer -timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -timeout = ztimerset_timeout (self); -assert (timeout > 0); -zclock_sleep (timeout / 2); -timeout = ztimerset_timeout (self); -rc = ztimerset_reset(self, timer_id); -assert (rc == 0); -int timeout2 = ztimerset_timeout (self); -assert (timeout2 > timeout); -rc = ztimerset_cancel (self, timer_id); -assert (rc == 0); - -// Set interval -timer_id = ztimerset_add (self, 100, handler, &timer_invoked); -assert (timer_id != \-1); -timeout = ztimerset_timeout (self); -rc = ztimerset_set_interval(self, timer_id, 200); -timeout2 = ztimerset_timeout (self); -assert (timeout2 > timeout); - -ztimerset_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 deleted file mode 100644 index 6cfb401a34..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 +++ /dev/null @@ -1,292 +0,0 @@ -'\" t -.\" Title: ztrie -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZTRIE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -ztrie \- simple trie for tokenizable strings -.SH "SYNOPSIS" -.sp -.nf -// This is a draft class, and may change without notice\&. It is disabled in -// stable builds by default\&. If you use this in applications, please ask -// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data\&. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie\&. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie\&. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data\&. Returns \-1 -// if the route already exists, otherwise 0\&. This method takes ownership of -// the provided data if a destroy_data_fn is provided\&. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data\&. Returns \-1 if the -// route does not exists, otherwise 0\&. -// the start of the list call zlist_first ()\&. Advances the cursor\&. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false\&. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches\&. If the path -// did not match, returns NULL\&. Do not delete the data as it\*(Aqs owned by -// ztrie\&. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has\&. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches\&. If the path did not match or the route did not contain any -// named regexes, returns NULL\&. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL\&. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class\&. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztrie\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -This is a variant of a trie or prefix tree where all the descendants of a node have a common prefix of the string associated with that node\&. This implementation is specialized for strings that can be tokenized by a delimiter like a URL, URI or URN\&. Routes in the tree can be matched by regular expressions and by using capturing groups parts of a matched route can be easily obtained\&. -.sp -Note that the performance for pure string based matching is okay but on short strings zhash and zhashx are 3\-4 times faster\&. -.SH "EXAMPLE" -.PP -\fBFrom ztrie_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Create a new trie for matching strings that can be tokenized by a slash -// (e\&.g\&. URLs minus the protocol, address and port)\&. -ztrie_t *self = ztrie_new (\*(Aq/\*(Aq); -assert (self); - -int ret = 0; - -// Let\*(Aqs start by inserting a couple of routes into the trie\&. -// This one is for the route \*(Aq/foo/bar\*(Aq the slash at the beginning of the -// route is important because everything before the first delimiter will be -// discarded\&. A slash at the end of a route is optional though\&. The data -// associated with this node is passed without destroy function which means -// it must be destroyed by the caller\&. -int foo_bar_data = 10; -ret = ztrie_insert_route (self, "/foo/bar", &foo_bar_data, NULL); -assert (ret == 0); - -// Now suppose we like to match all routes with two tokens that start with -// \*(Aq/foo/\*(Aq but aren\*(Aqt \*(Aq/foo/bar\*(Aq\&. This is possible by using regular -// expressions which are enclosed in an opening and closing curly bracket\&. -// Tokens that contain regular expressions are always match after string -// based tokens\&. -// Note: There is no order in which regular expressions are sorted thus -// if you enter multiple expressions for a route you will have to make -// sure they don\*(Aqt have overlapping results\&. For example \*(Aq/foo/{[^/]+}\*(Aq -// and \*(Aq/foo/{\ed+} having could turn out badly\&. -int foo_other_data = 100; -ret = ztrie_insert_route (self, "/foo/{[^/]+}", &foo_other_data, NULL); -assert (ret == 0); - -// Regular expression are only matched against tokens of the same level\&. -// This allows us to append to are route with a regular expression as if -// it were a string\&. -ret = ztrie_insert_route (self, "/foo/{[^/]+}/gulp", NULL, NULL); -assert (ret == 0); - -// Routes are identified by their endpoint, which is the last token of the route\&. -// It is possible to insert routes for a node that already exists but isn\*(Aqt an -// endpoint yet\&. The delimiter at the end of a route is optional and has no effect\&. -ret = ztrie_insert_route (self, "/foo/", NULL, NULL); -assert (ret == 0); - -// If you try to insert a route which already exists the method will return \-1\&. -ret = ztrie_insert_route (self, "/foo", NULL, NULL); -assert (ret == \-1); - -// It is not allowed to insert routes with empty tokens\&. -ret = ztrie_insert_route (self, "//foo", NULL, NULL); -assert (ret == \-1); - -// Everything before the first delimiter is ignored so \*(Aqfoo/bar/baz\*(Aq is equivalent -// to \*(Aq/bar/baz\*(Aq\&. -ret = ztrie_insert_route (self, "foo/bar/baz", NULL, NULL); -assert (ret == 0); -ret = ztrie_insert_route (self, "/bar/baz", NULL, NULL); -assert (ret == \-1); - -// Of course you are allowed to remove routes, in case there is data associated with a -// route and a destroy data function has been supplied that data will be destroyed\&. -ret = ztrie_remove_route (self, "/foo"); -assert (ret == 0); - -// Removing a non existent route will as well return \-1\&. -ret = ztrie_remove_route (self, "/foo"); -assert (ret == \-1); - -// Removing a route with a regular expression must exactly match the entered one\&. -ret = ztrie_remove_route (self, "/foo/{[^/]+}"); -assert (ret == 0); - -// Next we like to match a path by regular expressions and also extract matched -// parts of a route\&. This can be done by naming the regular expression\&. The name of a -// regular expression is entered at the beginning of the curly brackets and separated -// by a colon from the regular expression\&. The first one in this examples is named -// \*(Aqname\*(Aq and names the expression \*(Aq[^/]\*(Aq\&. If there is no capturing group defined in -// the expression the whole matched string will be associated with this parameter\&. In -// case you don\*(Aqt like the get the whole matched string use a capturing group, like -// it has been done for the \*(Aqid\*(Aq parameter\&. This is nice but you can even match as -// many parameter for a token as you like\&. Therefore simply put the parameter names -// separated by colons in front of the regular expression and make sure to add a -// capturing group for each parameter\&. The first parameter will be associated with -// the first capturing and so on\&. -char *data = (char *) malloc (80); -sprintf (data, "%s", "Hello World!"); -ret = ztrie_insert_route (self, "/baz/{name:[^/]+}/{id:\-\-(\e\ed+)}/{street:nr:(\e\ea+)(\e\ed+)}", data, NULL); -assert (ret == 0); - -// There is a lot you can do with regular expression but matching routes -// of arbitrary length wont work\&. Therefore we make use of the asterisk -// operator\&. Just place it at the end of your route, e\&.g\&. \*(Aq/config/bar/*\*(Aq\&. -ret = ztrie_insert_route (self, "/config/bar/*", NULL, NULL); -assert (ret == 0); - -// Appending to an asterisk as you would to with a regular expression -// isn\*(Aqt valid\&. -ret = ztrie_insert_route (self, "/config/bar/*/bar", NULL, NULL); -assert (ret == \-1); - -// The asterisk operator will only work as a leaf in the tree\&. If you -// enter an asterisk in the middle of your route it will simply be -// interpreted as a string\&. -ret = ztrie_insert_route (self, "/test/*/bar", NULL, NULL); -assert (ret == 0); - -// If a parent has an asterisk as child it is not allowed to have -// other siblings\&. -ret = ztrie_insert_route (self, "/config/bar/foo/glup", NULL, NULL); -assert (ret != 0); - -// Test matches -bool hasMatch = false; - -// The route \*(Aq/bar/foo\*(Aq will fail to match as this route has never been inserted\&. -hasMatch = ztrie_matches (self, "/bar/foo"); -assert (!hasMatch); - -// The route \*(Aq/foo/bar\*(Aq will match and we can obtain the data associated with it\&. -hasMatch = ztrie_matches (self, "/foo/bar"); -assert (hasMatch); -int foo_bar_hit_data = *((int *) ztrie_hit_data (self)); -assert (foo_bar_data == foo_bar_hit_data); - -// This route is part of another but is no endpoint itself thus the matches will fail\&. -hasMatch = ztrie_matches (self, "/baz/blub"); -assert (!hasMatch); - -// This route will match our named regular expressions route\&. Thus we can extract data -// from the route by their names\&. -hasMatch = ztrie_matches (self, "/baz/blub/\-\-11/abc23"); -assert (hasMatch); -char *match_data = (char *) ztrie_hit_data (self); -assert (streq ("Hello World!", match_data)); -zhashx_t *parameters = ztrie_hit_parameters (self); -assert (zhashx_size (parameters) == 4); -assert (streq ("blub", (char *) zhashx_lookup (parameters, "name"))); -assert (streq ("11", (char *) zhashx_lookup (parameters, "id"))); -assert (streq ("abc", (char *) zhashx_lookup (parameters, "street"))); -assert (streq ("23", (char *) zhashx_lookup (parameters, "nr"))); -zhashx_destroy (¶meters); - -// This will match our asterisk route \*(Aq/config/bar/*\*(Aq\&. As the result we -// can obtain the asterisk matched part of the route\&. -hasMatch = ztrie_matches (self, "/config/bar/foo/bar"); -assert (hasMatch); -assert (streq (ztrie_hit_asterisk_match (self), "foo/bar")); - -zstr_free (&data); -ztrie_destroy (&self); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 deleted file mode 100644 index c5431245eb..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 +++ /dev/null @@ -1,171 +0,0 @@ -'\" t -.\" Title: zuuid -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "ZUUID" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zuuid \- UUID support class -.SH "SYNOPSIS" -.sp -.nf -// This is a stable class, and may not change except for emergencies\&. It -// is provided in stable builds\&. -// Create a new UUID object\&. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN\-octet value\&. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object\&. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN\-octet value\&. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping \*(Aq\-\*(Aq and \*(Aq{\*(Aq \*(Aq}\*(Aq -// optional delimiters\&. Return 0 if OK, else returns \-1\&. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data\&. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8\-4\-4\-4\-12, in lower -// case\&. Caller does not modify or free returned value\&. See -// http://en\&.wikipedia\&.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null\&. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class\&. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zuuid\&.c\*(Aq\&. -.fi -.SH "DESCRIPTION" -.sp -The zuuid class generates UUIDs and provides methods for working with them\&. If you build CZMQ with libuuid, on Unix/Linux, it will use that library\&. On Windows it will use UuidCreate()\&. Otherwise it will use a random number generator to produce convincing imitations of UUIDs\&. -.sp -Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zuuid\&.c\fR\&. -.SH "EXAMPLE" -.PP -\fBFrom zuuid_test method\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Simple create/destroy test -assert (ZUUID_LEN == 16); -assert (ZUUID_STR_LEN == 32); - -zuuid_t *uuid = zuuid_new (); -assert (uuid); -assert (zuuid_size (uuid) == ZUUID_LEN); -assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN); -zuuid_t *copy = zuuid_dup (uuid); -assert (streq (zuuid_str (uuid), zuuid_str (copy))); - -// Check set/set_str/export methods -const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38"; -const char *myuuid2 = "8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38"; -const char *myuuid3 = "{8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38}"; -const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838"; -int rc = zuuid_set_str (uuid, myuuid); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid2); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid3); -assert (rc == 0); -assert (streq (zuuid_str (uuid), myuuid)); -rc = zuuid_set_str (uuid, myuuid4); -assert (rc == \-1); -byte copy_uuid [ZUUID_LEN]; -zuuid_export (uuid, copy_uuid); -zuuid_set (uuid, copy_uuid); -assert (streq (zuuid_str (uuid), myuuid)); - -// Check the canonical string format -assert (streq (zuuid_str_canonical (uuid), - "8cb3e9a9\-649b\-4bef\-8de2\-25e9c2cebb38")); - -zuuid_destroy (&uuid); -zuuid_destroy (©); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 deleted file mode 100644 index 6de419cb00..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 +++ /dev/null @@ -1,1358 +0,0 @@ -'\" t -.\" Title: czmq -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 12/31/2016 -.\" Manual: CZMQ Manual -.\" Source: CZMQ 4.0.2 -.\" Language: English -.\" -.TH "CZMQ" "7" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -czmq \- high\-level C binding for ZeroMQ -.SH "SYNOPSIS" -.sp -.nf -#include - -cc [\*(Aqflags\*(Aq] \*(Aqfiles\*(Aq \-lzmq \-lczmq [\*(Aqlibraries\*(Aq] -.fi -.SH "DESCRIPTION" -.SS "Classes" -.sp -These classes provide the main socket and message API: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsock\fR(3) -\- working with ZeroMQ sockets (high\-level) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzstr\fR(3) -\- sending and receiving strings -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmsg\fR(3) -\- working with multipart messages -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzframe\fR(3) -\- working with single message frames -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzactor\fR(3) -\- Actor class (socket + thread) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzloop\fR(3) -\- event\-driven reactor -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzpoller\fR(3) -\- trivial socket poller class -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzproxy\fR(3) -\- proxy actor (like zmq_proxy_steerable) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmonitor\fR(3) -\- monitor events on ZeroMQ sockets -.RE -.sp -These classes support authentication and encryption: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzauth\fR(3) -\- authentication actor for ZeroMQ servers -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzcert\fR(3) -\- work with CURVE security certificates -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzcertstore\fR(3) -\- work with CURVE security certificate stores -.RE -.sp -These classes provide generic containers: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzhash\fR(3) -\- simple generic hash container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzhashx\fR(3) -\- extended generic hash container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzlist\fR(3) -\- simple generic list container -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzlistx\fR(3) -\- extended generic list container -.RE -.sp -These classes wrap\-up non\-portable functionality: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzbeacon\fR(3) -\- LAN discovery and presence -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzclock\fR(3) -\- millisecond clocks and delays -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzdir\fR(3) -\- work with file\-system directories -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzdir_patch\fR(3) -\- work with directory differences -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzfile\fR(3) -\- work with file\-system files -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsys\fR(3) -\- system\-level methods -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzuuid\fR(3) -\- UUID support class -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBziflist\fR(3) -\- list available network interfaces -.RE -.sp -And these utility classes add value: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzchunk\fR(3) -\- work with memory chunks -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzconfig\fR(3) -\- work with textual config files -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzrex\fR(3) -\- work with regular expressions -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzgossip\fR(3) -\- decentralized configuration management -.RE -.sp -These classes are deprecated: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzctx\fR(3) -\- working with ZeroMQ contexts -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsocket\fR(3) -\- working with ZeroMQ sockets (low\-level) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzsockopt\fR(3) -\- get/set ZeroMQ socket options -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzthread\fR(3) -\- working with system threads -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzauth_v2\fR(3) -\- authentication for ZeroMQ servers -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzbeacon_v2\fR(3) -\- LAN discovery and presence -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzmonitor_v2\fR(3) -\- socket event monitor -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBzproxy_v2\fR(3) -\- zmq_proxy wrapper -.RE -.SS "Scope and Goals" -.sp -CZMQ has these goals: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To wrap the \(/OMQ core API in semantics that are natural and lead to shorter, more readable applications\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To hide the differences between versions of \(/OMQ\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -To provide a space for development of more sophisticated API semantics\&. -.RE -.SS "Ownership and License" -.sp -CZMQ is maintained by the ZeroMQ community at github\&.com/zeromq\&. Its other authors and contributors are listed in the AUTHORS file\&. -.sp -The contributors are listed in AUTHORS\&. This project uses the MPL v2 license, see LICENSE\&. -.SS "Contributing" -.sp -To submit an issue use the issue tracker at \m[blue]\fBhttp://github\&.com/zeromq/czmq/issues\fR\m[]\&. All discussion happens on the zeromq\-dev list or #zeromq IRC channel at irc\&.freenode\&.net\&. -.sp -The proper way to submit patches is to clone this repository, make your changes, and use git to create a patch or a pull request\&. See \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. All contributors are listed in AUTHORS\&. -.sp -All classes are maintained by a single person, who is the responsible editor for that class and who is named in the header as such\&. This is usually the originator of the class\&. When several people collaborate on a class, one single person is always the lead maintainer and the one to blame when it breaks\&. -.sp -The general rule is, if you contribute code to CZMQ you must be willing to maintain it as long as there are users of it\&. Code with no active maintainer will in general be deprecated and/or removed\&. -.SH "USING CZMQ" -.SS "Building and Installing" -.sp -CZMQ uses autotools for packaging\&. To build from git (all example commands are for Linux): -.sp -.if n \{\ -.RS 4 -.\} -.nf - git clone git://github\&.com/zeromq/czmq\&.git - cd czmq - sh autogen\&.sh - \&./configure - make all - sudo make install - sudo ldconfig -.fi -.if n \{\ -.RE -.\} -.sp -You will need the pkg\-config, libtool, and autoreconf packages\&. Set the LD_LIBRARY_PATH to /usr/local/libs unless you install elsewhere\&. -.sp -After building, you can run the CZMQ selftests: -.sp -.if n \{\ -.RS 4 -.\} -.nf - cd src - \&./czmq_selftest -.fi -.if n \{\ -.RE -.\} -.SS "Linking with an Application" -.sp -Include czmq\&.h in your application and link with CZMQ\&. Here is a typical gcc link command: -.sp -.if n \{\ -.RS 4 -.\} -.nf - gcc \-lczmq \-lzmq myapp\&.c \-o myapp -.fi -.if n \{\ -.RE -.\} -.sp -You should read czmq\&.h\&. This file includes zmq\&.h and the system header files that typical \(/OMQ applications will need\&. The provided \fIc\fR shell script lets you write simple portable build scripts: -.sp -.if n \{\ -.RS 4 -.\} -.nf - c \-lczmq \-lzmq \-l myapp -.fi -.if n \{\ -.RE -.\} -.SS "The Class Model" -.sp -CZMQ consists of classes, each class consisting of a \&.h and a \&.c\&. Classes may depend on other classes\&. -.sp -czmq\&.h includes all classes header files, all the time\&. For the user, CZMQ forms one single package\&. All classes start by including czmq\&.h\&. All applications that use CZMQ start by including czmq\&.h\&. czmq\&.h also defines a limited number of small, useful macros and typedefs that have proven useful for writing clearer C code\&. -.sp -All classes (with some exceptions) are based on a flat C class system and follow these rules (where \fIzclass\fR is the class name): -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Class typedef: -zclass_t -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Constructor: -zclass_new -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Destructor: -zclass_destroy -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Property methods: -zclass_property_set, -zclass_property -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Class structures are private (defined in the \&.c source but not the \&.h) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Properties are accessed only via methods named as described above\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -In the class source code the object is always called -self\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The constructor may take arbitrary arguments, and returns NULL on failure, or a new object\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The destructor takes a pointer to an object reference and nullifies it\&. -.RE -.sp -Return values for methods are: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For methods that return an object reference, either the reference, or NULL on failure\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -For methods that signal success/failure, a return value of 0 means success, \-1 failure\&. -.RE -.sp -Private/static functions in a class are named s_functionname and are not exported via the header file\&. -.sp -All classes (with some exceptions) have a test method called zclass_test\&. -.SH "DESIGN IDEOLOGY" -.SS "The Problem with C" -.sp -C has the significant advantage of being a small language that, if we take a little care with formatting and naming, can be easily interchanged between developers\&. Every C developer will use much the same 90% of the language\&. Larger languages like C++ provide powerful abstractions like STL containers but at the cost of interchange\&. -.sp -The huge problem with C is that any realistic application needs packages of functionality to bring the language up to the levels we expect for the 21st century\&. Much can be done by using external libraries but every additional library is a dependency that makes the resulting applications harder to build and port\&. While C itself is a highly portable language (and can be made more so by careful use of the preprocessor), most C libraries consider themselves part of the operating system, and as such do not attempt to be portable\&. -.sp -The answer to this, as we learned from building enterprise\-level C applications at iMatix from 1995\-2005, is to create our own fully portable, high\-quality libraries of pre\-packaged functionality, in C\&. Doing this right solves both the requirements of richness of the language, and of portability of the final applications\&. -.SS "A Simple Class Model" -.sp -C has no standard API style\&. It is one thing to write a useful component, but something else to provide an API that is consistent and obvious across many components\&. We learned from building OpenAMQ (\m[blue]\fBhttp://www\&.openamq\&.org\fR\m[]), a messaging client and server of 0\&.5M LoC, that a consistent model for extending C makes life for the application developer much easier\&. -.sp -The general model is that of a class (the source package) that provides objects (in fact C structures)\&. The application creates objects and then works with them\&. When done, the application destroys the object\&. In C, we tend to use the same name for the object as the class, when we can, and it looks like this (to take a fictitious CZMQ class): -.sp -.if n \{\ -.RS 4 -.\} -.nf - zregexp_t *regexp = zregexp_new (regexp_string); - if (!regexp) - printf ("E: invalid regular expression: %s\en", regexp_string); - else - if (zregexp_match (regexp, input_buffer)) - printf ("I: successful match for %s\en", input buffer); - zregexp_destroy (&regexp); -.fi -.if n \{\ -.RE -.\} -.sp -As far as the C program is concerned, the object is a reference to a structure (not a void pointer)\&. We pass the object reference to all methods, since this is still C\&. We could do weird stuff like put method addresses into the structure so that we can emulate a C++ syntax but it\(cqs not worthwhile\&. The goal is not to emulate an OO system, it\(cqs simply to gain consistency\&. The constructor returns an object reference, or NULL if it fails\&. The destructor nullifies the class pointer, and is idempotent\&. -.sp -What we aim at here is the simplest possible consistent syntax\&. -.sp -No model is fully consistent, and classes can define their own rules if it helps make a better result\&. For example: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Some classes may not be opaque\&. For example, we have cases of generated serialization classes that encode and decode structures to/from binary buffers\&. It feels clumsy to have to use methods to access the properties of these classes\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -While every class has a new method that is the formal constructor, some methods may also act as constructors\&. For example, a "dup" method might take one object and return a second object\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -While every class has a destroy method that is the formal destructor, some methods may also act as destructors\&. For example, a method that sends an object may also destroy the object (so that ownership of any buffers can passed to background threads)\&. Such methods take the same "pointer to a reference" argument as the destroy method\&. -.RE -.SS "Naming Style" -.sp -CZMQ aims for short, consistent names, following the theory that names we use most often should be shortest\&. Classes get one\-word names, unless they are part of a family of classes in which case they may be two words, the first being the family name\&. Methods, similarly, get one\-word names and we aim for consistency across classes (so a method that does something semantically similar in two classes will get the same name in both)\&. So the canonical name for any method is: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zclassname_methodname -.fi -.if n \{\ -.RE -.\} -.sp -And the reader can easily parse this without needing special syntax to separate the class name from the method name\&. -.SS "Containers" -.sp -After a long experiment with containers, we\(cqve decided that we need exactly two containers: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A singly\-linked list\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A hash table using text keys\&. -.RE -.sp -These are zlist and zhash, respectively\&. Both store void pointers, with no attempt to manage the details of contained objects\&. You can use these containers to create lists of lists, hashes of lists, hashes of hashes, etc\&. -.sp -We assume that at some point we\(cqll need to switch to a doubly\-linked list\&. -.SS "Portability" -.sp -Creating a portable C application can be rewarding in terms of maintaining a single code base across many platforms, and keeping (expensive) system\-specific knowledge separate from application developers\&. In most projects (like \(/OMQ core), there is no portability layer and application code does conditional compilation for all mixes of platforms\&. This leads to quite messy code\&. -.sp -czmq acts as a portability layer, similar to but thinner than libraries like the [Apache Portable Runtime](\m[blue]\fBhttp://apr\&.apache\&.org\fR\m[]) (APR)\&. -.sp -These are the places a C application is subject to arbitrary system differences: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Different compilers may offer slightly different variants of the C language, often lacking specific types or using neat non\-portable names\&. Windows is a big culprit here\&. We solve this by -\fIpatching\fR -the language in czmq_prelude\&.h, e\&.g\&. defining int64_t on Windows\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System header files are inconsistent, i\&.e\&. you need to include different files depending on the OS type and version\&. We solve this by pulling in all necessary header files in czmq_prelude\&.h\&. This is a proven brute\-force approach that increases recompilation times but eliminates a major source of pain\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System libraries are inconsistent, i\&.e\&. you need to link with different libraries depending on the OS type and version\&. We solve this with an external compilation tool, -\fIC\fR, which detects the OS type and version (at runtime) and builds the necessary link commands\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -System functions are inconsistent, i\&.e\&. you need to call different functions depending, again, on OS type and version\&. We solve this by building small abstract classes that handle specific areas of functionality, and doing conditional compilation in these\&. -.RE -.sp -An example of the last: -.sp -.if n \{\ -.RS 4 -.\} -.nf - #if (defined (__UNIX__)) - pid = GetCurrentProcessId(); - #elif (defined (__WINDOWS__)) - pid = getpid (); - #else - pid = 0; - #endif -.fi -.if n \{\ -.RE -.\} -.sp -CZMQ uses the GNU autotools system, so non\-portable code can use the macros this defines\&. It can also use macros defined by the czmq_prelude\&.h header file\&. -.SS "Technical Aspects" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBThread safety\fR: the use of opaque structures is thread safe, though \(/OMQ applications should not share state between threads in any case\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBName spaces\fR: we prefix class names with -z, which ensures that all exported functions are globally safe\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBLibrary versioning\fR: we don\(cqt make any attempt to version the library at this stage\&. Classes are in our experience highly stable once they are built and tested, the only changes typically being added methods\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBPerformance\fR: for critical path processing, you may want to avoid creating and destroying classes\&. However on modern Linux systems the heap allocator is very fast\&. Individual classes can choose whether or not to nullify their data on allocation\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBSelf\-testing\fR: every class has a -selftest -method that runs through the methods of the class\&. In theory, calling all selftest functions of all classes does a full unit test of the library\&. The -czmq_selftest -application does this\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - -\fBMemory management\fR: CZMQ classes do not use any special memory management techiques to detect leaks\&. We\(cqve done this in the past but it makes the code relatively complex\&. Instead, we do memory leak testing using tools like valgrind\&. -.RE -.SH "UNDER THE HOOD" -.SS "Adding a New Class" -.sp -If you define a new CZMQ class myclass you need to: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Write the -zmyclass\&.c -and -zmyclass\&.h -source files, in -src -and -include -respectively\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add`#include ` to -include/czmq\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add the myclass header and test call to -src/czmq_selftest\&.c\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add a reference documentation to -\fIdoc/zmyclass\&.txt\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Add myclass to \*(Aqsrc/Makefile\&.am` and -doc/Makefile\&.am\&. -.RE -.sp -The bin/newclass\&.sh shell script will automate these steps for you\&. -.SS "Coding Style" -.sp -In general the zctx class defines the style for the whole library\&. The overriding rules for coding style are consistency, clarity, and ease of maintenance\&. We use the C99 standard for syntax including principally: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The // comment style\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Variables definitions placed in or before the code that uses them\&. -.RE -.sp -So while ANSI C code might say: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zblob_t *file_buffer; /* Buffer for our file */ - \&.\&.\&. (100 lines of code) - file_buffer = zblob_new (); - \&.\&.\&. -.fi -.if n \{\ -.RE -.\} -.sp -The style in CZMQ would be: -.sp -.if n \{\ -.RS 4 -.\} -.nf - zblob_t *file_buffer = zblob_new (); -.fi -.if n \{\ -.RE -.\} -.SS "Assertions" -.sp -We use assertions heavily to catch bad argument values\&. The CZMQ classes do not attempt to validate arguments and report errors; bad arguments are treated as fatal application programming errors\&. -.sp -We also use assertions heavily on calls to system functions that are never supposed to fail, where failure is to be treated as a fatal non\-recoverable error (e\&.g\&. running out of memory)\&. -.sp -Assertion code should always take this form: -.sp -.if n \{\ -.RS 4 -.\} -.nf - int rc = some_function (arguments); - assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -Rather than the side\-effect form: -.sp -.if n \{\ -.RS 4 -.\} -.nf - assert (some_function (arguments) == 0); -.fi -.if n \{\ -.RE -.\} -.sp -Since assertions may be removed by an optimizing compiler\&. -.SS "Documentation" -.sp -Man pages are generated from the class header and source files via the doc/mkman tool, and similar functionality in the gitdown tool (\m[blue]\fBhttp://github\&.com/imatix/gitdown\fR\m[])\&. The header file for a class must wrap its interface as follows (example is from include/zclock\&.h): -.sp -.if n \{\ -.RS 4 -.\} -.nf - // @interface - // Sleep for a number of milliseconds - void - zclock_sleep (int msecs); - - // Return current system clock as milliseconds - int64_t - zclock_time (void); - - // Self test of this class - int - zclock_test (Bool verbose); - // @end -.fi -.if n \{\ -.RE -.\} -.sp -The source file for a class must provide documentation as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf - /* - @header - \&.\&.\&.short explanation of class\&.\&.\&. - @discuss - \&.\&.\&.longer discussion of how it works\&.\&.\&. - @end - */ -.fi -.if n \{\ -.RE -.\} -.sp -The source file for a class then provides the self test example as follows: -.sp -.if n \{\ -.RS 4 -.\} -.nf - // @selftest - int64_t start = zclock_time (); - zclock_sleep (10); - assert ((zclock_time () \- start) >= 10); - // @end -.fi -.if n \{\ -.RE -.\} -.sp -The template for man pages is in doc/mkman\&. -.SS "Development" -.sp -CZMQ is developed through a test\-driven process that guarantees no memory violations or leaks in the code: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Modify a class or method\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Update the test method for that class\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Run the -\fIselftest\fR -script, which uses the Valgrind memcheck tool\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Repeat until perfect\&. -.RE -.SS "Porting CZMQ" -.sp -When you try CZMQ on an OS that it\(cqs not been used on (ever, or for a while), you will hit code that does not compile\&. In some cases the patches are trivial, in other cases (usually when porting to Windows), the work needed to build equivalent functionality may be quite heavy\&. In any case, the benefit is that once ported, the functionality is available to all applications\&. -.sp -Before attempting to patch code for portability, please read the czmq_prelude\&.h header file\&. There are several typical types of changes you may need to make to get functionality working on a specific operating system: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Defining typedefs which are missing on that specific compiler: do this in czmq_prelude\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Defining macros that rename exotic library functions to more conventional names: do this in czmq_prelude\&.h\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Reimplementing specific methods to use a non\-standard API: this is typically needed on Windows\&. Do this in the relevant class, using #ifdefs to properly differentiate code for different platforms\&. -.RE -.sp -The canonical \fIstandard operating system\fR for all CZMQ code is Linux, gcc, POSIX\&. -.SH "AUTHORS" -.sp -The czmq manual was written by the authors in the AUTHORS file\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fB\%\fR\m[] -.sp -Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYRIGHT" -.sp -Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 deleted file mode 100644 index 45224c4859..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 +++ /dev/null @@ -1,275 +0,0 @@ -'\" t -.\" Title: zmq -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq \- 0MQ lightweight messaging kernel -.SH "SYNOPSIS" -.sp -\fB#include \fR -.sp -\fBcc\fR [\fIflags\fR] \fIfiles\fR \fB\-lzmq\fR [\fIlibraries\fR] -.SH "DESCRIPTION" -.sp -The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised \fImessaging middleware\fR products\&. 0MQ sockets provide an abstraction of asynchronous \fImessage queues\fR, multiple \fImessaging patterns\fR, message filtering (\fIsubscriptions\fR), seamless access to multiple \fItransport protocols\fR and more\&. -.sp -This documentation presents an overview of 0MQ concepts, describes how 0MQ abstracts standard sockets and provides a reference manual for the functions provided by the 0MQ library\&. -.SS "Context" -.sp -The 0MQ \fIcontext\fR keeps the list of sockets and manages the async I/O thread and internal queries\&. -.sp -Before using any 0MQ library functions you must create a 0MQ \fIcontext\fR\&. When you exit your application you must destroy the \fIcontext\fR\&. These functions let you work with \fIcontexts\fR: -.PP -Create a new 0MQ context -.RS 4 -\fBzmq_ctx_new\fR(3) -.RE -.PP -Work with context properties -.RS 4 -\fBzmq_ctx_set\fR(3)\fBzmq_ctx_get\fR(3) -.RE -.PP -Destroy a 0MQ context -.RS 4 -\fBzmq_ctx_shutdown\fR(3)\fBzmq_ctx_term\fR(3) -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBThread safety\fR -.RS 4 -.sp -A 0MQ \fIcontext\fR is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. -.sp -Individual 0MQ \fIsockets\fR are \fInot\fR thread safe except in the case where full memory barriers are issued when migrating a socket from one thread to another\&. In practice this means applications can create a socket in one thread with \fIzmq_socket()\fR and then pass it to a \fInewly created\fR thread as part of thread initialisation, for example via a structure passed as an argument to \fIpthread_create()\fR\&. -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBMultiple contexts\fR -.RS 4 -.sp -Multiple \fIcontexts\fR may coexist within a single application\&. Thus, an application can use 0MQ directly and at the same time make use of any number of additional libraries or components which themselves make use of 0MQ as long as the above guidelines regarding thread safety are adhered to\&. -.RE -.SS "Messages" -.sp -A 0MQ message is a discrete unit of data passed between applications or components of the same application\&. 0MQ messages have no internal structure and from the point of view of 0MQ itself they are considered to be opaque binary data\&. -.sp -The following functions are provided to work with messages: -.PP -Initialise a message -.RS 4 -\fBzmq_msg_init\fR(3)\fBzmq_msg_init_size\fR(3)\fBzmq_msg_init_data\fR(3) -.RE -.PP -Sending and receiving a message -.RS 4 -\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3) -.RE -.PP -Release a message -.RS 4 -\fBzmq_msg_close\fR(3) -.RE -.PP -Access message content -.RS 4 -\fBzmq_msg_data\fR(3)\fBzmq_msg_size\fR(3)\fBzmq_msg_more\fR(3) -.RE -.PP -Work with message properties -.RS 4 -\fBzmq_msg_gets\fR(3)\fBzmq_msg_get\fR(3)\fBzmq_msg_set\fR(3) -.RE -.PP -Message manipulation -.RS 4 -\fBzmq_msg_copy\fR(3)\fBzmq_msg_move\fR(3) -.RE -.SS "Sockets" -.sp -0MQ sockets present an abstraction of a asynchronous \fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. See \fBzmq_socket\fR(3) for the socket types provided\&. -.sp -The following functions are provided to work with sockets: -.PP -Creating a socket -.RS 4 -\fBzmq_socket\fR(3) -.RE -.PP -Closing a socket -.RS 4 -\fBzmq_close\fR(3) -.RE -.PP -Manipulating socket options -.RS 4 -\fBzmq_getsockopt\fR(3)\fBzmq_setsockopt\fR(3) -.RE -.PP -Establishing a message flow -.RS 4 -\fBzmq_bind\fR(3)\fBzmq_connect\fR(3) -.RE -.PP -Sending and receiving messages -.RS 4 -\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3)\fBzmq_send\fR(3)\fBzmq_recv\fR(3)\fBzmq_send_const\fR(3) -.RE -.PP -Monitoring socket events -.RS 4 -\fBzmq_socket_monitor\fR(3) -.RE -.PP -\fBInput/output multiplexing\fR. 0MQ provides a mechanism for applications to multiplex input/output events over a set containing both 0MQ sockets and standard sockets\&. This mechanism mirrors the standard -\fIpoll()\fR -system call, and is described in detail in -\fBzmq_poll\fR(3)\&. -.SS "Transports" -.sp -A 0MQ socket can use multiple different underlying transport mechanisms\&. Each transport mechanism is suited to a particular purpose and has its own advantages and drawbacks\&. -.sp -The following transport mechanisms are provided: -.PP -Unicast transport using TCP -.RS 4 -\fBzmq_tcp\fR(7) -.RE -.PP -Reliable multicast transport using PGM -.RS 4 -\fBzmq_pgm\fR(7) -.RE -.PP -Local inter\-process communication transport -.RS 4 -\fBzmq_ipc\fR(7) -.RE -.PP -Local in\-process (inter\-thread) communication transport -.RS 4 -\fBzmq_inproc\fR(7) -.RE -.PP -Virtual Machine Communications Interface (VMC) transport -.RS 4 -\fBzmq_vmci\fR(7) -.RE -.PP -Unreliable unicast and multicast using UDP -.RS 4 -\fBzmq_udp\fR(7) -.RE -.SS "Proxies" -.sp -0MQ provides \fIproxies\fR to create fanout and fan\-in topologies\&. A proxy connects a \fIfrontend\fR socket to a \fIbackend\fR socket and switches all messages between the two sockets, opaquely\&. A proxy may optionally capture all traffic to a third socket\&. To start a proxy in an application thread, use \fBzmq_proxy\fR(3)\&. -.SS "Security" -.sp -A 0MQ socket can select a security mechanism\&. Both peers must use the same security mechanism\&. -.sp -The following security mechanisms are provided for IPC and TCP connections: -.PP -Null security -.RS 4 -\fBzmq_null\fR(7) -.RE -.PP -Plain\-text authentication using username and password -.RS 4 -\fBzmq_plain\fR(7) -.RE -.PP -Elliptic curve authentication and encryption -.RS 4 -\fBzmq_curve\fR(7) -.RE -.PP -Generate a CURVE keypair in armored text format -.RS 4 -\fBzmq_curve_keypair\fR(3) -.RE -.sp -Derive a CURVE public key from a secret key: \fBzmq_curve_public\fR(3) -.PP -Converting keys to/from armoured text strings -.RS 4 -\fBzmq_z85_decode\fR(3)\fBzmq_z85_encode\fR(3) -.RE -.SH "ERROR HANDLING" -.sp -The 0MQ library functions handle errors using the standard conventions found on POSIX systems\&. Generally, this means that upon failure a 0MQ library function shall return either a NULL value (if returning a pointer) or a negative value (if returning an integer), and the actual error code shall be stored in the \fIerrno\fR variable\&. -.sp -On non\-POSIX systems some users may experience issues with retrieving the correct value of the \fIerrno\fR variable\&. The \fIzmq_errno()\fR function is provided to assist in these cases; for details refer to \fBzmq_errno\fR(3)\&. -.sp -The \fIzmq_strerror()\fR function is provided to translate 0MQ\-specific error codes into error message strings; for details refer to \fBzmq_strerror\fR(3)\&. -.SH "UTILITY" -.sp -The following utility functions are provided: -.PP -Working with atomic counters -.RS 4 -\fBzmq_atomic_counter_new\fR(3)\fBzmq_atomic_counter_set\fR(3)\fBzmq_atomic_counter_inc\fR(3)\fBzmq_atomic_counter_dec\fR(3)\fBzmq_atomic_counter_value\fR(3)\fBzmq_atomic_counter_destroy\fR(3) -.RE -.SH "MISCELLANEOUS" -.sp -The following miscellaneous functions are provided: -.PP -Report 0MQ library version -.RS 4 -\fBzmq_version\fR(3) -.RE -.SH "LANGUAGE BINDINGS" -.sp -The 0MQ library provides interfaces suitable for calling from programs in any language; this documentation documents those interfaces as they would be used by C programmers\&. The intent is that programmers using 0MQ from other languages shall refer to this documentation alongside any documentation provided by the vendor of their language binding\&. -.sp -Language bindings (C++, Python, PHP, Ruby, Java and more) are provided by members of the 0MQ community and pointers can be found on the 0MQ website\&. -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. -.SH "RESOURCES" -.sp -Main web site: \m[blue]\fBhttp://www\&.zeromq\&.org/\fR\m[] -.sp -Report bugs to the 0MQ development mailing list: <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> -.SH "COPYING" -.sp -Free use of this software is granted under the terms of the GNU Lesser General Public License (LGPL)\&. For details see the files COPYING and COPYING\&.LESSER included with the 0MQ distribution\&. -.SH "NOTES" -.IP " 1." 4 -zeromq-dev@lists.zeromq.org -.RS 4 -\%mailto:zeromq-dev@lists.zeromq.org -.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 deleted file mode 100644 index 675effc437..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 +++ /dev/null @@ -1,93 +0,0 @@ -'\" t -.\" Title: zmq_curve -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_CURVE" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_curve \- secure authentication and confidentiality -.SH "SYNOPSIS" -.sp -The CURVE mechanism defines a mechanism for secure authentication and confidentiality for communications between a client and a server\&. CURVE is intended for use on public networks\&. The CURVE mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:25\fR\m[]\&. -.SH "CLIENT AND SERVER ROLES" -.sp -A socket using CURVE can be either client or server, at any moment, but not both\&. The role is independent of bind/connect direction\&. -.sp -A socket can change roles at any point by setting new options\&. The role affects all zmq_connect and zmq_bind calls that follow it\&. -.sp -To become a CURVE server, the application sets the ZMQ_CURVE_SERVER option on the socket, and then sets the ZMQ_CURVE_SECRETKEY option to provide the socket with its long\-term secret key\&. The application does not provide the socket with its long\-term public key, which is used only by clients\&. -.sp -To become a CURVE client, the application sets the ZMQ_CURVE_SERVERKEY option with the long\-term public key of the server it intends to connect to, or accept connections from, next\&. The application then sets the ZMQ_CURVE_PUBLICKEY and ZMQ_CURVE_SECRETKEY options with its client long\-term key pair\&. -.sp -If the server does authentication it will be based on the client\(cqs long term public key\&. -.SH "KEY ENCODING" -.sp -The standard representation for keys in source code is either 32 bytes of base 256 (binary) data, or 40 characters of base 85 data encoded using the Z85 algorithm defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]\&. -.sp -The Z85 algorithm is designed to produce printable key strings for use in configuration files, the command line, and code\&. There is a reference implementation in C at \m[blue]\fBhttps://github\&.com/zeromq/rfc/tree/master/src\fR\m[]\&. -.SH "TEST KEY VALUES" -.sp -For test cases, the client shall use this long\-term key pair (specified as hexadecimal and in Z85): -.sp -.if n \{\ -.RS 4 -.\} -.nf -public: - BB88471D65E2659B30C55A5321CEBB5AAB2B70A398645C26DCA2B2FCB43FC518 - Yne@$w\-vo}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7 - -secret: - 8E0BDD697628B91D8F245587EE95C5B04D48963F79259877B49CD9063AEAD3B7 - JTKVSB%%)wK0E\&.X)V>+}o?pNmC{O&4W4b!Ni{Lh6 -.fi -.if n \{\ -.RE -.\} -.SH "SEE ALSO" -.sp -\fBzmq_z85_encode\fR(3) \fBzmq_z85_decode\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_plain\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 deleted file mode 100644 index a0b0e72d3f..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 +++ /dev/null @@ -1,103 +0,0 @@ -'\" t -.\" Title: zmq_inproc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_INPROC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_inproc \- 0MQ local in\-process (inter\-thread) communication transport -.SH "SYNOPSIS" -.sp -The in\-process transport passes messages via memory directly between threads sharing a single 0MQ \fIcontext\fR\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -No I/O threads are involved in passing messages using the \fIinproc\fR transport\&. Therefore, if you are using a 0MQ \fIcontext\fR for in\-process messaging only you can initialise the \fIcontext\fR with zero I/O threads\&. See \fBzmq_init\fR(3) for details\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the in\-process transport, the transport is inproc, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Assigning a local address to a socket" -.sp -When assigning a local address to a \fIsocket\fR using \fIzmq_bind()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to create\&. The \fIname\fR must be unique within the 0MQ \fIcontext\fR associated with the \fIsocket\fR and may be up to 256 characters in length\&. No other restrictions are placed on the format of the \fIname\fR\&. -.SS "Connecting a socket" -.sp -When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to connect to\&. Before version 4\&.0 he \fIname\fR must have been previously created by assigning it to at least one \fIsocket\fR within the same 0MQ \fIcontext\fR as the \fIsocket\fR being connected\&. Since version 4\&.0 the order of \fIzmq_bind()\fR and \fIzmq_connect()\fR does not matter just like for the tcp transport type\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Assign the in\-process name "#1" -rc = zmq_bind(socket, "inproc://#1"); -assert (rc == 0); -// Assign the in\-process name "my\-endpoint" -rc = zmq_bind(socket, "inproc://my\-endpoint"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to the in\-process name "#1" -rc = zmq_connect(socket, "inproc://#1"); -assert (rc == 0); -// Connect to the in\-process name "my\-endpoint" -rc = zmq_connect(socket, "inproc://my\-endpoint"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_ipc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 deleted file mode 100644 index c190b6f121..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 +++ /dev/null @@ -1,166 +0,0 @@ -'\" t -.\" Title: zmq_ipc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_IPC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_ipc \- 0MQ local inter\-process communication transport -.SH "SYNOPSIS" -.sp -The inter\-process transport passes messages between local processes using a system\-dependent IPC mechanism\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The inter\-process transport is currently only implemented on operating systems that provide UNIX domain sockets\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the inter\-process transport, the transport is ipc, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Binding a socket" -.sp -When binding a \fIsocket\fR to a local address using \fIzmq_bind()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to create\&. The \fIpathname\fR must be unique within the operating system namespace used by the \fIipc\fR implementation, and must fulfill any restrictions placed by the operating system on the format and length of a \fIpathname\fR\&. -.sp -When the address is wild\-card *, \fIzmq_bind()\fR shall generate a unique temporary pathname\&. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -any existing binding to the same endpoint shall be overridden\&. That is, if a second process binds to an endpoint already bound by a process, this will succeed and the first process will lose its binding\&. In this behaviour, the \fIipc\fR transport is not consistent with the \fItcp\fR or \fIinproc\fR transports\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -the endpoint pathname must be writable by the process\&. When the endpoint starts with \fI/\fR, e\&.g\&., ipc:///pathname, this will be an \fIabsolute\fR pathname\&. If the endpoint specifies a directory that does not exist, the bind shall fail\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -on Linux only, when the endpoint pathname starts with @, the abstract namespace shall be used\&. The abstract namespace is independent of the filesystem and if a process attempts to bind an endpoint already bound by a process, it will fail\&. See unix(7) for details\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -IPC pathnames have a maximum size that depends on the operating system\&. On Linux, the maximum is 113 characters including the "ipc://" prefix (107 characters for the real path name)\&. -.sp .5v -.RE -.SS "Unbinding wild\-card address from a socket" -.sp -When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. -.SS "Connecting a socket" -.sp -When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to connect to\&. The \fIpathname\fR must have been previously created within the operating system namespace by assigning it to a \fIsocket\fR with \fIzmq_bind()\fR\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Assign the pathname "/tmp/feeds/0" -rc = zmq_bind(socket, "ipc:///tmp/feeds/0"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to the pathname "/tmp/feeds/0" -rc = zmq_connect(socket, "ipc:///tmp/feeds/0"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_inproc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq_getsockopt\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 deleted file mode 100644 index 42497a1159..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 +++ /dev/null @@ -1,40 +0,0 @@ -'\" t -.\" Title: zmq_null -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_NULL" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_null \- no security or confidentiality -.SH "SYNOPSIS" -.sp -The NULL mechanism is defined by the ZMTP 3\&.0 specification: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:23\fR\m[]\&. This is the default security mechanism for ZeroMQ sockets\&. -.SH "SEE ALSO" -.sp -\fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 deleted file mode 100644 index ea8ca3fc15..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 +++ /dev/null @@ -1,200 +0,0 @@ -'\" t -.\" Title: zmq_pgm -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_PGM" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_pgm \- 0MQ reliable multicast transport using PGM -.SH "SYNOPSIS" -.sp -PGM (Pragmatic General Multicast) is a protocol for reliable multicast transport of data over IP networks\&. -.SH "DESCRIPTION" -.sp -0MQ implements two variants of PGM, the standard protocol where PGM datagrams are layered directly on top of IP datagrams as defined by RFC 3208 (the \fIpgm\fR transport) and "Encapsulated PGM" or EPGM where PGM datagrams are encapsulated inside UDP datagrams (the \fIepgm\fR transport)\&. -.sp -The \fIpgm\fR and \fIepgm\fR transports can only be used with the \fIZMQ_PUB\fR and \fIZMQ_SUB\fR socket types\&. -.sp -Further, PGM sockets are rate limited by default\&. For details, refer to the \fIZMQ_RATE\fR, and \fIZMQ_RECOVERY_IVL\fR options documented in \fBzmq_setsockopt\fR(3)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBCaution\fR -.ps -1 -.br -.sp -The \fIpgm\fR transport implementation requires access to raw IP sockets\&. Additional privileges may be required on some operating systems for this operation\&. Applications not requiring direct interoperability with other PGM implementations are encouraged to use the \fIepgm\fR transport instead which does not require any special privileges\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the PGM transport, the transport is pgm, and for the EPGM protocol the transport is epgm\&. The meaning of the \fIaddress\fR part is defined below\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIpgm\fR or \fIepgm\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a semicolon, followed by a \fImulticast address\fR, followed by a colon and a port number\&. -.sp -An \fIinterface\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The interface name as defined by the operating system\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The primary IPv4 address assigned to the interface, in its numeric representation\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Interface names are not standardised in any way and should be assumed to be arbitrary and platform dependent\&. On Win32 platforms no short interface names exist, thus only the primary IPv4 address may be used to specify an \fIinterface\fR\&. The \fIinterface\fR part can be omitted, in that case the default one will be selected\&. -.sp .5v -.RE -.sp -A \fImulticast address\fR is specified by an IPv4 multicast address in its numeric representation\&. -.SH "WIRE FORMAT" -.sp -Consecutive PGM datagrams are interpreted by 0MQ as a single continuous stream of data where 0MQ messages are not necessarily aligned with PGM datagram boundaries and a single 0MQ message may span several PGM datagrams\&. This stream of data consists of 0MQ messages encapsulated in \fIframes\fR as described in \fBzmq_tcp\fR(7)\&. -.SS "PGM datagram payload" -.sp -The following ABNF grammar represents the payload of a single PGM datagram as used by 0MQ: -.sp -.if n \{\ -.RS 4 -.\} -.nf -datagram = (offset data) -offset = 2OCTET -data = *OCTET -.fi -.if n \{\ -.RE -.\} -.sp -In order for late joining consumers to be able to identify message boundaries, each PGM datagram payload starts with a 16\-bit unsigned integer in network byte order specifying either the offset of the first message \fIframe\fR in the datagram or containing the value 0xFFFF if the datagram contains solely an intermediate part of a larger message\&. -.sp -Note that offset specifies where the first message begins rather than the first message part\&. Thus, if there are trailing message parts at the beginning of the packet the offset ignores them and points to first initial message part in the packet\&. -.sp -The following diagram illustrates the layout of a single PGM datagram payload: -.sp -.if n \{\ -.RS 4 -.\} -.nf -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| offset (16 bits) | data | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.sp -The following diagram further illustrates how three example 0MQ frames are laid out in consecutive PGM datagram payloads: -.sp -.if n \{\ -.RS 4 -.\} -.nf -First datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 1 | Frame 2, part 1 | -| 0x0000 | (Message 1) | (Message 2, part 1) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ - -Second datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 2, part 2 | -| 0xFFFF | (Message 2, part 2) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ - -Third datagram payload -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Frame offset | Frame 2, final 8 bytes | Frame 3 | -| 0x0008 | (Message 2, final 8 bytes) | (Message 3) | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.SH "EXAMPLE" -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, -// using the first Ethernet network interface on Linux -// and the Encapsulated PGM protocol -rc = zmq_connect(socket, "epgm://eth0;239\&.192\&.1\&.1:5555"); -assert (rc == 0); -// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, -// using the network interface with the address 192\&.168\&.1\&.1 -// and the standard PGM protocol -rc = zmq_connect(socket, "pgm://192\&.168\&.1\&.1;239\&.192\&.1\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 deleted file mode 100644 index 912c92d5a9..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 +++ /dev/null @@ -1,43 +0,0 @@ -'\" t -.\" Title: zmq_plain -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_PLAIN" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_plain \- clear\-text authentication -.SH "SYNOPSIS" -.sp -The PLAIN mechanism defines a simple username/password mechanism that lets a server authenticate a client\&. PLAIN makes no attempt at security or confidentiality\&. It is intended for use on internal networks where security requirements are low\&. The PLAIN mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:24\fR\m[]\&. -.SH "USAGE" -.sp -To use PLAIN, the server shall set the ZMQ_PLAIN_SERVER option, and the client shall set the ZMQ_PLAIN_USERNAME and ZMQ_PLAIN_PASSWORD socket options\&. Which peer binds, and which connects, is not relevant\&. -.SH "SEE ALSO" -.sp -\fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 deleted file mode 100644 index e0e0e00677..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 +++ /dev/null @@ -1,188 +0,0 @@ -'\" t -.\" Title: zmq_tcp -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_TCP" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_tcp \- 0MQ unicast transport using TCP -.SH "SYNOPSIS" -.sp -TCP is an ubiquitous, reliable, unicast transport\&. When connecting distributed applications over a network with 0MQ, using the TCP transport will likely be your first choice\&. -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the TCP transport, the transport is tcp, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Assigning a local address to a socket" -.sp -When assigning a local address to a socket using \fIzmq_bind()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the TCP port number to use\&. -.sp -An \fIinterface\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning all available interfaces\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The primary IPv4 or IPv6 address assigned to the interface, in its numeric representation\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The non\-portable interface name as defined by the operating system\&. -.RE -.sp -The TCP port number may be specified by: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A numeric value, usually above 1024 on POSIX systems\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning a system\-assigned ephemeral port\&. -.RE -.sp -When using ephemeral ports, the caller should retrieve the actual assigned port using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. -.SS "Unbinding wild\-card address from a socket" -.sp -When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the TCP port number to use\&. You can optionally specify a \fIsource_endpoint\fR which will be used as the source address for your connection; tcp://\fIsource_endpoint\fR;\*(Aqendpoint\*(Aq, see the \fIinterface\fR description above for details\&. -.sp -A \fIpeer address\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The DNS name of the peer\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The IPv4 or IPv6 address of the peer, in its numeric representation\&. -.RE -.sp -Note: A description of the ZeroMQ Message Transport Protocol (ZMTP) which is used by the TCP transport can be found at \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:15\fR\m[] -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// TCP port 5555 on all available interfaces -rc = zmq_bind(socket, "tcp://*:5555"); -assert (rc == 0); -// TCP port 5555 on the local loop\-back interface on all platforms -rc = zmq_bind(socket, "tcp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -// TCP port 5555 on the first Ethernet network interface on Linux -rc = zmq_bind(socket, "tcp://eth0:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting using an IP address -rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.1:5555"); -assert (rc == 0); -// Connecting using a DNS name -rc = zmq_connect(socket, "tcp://server1:5555"); -assert (rc == 0); -// Connecting using a DNS name and bind to eth1 -rc = zmq_connect(socket, "tcp://eth1:0;server1:5555"); -assert (rc == 0); -// Connecting using a IP address and bind to an IP address -rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.17:5555;192\&.168\&.1\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 deleted file mode 100644 index cef1454757..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 +++ /dev/null @@ -1,110 +0,0 @@ -'\" t -.\" Title: zmq_tipc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_TIPC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_tipc \- 0MQ unicast transport using TIPC -.SH "SYNOPSIS" -.sp -TIPC is a cluster IPC protocol with a location transparent addressing scheme\&. -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the TIPC transport, the transport is tipc, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Assigning a port name to a socket" -.sp -When assigning a port name to a socket using \fIzmq_bind()\fR with the \fItipc\fR transport, the \fIendpoint\fR is defined in the form: {type, lower, upper} -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Type is the numerical (u32) ID of your service\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Lower and Upper specify a range for your service\&. -.RE -.sp -Publishing the same service with overlapping lower/upper ID\(cqs will cause connection requests to be distributed over these in a round\-robin manner\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItipc\fR transport, the \fIendpoint\fR shall be interpreted as a service ID, followed by a comma and the instance ID\&. -.sp -The instance ID must be within the lower/upper range of a published port name for the endpoint to be valid\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Publish TIPC service ID 5555 -rc = zmq_bind(socket, "tipc://{5555,0,0}"); -assert (rc == 0); -// Publish TIPC service ID 5555 with a service range of 0\-100 -rc = zmq_bind(socket, "tipc://{5555,0,100}"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connect to service 5555 instance id 50 -rc = zmq_connect(socket, "tipc://{5555,50}"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 deleted file mode 100644 index cda022097f..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 +++ /dev/null @@ -1,139 +0,0 @@ -'\" t -.\" Title: zmq_udp -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_UDP" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_udp \- 0MQ UDP multicast and unicast transport -.SH "SYNOPSIS" -.sp -UDP is unreliable protocol transport of data over IP networks\&. UDP support both unicast and multicast communication\&. -.SH "DESCRIPTION" -.sp -UDP transport can only be used with the \fIZMQ_RADIO\fR and \fIZMQ_DISH\fR socket types\&. -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the UDP transport, the transport is udp\&. The meaning of the \fIaddress\fR part is defined below\&. -.sp -Binding a socket -.sp -.if n \{\ -.RS 4 -.\} -.nf -With \*(Aqudp\*(Aq we can only bind the \*(AqZMQ_DISH\*(Aq socket type\&. -When binding a socket using _zmq_bind()_ with the \*(Aqudp\*(Aq -transport the \*(Aqendpoint\*(Aq shall be interpreted as an \*(Aqinterface\*(Aq followed by a -colon and the UDP port number to use\&. - -An \*(Aqinterface\*(Aq may be specified by either of the following: - -* The wild\-card `*`, meaning all available interfaces\&. -* The primary IPv4 address assigned to the interface, in its numeric - representation\&. -* Multicast address in its numeric representation the socket should join\&. - -The UDP port number may be specified a numeric value, usually above 1024 on POSIX systems\&. - -Connecting a socket -.fi -.if n \{\ -.RE -.\} -.sp -With \fIudp\fR we can only connect the \fIZMQ_RADIO\fR socket type\&. When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIudp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the UDP port number to use\&. -.sp -A \fIpeer address\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The IPv4 or IPv6 address of the peer, in its numeric representation\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Multicast address in its numeric representation\&. -.RE -.SH "EXAMPLES" -.PP -\fBBinding a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Unicast \- UDP port 5555 on all available interfaces -rc = zmq_bind(dish, "udp://*:5555"); -assert (rc == 0); -// Unicast \- UDP port 5555 on the local loop\-back interface -rc = zmq_bind(dish, "udp://127\&.0\&.0\&.1:5555"); -assert (rc == 0); -// Multicast \- UDP port 5555 on a Multicast address -rc = zmq_bind(dish, "udp://239\&.0\&.0\&.1:5555"); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting using an Unicast IP address -rc = zmq_connect(radio, "udp://192\&.168\&.1\&.1:5555"); -assert (rc == 0); -// Connecting using a Multicast address" -rc = zmq_connect(socket, "udp://239\&.0\&.0\&.1:5555); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 deleted file mode 100644 index 5383060905..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 +++ /dev/null @@ -1,162 +0,0 @@ -'\" t -.\" Title: zmq_vmci -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 02/18/2017 -.\" Manual: 0MQ Manual -.\" Source: 0MQ 4.2.2 -.\" Language: English -.\" -.TH "ZMQ_VMCI" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -zmq_vmci \- 0MQ transport over virtual machine communicatios interface (VMCI) sockets -.SH "SYNOPSIS" -.sp -The VMCI transport passes messages between VMware virtual machines running on the same host, between virtual machine and the host and within virtual machines (inter\-process transport like ipc)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Communication between a virtual machine and the host is not supported on Mac OS X 10\&.9 and above\&. -.sp .5v -.RE -.SH "ADDRESSING" -.sp -A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. -.sp -For the VMCI transport, the transport is vmci, and the meaning of the \fIaddress\fR part is defined below\&. -.SS "Binding a socket" -.sp -When binding a \fIsocket\fR to a local address using \fIzmq_bind()\fR with the \fIvmci\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the TCP port number to use\&. -.sp -An \fIinterface\fR may be specified by either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning all available interfaces\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -An integer returned by -VMCISock_GetLocalCID -or -@ -(ZeroMQ will call VMCISock_GetLocalCID internally)\&. -.RE -.sp -The port may be specified by: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A numeric value, usually above 1024 on POSIX systems\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The wild\-card -*, meaning a system\-assigned ephemeral port\&. -.RE -.SS "Unbinding wild\-card address from a socket" -.sp -When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. -.SS "Connecting a socket" -.sp -When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIvmci\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the port number to use\&. -.sp -A \fIpeer address\fR must be a CID of the peer\&. -.SH "EXAMPLES" -.PP -\fBAssigning a local address to a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// VMCI port 5555 on all available interfaces -rc = zmq_bind(socket, "vmci://*:5555"); -assert (rc == 0); -// VMCI port 5555 on the local loop\-back interface on all platforms -cid = VMCISock_GetLocalCID(); -sprintf(endpoint, "vmci://%d:5555", cid); -rc = zmq_bind(socket, endpoint); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.PP -\fBConnecting a socket\fR. -.sp -.if n \{\ -.RS 4 -.\} -.nf -// Connecting using a CID -sprintf(endpoint, "vmci://%d:5555", cid); -rc = zmq_connect(socket, endpoint); -assert (rc == 0); -.fi -.if n \{\ -.RE -.\} -.sp -.SH "SEE ALSO" -.sp -\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_inproc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq_getsockopt\fR(3) \fBzmq\fR(7) -.SH "AUTHORS" -.sp -This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api deleted file mode 100644 index 2ff128b36e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api +++ /dev/null @@ -1,62 +0,0 @@ - - - provides a simple actor framework - - - Actors get a pipe and arguments from caller - - - - - - Create a new actor passing arbitrary arguments reference. - - - - - - Destroy an actor. - - - - Send a zmsg message to the actor, take ownership of the message - and destroy when it has been sent. - - - - - - Receive a zmsg message from the actor. Returns NULL if the actor - was interrupted before the message could be received, or if there - was a timeout on the actor. - - - - - Probe the supplied object, and report if it looks like a zactor_t. - - - - - - Probe the supplied reference. If it looks like a zactor_t instance, - return the underlying libzmq actor handle; else if it looks like - a libzmq actor handle, return the supplied value. - - - - - - Return the actor's zsock handle. Use this when you absolutely need - to work with the zsock instance rather than the actor. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api deleted file mode 100644 index 887ca9ffdb..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api +++ /dev/null @@ -1,103 +0,0 @@ - - - armoured text encoding and decoding - - Standard base 64 - URL and filename friendly base 64 - Standard base 32 - Extended hex base 32 - Standard base 16 - Z85 from ZeroMQ RFC 32 - - - Create a new zarmour - - - - Destroy the zarmour - - - - Encode a stream of bytes into an armoured string. Returns the armoured - string, or NULL if there was insufficient memory available to allocate - a new string. - - - - - - - Decode an armoured string into a chunk. The decoded output is - null-terminated, so it may be treated as a string, if that's what - it was prior to encoding. - - - - - - Get the mode property. - - - - - Get printable string for mode. - - - - - Set the mode property. - - - - - Return true if padding is turned on. - - - - - Turn padding on or off. Default is on. - - - - - Get the padding character. - - - - - Set the padding character. - - - - - Return if splitting output into lines is turned on. Default is off. - - - - - Turn splitting output into lines on or off. - - - - - Get the line length used for splitting lines. - - - - - Set the line length used for splitting lines. - - - - - Print properties of object - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api deleted file mode 100644 index d361ba2165..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api +++ /dev/null @@ -1,122 +0,0 @@ - - - work with CURVE security certificates - - - Create and initialize a new certificate in memory - - - - Accepts public/secret key pair from caller - - - - - - Load certificate from file - - - - - Destroy a certificate in memory - - - - Return public part of key pair as 32-byte binary string - - - - - Return secret part of key pair as 32-byte binary string - - - - - Return public part of key pair as Z85 armored string - - - - - Return secret part of key pair as Z85 armored string - - - - - Set certificate metadata from formatted string. - - - - - - Unset certificate metadata. - - - - - Get metadata value from certificate; if the metadata value doesn't - exist, returns NULL. - - - - - - Get list of metadata fields from certificate. Caller is responsible for - destroying list. Caller should not modify the values of list items. - - - - - Save full certificate (public + secret) to file for persistent storage - This creates one public file and one secret file (filename + "_secret"). - - - - - - Save public certificate only to file for persistent storage - - - - - - Save secret certificate only to file for persistent storage - - - - - - Apply certificate to socket, i.e. use for CURVE security on socket. - If certificate was loaded from public file, the secret key will be - undefined, and this certificate will not work successfully. - - - - - Return copy of certificate; if certificate is NULL or we exhausted - heap memory, returns NULL. - - - - - Return true if two certificates have the same keys - - - - - - Print certificate contents to stdout - - - - Self test of this class - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api deleted file mode 100644 index b566fefa53..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api +++ /dev/null @@ -1,72 +0,0 @@ - - - work with CURVE security certificate stores - - - Create a new certificate store from a disk directory, loading and - indexing all certificates in that location. The directory itself may be - absent, and created later, or modified at any time. The certificate store - is automatically refreshed on any zcertstore_lookup() call. If the - location is specified as NULL, creates a pure-memory store, which you - can work with by inserting certificates at runtime. - - - - - Destroy a certificate store object in memory. Does not affect anything - stored on disk. - - - - Loaders retrieve certificates from an arbitrary source. - - - - - Destructor for loader state. - - - - - Override the default disk loader with a custom loader fn. - - - - - - - Look up certificate by public key, returns zcert_t object if found, - else returns NULL. The public key is provided in Z85 text format. - - - - - - Insert certificate into certificate store in memory. Note that this - does not save the certificate to disk. To do that, use zcert_save() - directly on the certificate. Takes ownership of zcert_t object. - - - - - Empty certificate hashtable. This wrapper exists to be friendly to bindings, - which don't usually have access to struct internals. - - - - Print list of certificates in store to logging facility - - - - Self test of this class - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api deleted file mode 100644 index 25b50e9581..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api +++ /dev/null @@ -1,171 +0,0 @@ - - - work with memory chunks - - - Create a new chunk of the specified size. If you specify the data, it - is copied into the chunk. If you do not specify the data, the chunk is - allocated and left empty, and you can then add data using zchunk_append. - - - - - - Destroy a chunk - - - - Resizes chunk max_size as requested; chunk_cur size is set to zero - - - - - Return chunk cur size - - - - - Return chunk max size - - - - - Return chunk data - - - - - Set chunk data from user-supplied data; truncate if too large. Data may - be null. Returns actual size of chunk - - - - - - - Fill chunk data from user-supplied octet - - - - - - - Append user-supplied data to chunk, return resulting chunk size. If the - data would exceeded the available space, it is truncated. If you want to - grow the chunk to accommodate new data, use the zchunk_extend method. - - - - - - - Append user-supplied data to chunk, return resulting chunk size. If the - data would exceeded the available space, the chunk grows in size. - - - - - - - Copy as much data from 'source' into the chunk as possible; returns the - new size of chunk. If all data from 'source' is used, returns exhausted - on the source chunk. Source can be consumed as many times as needed until - it is exhausted. If source was already exhausted, does not change chunk. - - - - - - Returns true if the chunk was exhausted by consume methods, or if the - chunk has a size of zero. - - - - - Read chunk from an open file descriptor - - - - - - - Write chunk to an open file descriptor - - - - - - Try to slurp an entire file into a chunk. Will read up to maxsize of - the file. If maxsize is 0, will attempt to read the entire file and - fail with an assertion if that cannot fit into memory. Returns a new - chunk containing the file data, or NULL if the file could not be read. - - - - - - - Create copy of chunk, as new chunk object. Returns a fresh zchunk_t - object, or null if there was not enough heap memory. If chunk is null, - returns null. - - - - - Return chunk data encoded as printable hex string. Caller must free - string when finished with it. - - - - - Return chunk data copied into freshly allocated string - Caller must free string when finished with it. - - - - - Return TRUE if chunk body is equal to string, excluding terminator - - - - - - Transform zchunk into a zframe that can be sent in a message. - - - - - Transform a zframe into a zchunk. - - - - - - Calculate SHA1 digest for chunk, using zdigest class. - - - - - Dump chunk to FILE stream, for debugging and tracing. - - - - - Dump message to stderr, for debugging and tracing. - See zchunk_fprint for details - - - - Probe the supplied object, and report if it looks like a zchunk_t. - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api deleted file mode 100644 index a613180f15..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api +++ /dev/null @@ -1,43 +0,0 @@ - - - millisecond clocks and delays - - - Sleep for a number of milliseconds - - - - - Return current system clock as milliseconds. Note that this clock can - jump backwards (if the system clock is changed) so is unsafe to use for - timers and time offsets. Use zclock_mono for that instead. - - - - - Return current monotonic clock in milliseconds. Use this when you compute - time offsets. The monotonic clock is not affected by system changes and - so will never be reset backwards, unlike a system clock. - - - - - Return current monotonic clock in microseconds. Use this when you compute - time offsets. The monotonic clock is not affected by system changes and - so will never be reset backwards, unlike a system clock. - - - - - Return formatted date/time as fresh string. Free using zstr_free(). - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api deleted file mode 100644 index db46751fa8..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api +++ /dev/null @@ -1,196 +0,0 @@ - - - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - - - - - - - - - Create new config item - - - - - - Destroy a config item and all its children - - - - Return name of config item - - - - - Return value of config item - - - - - Insert or update configuration key with value - - - - - - Equivalent to zconfig_put, accepting a format specifier and variable - argument list, instead of a single string value. - - - - - - Get value for config item into a string value; leading slash is optional - and ignored. - - - - - - Set config item name, name may be NULL - - - - - Set new value for config item. The new value may be a string, a printf - format, or NULL. Note that if string may possibly contain '%', or if it - comes from an insecure source, you must use '%s' as the format, followed - by the string. - - - - - Find our first child, if any - - - - - Find our first sibling, if any - - - - - Find a config item along a path; leading slash is optional and ignored. - - - - - - Locate the last config item at a specified depth - - - - - - Execute a callback for each config item in the tree; returns zero if - successful, else -1. - - - - - - - Add comment to config item before saving to disk. You can add as many - comment lines as you like. If you use a null format, all comments are - deleted. - - - - - Return comments of config item, as zlist. - - - - - Load a config tree from a specified ZPL text file; returns a zconfig_t - reference for the root, if the file exists and is readable. Returns NULL - if the file does not exist. - - - - - Save a config tree to a specified ZPL text file, where a filename - "-" means dump to standard output. - - - - - - Equivalent to zconfig_load, taking a format string instead of a fixed - filename. - - - - - Equivalent to zconfig_save, taking a format string instead of a fixed - filename. - - - - - - Report filename used during zconfig_load, or NULL if none - - - - - Reload config tree from same file that it was previously loaded from. - Returns 0 if OK, -1 if there was an error (and then does not change - existing data). - - - - - - Load a config tree from a memory chunk - - - - - - Save a config tree to a new memory chunk - - - - - Load a config tree from a null-terminated string - - - - - - Save a config tree to a new null terminated string - - - - - Return true if a configuration tree was loaded from a file and that - file has changed in since the tree was loaded. - - - - - Print the config file to open stream - - - - - Print properties of object - - - - Self test of this class - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api deleted file mode 100644 index 83abb9b121..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api +++ /dev/null @@ -1,45 +0,0 @@ - - - provides hashing functions (SHA-1 at present) - - - Constructor - creates new digest object, which you use to build up a - digest by repeatedly calling zdigest_update() on chunks of data. - - - - Destroy a digest object - - - - Add buffer into digest calculation - - - - - - Return final digest hash data. If built without crypto support, - returns NULL. - - - - - Return final digest hash size - - - - - Return digest as printable hex string; caller should not modify nor - free this string. After calling this, you may not use zdigest_update() - on the same digest. If built without crypto support, returns NULL. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api deleted file mode 100644 index cb8283a702..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api +++ /dev/null @@ -1,124 +0,0 @@ - - - work with file-system directories - - - Create a new directory item that loads in the full tree of the specified - path, optionally located under some parent path. If parent is "-", then - loads only the top-level directory, and does not use parent as a path. - - - - - - Destroy a directory tree and all children it contains. - - - - Return directory path - - - - - Return last modification time for directory. - - - - - Return total hierarchy size, in bytes of data contained in all files - in the directory tree. - - - - - Return directory count - - - - - Returns a sorted list of zfile objects; Each entry in the list is a pointer - to a zfile_t item already allocated in the zdir tree. Do not destroy the - original zdir tree until you are done with this list. - - - - - Remove directory, optionally including all files that it contains, at - all levels. If force is false, will only remove the directory if empty. - If force is true, will remove all files and all subdirectories. - - - - - Calculate differences between two versions of a directory tree. - Returns a list of zdir_patch_t patches. Either older or newer may - be null, indicating the directory is empty/absent. If alias is set, - generates virtual filename (minus path, plus alias). - - - - - - - - Return full contents of directory as a zdir_patch list. - - - - - - Load directory cache; returns a hash table containing the SHA-1 digests - of every file in the tree. The cache is saved between runs in .cache. - - - - - Print contents of directory to open stream - - - - - - Print contents of directory to stdout - - - - - Create a new zdir_watch actor instance: - - zactor_t *watch = zactor_new (zdir_watch, NULL); - - Destroy zdir_watch instance: - - zactor_destroy (&watch); - - Enable verbose logging of commands and activity: - - zstr_send (watch, "VERBOSE"); - - Subscribe to changes to a directory path: - - zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); - - Unsubscribe from changes to a directory path: - - zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); - - Receive directory changes: - zsock_recv (watch, "sp", &path, &patches); - - // Delete the received data. - free (path); - zlist_destroy (&patches); - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api deleted file mode 100644 index 8d102b887a..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api +++ /dev/null @@ -1,62 +0,0 @@ - - - work with directory patches - - Creates a new file - Delete a file - - - Create new patch - - - - - - - - Destroy a patch - - - - Create copy of a patch. If the patch is null, or memory was exhausted, - returns null. - - - - - Return patch file directory path - - - - - Return patch file item - - - - - Return operation - - - - - Return patch virtual file path - - - - - Calculate hash digest for file (create only) - - - - Return hash digest for patch file - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api deleted file mode 100644 index f60391bfee..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api +++ /dev/null @@ -1,152 +0,0 @@ - - - helper functions for working with files. - - - If file exists, populates properties. CZMQ supports portable symbolic - links, which are files with the extension ".ln". A symbolic link is a - text file containing one line, the filename of a target file. Reading - data from the symbolic link actually reads from the target file. Path - may be NULL, in which case it is not used. - - - - - - Destroy a file item - - - - Duplicate a file item, returns a newly constructed item. If the file - is null, or memory was exhausted, returns null. - - - - - Return file name, remove path if provided - - - - - - Refresh file properties from disk; this is not done automatically - on access methods, otherwise it is not possible to compare directory - snapshots. - - - - Return when the file was last modified. If you want this to reflect the - current situation, call zfile_restat before checking this property. - - - - - Return the last-known size of the file. If you want this to reflect the - current situation, call zfile_restat before checking this property. - - - - - Return true if the file is a directory. If you want this to reflect - any external changes, call zfile_restat before checking this property. - - - - - Return true if the file is a regular file. If you want this to reflect - any external changes, call zfile_restat before checking this property. - - - - - Return true if the file is readable by this process. If you want this to - reflect any external changes, call zfile_restat before checking this - property. - - - - - Return true if the file is writeable by this process. If you want this - to reflect any external changes, call zfile_restat before checking this - property. - - - - - Check if file has stopped changing and can be safely processed. - Updates the file statistics from disk at every call. - - - - - Return true if the file was changed on disk since the zfile_t object - was created, or the last zfile_restat() call made on it. - - - - - Remove the file from disk - - - - Open file for reading - Returns 0 if OK, -1 if not found or not accessible - - - - - Open file for writing, creating directory if needed - File is created if necessary; chunks can be written to file at any - location. Returns 0 if OK, -1 if error. - - - - - Read chunk from file at specified position. If this was the last chunk, - sets the eof property. Returns a null chunk in case of error. - - - - - - - Returns true if zfile_read() just read the last chunk in the file. - - - - - Write chunk to file at specified position - Return 0 if OK, else -1 - - - - - - - Read next line of text from file. Returns a pointer to the text line, - or NULL if there was nothing more to read from the file. - - - - - Close file, if open - - - - Return file handle, if opened - - - - - Calculate SHA1 digest for file, using zdigest class. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api deleted file mode 100644 index cf3c3219f6..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api +++ /dev/null @@ -1,156 +0,0 @@ - - - working with single message frames - - - - - - - Create a new frame. If size is not null, allocates the frame data - to the specified size. If additionally, data is not null, copies - size octets from the specified data into the frame body. - - - - - - Destroy a frame - - - - Create an empty (zero-sized) frame - - - - Create a frame with a specified string content. - - - - - Receive frame from socket, returns zframe_t object or NULL if the recv - was interrupted. Does a blocking recv, if you want to not block then use - zpoller or zloop. - - - - - Send a frame to a socket, destroy frame after sending. - Return -1 on error, 0 on success. - - - - - - - - Return number of bytes in frame data - - - - - Return address of frame data - - - - - Return meta data property for frame - Caller must free string when finished with it. - - - - - - Create a new frame that duplicates an existing frame. If frame is null, - or memory was exhausted, returns null. - - - - - Return frame data encoded as printable hex string, useful for 0MQ UUIDs. - Caller must free string when finished with it. - - - - - Return frame data copied into freshly allocated string - Caller must free string when finished with it. - - - - - Return TRUE if frame body is equal to string, excluding terminator - - - - - - Return frame MORE indicator (1 or 0), set when reading frame from socket - or by the zframe_set_more() method - - - - - Set frame MORE indicator (1 or 0). Note this is NOT used when sending - frame to socket, you have to specify flag explicitly. - - - - - Return frame routing ID, if the frame came from a ZMQ_SERVER socket. - Else returns zero. - - - - - Set routing ID on frame. This is used if/when the frame is sent to a - ZMQ_SERVER socket. - - - - - Return frame group of radio-dish pattern. - - - - - Set group on frame. This is used if/when the frame is sent to a - ZMQ_RADIO socket. - Return -1 on error, 0 on success. - - - - - - Return TRUE if two frames have identical size and data - If either frame is NULL, equality is always false. - - - - - - Set new contents for frame - - - - - - Send message to zsys log sink (may be stdout, or system facility as - configured by zsys_set_logstream). Prefix shows before frame, if not null. - - - - - Probe the supplied object, and report if it looks like a zframe_t. - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api deleted file mode 100644 index 0f314fab7c..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - Create a new empty zgossip_msg - - - - Destroy a zgossip_msg instance - - - - Receive a zgossip_msg from the socket. Returns 0 if OK, -1 if - there was an error. Blocks if there is no message waiting. - - - - - - Send the zgossip_msg to the output socket, does not destroy it - - - - - - Print contents of message to stdout - - - - Get the message routing id, as a frame - - - - - Set the message routing id from a frame - - - - - Get the zgossip_msg message id - - - - - Set the zgossip_msg message id - - - - - Get the zgossip_msg message id as printable text - - - - - Get the key field - - - - Set the key field - - - - Get the value field - - - - Set the value field - - - - Get the ttl field - - - - Set the ttl field - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api deleted file mode 100644 index 36d58847af..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api +++ /dev/null @@ -1,183 +0,0 @@ - - - generic type-free hash container (simple) - - - Callback function for zhash_freefn method - - - - - Create a new, empty hash container - - - - Destroy a hash container and all items in it - - - - Insert item into hash table with specified key and item. - If key is already present returns -1 and leaves existing item unchanged - Returns 0 on success. - - - - - - - Update item into hash table with specified key and item. - If key is already present, destroys old item and inserts new one. - Use free_fn method to ensure deallocator is properly called on item. - - - - - - Remove an item specified by key from the hash table. If there was no such - item, this function does nothing. - - - - - Return the item at the specified key, or null - - - - - - Reindexes an item from an old key to a new key. If there was no such - item, does nothing. Returns 0 if successful, else -1. - - - - - - - Set a free function for the specified hash table item. When the item is - destroyed, the free function, if any, is called on that item. - Use this when hash items are dynamically allocated, to ensure that - you don't have memory leaks. You can pass 'free' or NULL as a free_fn. - Returns the item, or NULL if there is no such item. - - - - - - - Return the number of keys/items in the hash table - - - - - Make copy of hash table; if supplied table is null, returns null. - Does not copy items themselves. Rebuilds new table so may be slow on - very large tables. NOTE: only works with item values that are strings - since there's no other way to know how to duplicate the item value. - - - - - Return keys for items in table - - - - - Simple iterator; returns first item in hash table, in no given order, - or NULL if the table is empty. This method is simpler to use than the - foreach() method, which is deprecated. To access the key for this item - use zhash_cursor(). NOTE: do NOT modify the table while iterating. - - - - - Simple iterator; returns next item in hash table, in no given order, - or NULL if the last item was already returned. Use this together with - zhash_first() to process all items in a hash table. If you need the - items in sorted order, use zhash_keys() and then zlist_sort(). To - access the key for this item use zhash_cursor(). NOTE: do NOT modify - the table while iterating. - - - - - After a successful first/next method, returns the key for the item that - was returned. This is a constant string that you may not modify or - deallocate, and which lasts as long as the item in the hash. After an - unsuccessful first/next, returns NULL. - - - - - Add a comment to hash table before saving to disk. You can add as many - comment lines as you like. These comment lines are discarded when loading - the file. If you use a null format, all comments are deleted. - - - - - Serialize hash table to a binary frame that can be sent in a message. - The packed format is compatible with the 'dictionary' type defined in - http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: - - ; A list of name/value pairs - dictionary = dict-count *( dict-name dict-value ) - dict-count = number-4 - dict-value = longstr - dict-name = string - - ; Strings are always length + text contents - longstr = number-4 *VCHAR - string = number-1 *VCHAR - - ; Numbers are unsigned integers in network byte order - number-1 = 1OCTET - number-4 = 4OCTET - - Comments are not included in the packed data. Item values MUST be - strings. - - - - - Unpack binary frame into a new hash table. Packed data must follow format - defined by zhash_pack. Hash table is set to autofree. An empty frame - unpacks to an empty hash table. - - - - - Save hash table to a text file in name=value format. Hash values must be - printable strings; keys may not contain '=' character. Returns 0 if OK, - else -1 if a file error occurred. - - - - - - Load hash table from a text file in name=value format; hash table must - already exist. Hash values must printable strings; keys may not contain - '=' character. Returns 0 if OK, else -1 if a file was not readable. - - - - - - When a hash table was loaded from a file by zhash_load, this method will - reload the file if it has been modified since, and is "stable", i.e. not - still changing. Returns 0 if OK, -1 if there was an error reloading the - file. - - - - - Set hash for automatic value destruction - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api deleted file mode 100644 index 22087e0fe9..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api +++ /dev/null @@ -1,293 +0,0 @@ - - - extended generic type-free hash container - - - Destroy an item - - - - - Duplicate an item - - - - - - Compare two items, for sorting - - - - - - - compare two items, for sorting - - - - - compare two items, for sorting - - - - - - Serializes an item to a longstr. - The caller takes ownership of the newly created object. - - - - - - Deserializes a longstr into an item. - The caller takes ownership of the newly created object. - - - - - - Create a new, empty hash container - - - - Destroy a hash container and all items in it - - - - Insert item into hash table with specified key and item. - If key is already present returns -1 and leaves existing item unchanged - Returns 0 on success. - - - - - - - Update or insert item into hash table with specified key and item. If the - key is already present, destroys old item and inserts new one. If you set - a container item destructor, this is called on the old value. If the key - was not already present, inserts a new item. Sets the hash cursor to the - new item. - - - - - - Remove an item specified by key from the hash table. If there was no such - item, this function does nothing. - - - - - Delete all items from the hash table. If the key destructor is - set, calls it on every key. If the item destructor is set, calls - it on every item. - - - - Return the item at the specified key, or null - - - - - - Reindexes an item from an old key to a new key. If there was no such - item, does nothing. Returns 0 if successful, else -1. - - - - - - - Set a free function for the specified hash table item. When the item is - destroyed, the free function, if any, is called on that item. - Use this when hash items are dynamically allocated, to ensure that - you don't have memory leaks. You can pass 'free' or NULL as a free_fn. - Returns the item, or NULL if there is no such item. - - - - - - - Return the number of keys/items in the hash table - - - - - Return a zlistx_t containing the keys for the items in the - table. Uses the key_duplicator to duplicate all keys and sets the - key_destructor as destructor for the list. - - - - - Return a zlistx_t containing the values for the items in the - table. Uses the duplicator to duplicate all items and sets the - destructor as destructor for the list. - - - - - Simple iterator; returns first item in hash table, in no given order, - or NULL if the table is empty. This method is simpler to use than the - foreach() method, which is deprecated. To access the key for this item - use zhashx_cursor(). NOTE: do NOT modify the table while iterating. - - - - - Simple iterator; returns next item in hash table, in no given order, - or NULL if the last item was already returned. Use this together with - zhashx_first() to process all items in a hash table. If you need the - items in sorted order, use zhashx_keys() and then zlistx_sort(). To - access the key for this item use zhashx_cursor(). NOTE: do NOT modify - the table while iterating. - - - - - After a successful first/next method, returns the key for the item that - was returned. This is a constant string that you may not modify or - deallocate, and which lasts as long as the item in the hash. After an - unsuccessful first/next, returns NULL. - - - - - Add a comment to hash table before saving to disk. You can add as many - comment lines as you like. These comment lines are discarded when loading - the file. If you use a null format, all comments are deleted. - - - - - Save hash table to a text file in name=value format. Hash values must be - printable strings; keys may not contain '=' character. Returns 0 if OK, - else -1 if a file error occurred. - - - - - - Load hash table from a text file in name=value format; hash table must - already exist. Hash values must printable strings; keys may not contain - '=' character. Returns 0 if OK, else -1 if a file was not readable. - - - - - - When a hash table was loaded from a file by zhashx_load, this method will - reload the file if it has been modified since, and is "stable", i.e. not - still changing. Returns 0 if OK, -1 if there was an error reloading the - file. - - - - - Serialize hash table to a binary frame that can be sent in a message. - The packed format is compatible with the 'dictionary' type defined in - http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: - - ; A list of name/value pairs - dictionary = dict-count *( dict-name dict-value ) - dict-count = number-4 - dict-value = longstr - dict-name = string - - ; Strings are always length + text contents - longstr = number-4 *VCHAR - string = number-1 *VCHAR - - ; Numbers are unsigned integers in network byte order - number-1 = 1OCTET - number-4 = 4OCTET - - Comments are not included in the packed data. Item values MUST be - strings. - - - - - Same as pack but uses a user-defined serializer function to convert items - into longstr. - - - - - - Unpack binary frame into a new hash table. Packed data must follow format - defined by zhashx_pack. Hash table is set to autofree. An empty frame - unpacks to an empty hash table. - - - - - Same as unpack but uses a user-defined deserializer function to convert - a longstr back into item format. - - - - - - Make a copy of the list; items are duplicated if you set a duplicator - for the list, otherwise not. Copying a null reference returns a null - reference. Note that this method's behavior changed slightly for CZMQ - v3.x, as it does not set nor respect autofree. It does however let you - duplicate any hash table safely. The old behavior is in zhashx_dup_v2. - - - - - Set a user-defined deallocator for hash items; by default items are not - freed when the hash is destroyed. - - - - - Set a user-defined duplicator for hash items; by default items are not - copied when the hash is duplicated. - - - - - Set a user-defined deallocator for keys; by default keys are freed - when the hash is destroyed using free(). - - - - - Set a user-defined duplicator for keys; by default keys are duplicated - using strdup. - - - - - Set a user-defined comparator for keys; by default keys are - compared using strcmp. - - - - - Set a user-defined comparator for keys; by default keys are - compared using strcmp. - - - - - Make copy of hash table; if supplied table is null, returns null. - Does not copy items themselves. Rebuilds new table so may be slow on - very large tables. NOTE: only works with item values that are strings - since there's no other way to know how to duplicate the item value. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api deleted file mode 100644 index 5dc362463c..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api +++ /dev/null @@ -1,58 +0,0 @@ - - - List of network interfaces available on system - - - Get a list of network interfaces currently defined on the system - - - - Destroy a ziflist instance - - - - Reload network interfaces from system - - - - Return the number of network interfaces on system - - - - - Get first network interface, return NULL if there are none - - - - - Get next network interface, return NULL if we hit the last one - - - - - Return the current interface IP address as a printable string - - - - - Return the current interface broadcast address as a printable string - - - - - Return the current interface network mask as a printable string - - - - - Return the list of interfaces. - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api deleted file mode 100644 index 67b4f01c57..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api +++ /dev/null @@ -1,158 +0,0 @@ - - - simple generic list container - - - Comparison function e.g. for sorting and removing. - - - - - - - Callback function for zlist_freefn method - - - - - Create a new list container - - - - Destroy a list container - - - - Return the item at the head of list. If the list is empty, returns NULL. - Leaves cursor pointing at the head item, or NULL if the list is empty. - - - - - Return the next item. If the list is empty, returns NULL. To move to - the start of the list call zlist_first (). Advances the cursor. - - - - - Return the item at the tail of list. If the list is empty, returns NULL. - Leaves cursor pointing at the tail item, or NULL if the list is empty. - - - - - Return first item in the list, or null, leaves the cursor - - - - - Return last item in the list, or null, leaves the cursor - - - - - Return the current item of list. If the list is empty, returns NULL. - Leaves cursor pointing at the current item, or NULL if the list is empty. - - - - - Append an item to the end of the list, return 0 if OK or -1 if this - failed for some reason (out of memory). Note that if a duplicator has - been set, this method will also duplicate the item. - - - - - - Push an item to the start of the list, return 0 if OK or -1 if this - failed for some reason (out of memory). Note that if a duplicator has - been set, this method will also duplicate the item. - - - - - - Pop the item off the start of the list, if any - - - - - Checks if an item already is present. Uses compare method to determine if - items are equal. If the compare method is NULL the check will only compare - pointers. Returns true if item is present else false. - - - - - - Remove the specified item from the list if present - - - - - Make a copy of list. If the list has autofree set, the copied list will - duplicate all items, which must be strings. Otherwise, the list will hold - pointers back to the items in the original list. If list is null, returns - NULL. - - - - - Purge all items from list - - - - Return number of items in the list - - - - - Sort the list. If the compare function is null, sorts the list by - ascending key value using a straight ASCII comparison. If you specify - a compare function, this decides how items are sorted. The sort is not - stable, so may reorder items with the same keys. The algorithm used is - combsort, a compromise between performance and simplicity. - - - - - Set list for automatic item destruction; item values MUST be strings. - By default a list item refers to a value held elsewhere. When you set - this, each time you append or push a list item, zlist will take a copy - of the string value. Then, when you destroy the list, it will free all - item values automatically. If you use any other technique to allocate - list values, you must free them explicitly before destroying the list. - The usual technique is to pop list items and destroy them, until the - list is empty. - - - - Sets a compare function for this list. The function compares two items. - It returns an integer less than, equal to, or greater than zero if the - first item is found, respectively, to be less than, to match, or be - greater than the second item. - This function is used for sorting, removal and exists checking. - - - - - Set a free function for the specified list item. When the item is - destroyed, the free function, if any, is called on that item. - Use this when list items are dynamically allocated, to ensure that - you don't have memory leaks. You can pass 'free' or NULL as a free_fn. - Returns the item, or NULL if there is no such item. - - - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api deleted file mode 100644 index 1dc95ea637..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api +++ /dev/null @@ -1,220 +0,0 @@ - - - extended generic list container - - - Destroy an item - - - - - Duplicate an item - - - - - - Compare two items, for sorting - - - - - - - Create a new, empty list. - - - - Destroy a list. If an item destructor was specified, all items in the - list are automatically destroyed as well. - - - - Add an item to the head of the list. Calls the item duplicator, if any, - on the item. Resets cursor to list head. Returns an item handle on - success, NULL if memory was exhausted. - - - - - - Add an item to the tail of the list. Calls the item duplicator, if any, - on the item. Resets cursor to list head. Returns an item handle on - success, NULL if memory was exhausted. - - - - - - Return the number of items in the list - - - - - Return first item in the list, or null, leaves the cursor - - - - - Return last item in the list, or null, leaves the cursor - - - - - Return the item at the head of list. If the list is empty, returns NULL. - Leaves cursor pointing at the head item, or NULL if the list is empty. - - - - - Return the next item. At the end of the list (or in an empty list), - returns NULL. Use repeated zlistx_next () calls to work through the list - from zlistx_first (). First time, acts as zlistx_first(). - - - - - Return the previous item. At the start of the list (or in an empty list), - returns NULL. Use repeated zlistx_prev () calls to work through the list - backwards from zlistx_last (). First time, acts as zlistx_last(). - - - - - Return the item at the tail of list. If the list is empty, returns NULL. - Leaves cursor pointing at the tail item, or NULL if the list is empty. - - - - - Returns the value of the item at the cursor, or NULL if the cursor is - not pointing to an item. - - - - - Returns the handle of the item at the cursor, or NULL if the cursor is - not pointing to an item. - - - - - Returns the item associated with the given list handle, or NULL if passed - in handle is NULL. Asserts that the passed in handle points to a list element. - - - - - - Find an item in the list, searching from the start. Uses the item - comparator, if any, else compares item values directly. Returns the - item handle found, or NULL. Sets the cursor to the found item, if any. - - - - - - Detach an item from the list, using its handle. The item is not modified, - and the caller is responsible for destroying it if necessary. If handle is - null, detaches the first item on the list. Returns item that was detached, - or null if none was. If cursor was at item, moves cursor to previous item, - so you can detach items while iterating forwards through a list. - - - - - - Detach item at the cursor, if any, from the list. The item is not modified, - and the caller is responsible for destroying it as necessary. Returns item - that was detached, or null if none was. Moves cursor to previous item, so - you can detach items while iterating forwards through a list. - - - - - Delete an item, using its handle. Calls the item destructor is any is - set. If handle is null, deletes the first item on the list. Returns 0 - if an item was deleted, -1 if not. If cursor was at item, moves cursor - to previous item, so you can delete items while iterating forwards - through a list. - - - - - - Move an item to the start of the list, via its handle. - - - - - Move an item to the end of the list, via its handle. - - - - - Remove all items from the list, and destroy them if the item destructor - is set. - - - - Sort the list. If an item comparator was set, calls that to compare - items, otherwise compares on item value. The sort is not stable, so may - reorder equal items. - - - - Create a new node and insert it into a sorted list. Calls the item - duplicator, if any, on the item. If low_value is true, starts searching - from the start of the list, otherwise searches from the end. Use the item - comparator, if any, to find where to place the new node. Returns a handle - to the new node, or NULL if memory was exhausted. Resets the cursor to the - list head. - - - - - - - Move an item, specified by handle, into position in a sorted list. Uses - the item comparator, if any, to determine the new location. If low_value - is true, starts searching from the start of the list, otherwise searches - from the end. - - - - - - Make a copy of the list; items are duplicated if you set a duplicator - for the list, otherwise not. Copying a null reference returns a null - reference. - - - - - Set a user-defined deallocator for list items; by default items are not - freed when the list is destroyed. - - - - - Set a user-defined duplicator for list items; by default items are not - copied when the list is duplicated. - - - - - Set a user-defined comparator for zlistx_find and zlistx_sort; the method - must return -1, 0, or 1 depending on whether item1 is less than, equal to, - or greater than, item2. - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api deleted file mode 100644 index 429e3b517a..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api +++ /dev/null @@ -1,176 +0,0 @@ - - - event-driven reactor - - - Callback function for reactor socket activity - - - - - - - - Callback function for reactor events (low-level) - - - - - - - - Callback for reactor timer events - - - - - - - - Create a new zloop reactor - - - - Destroy a reactor - - - - Register socket reader with the reactor. When the reader has messages, - the reactor will call the handler, passing the arg. Returns 0 if OK, -1 - if there was an error. If you register the same socket more than once, - each instance will invoke its corresponding handler. - - - - - - - - Cancel a socket reader from the reactor. If multiple readers exist for - same socket, cancels ALL of them. - - - - - Configure a registered reader to ignore errors. If you do not set this, - then readers that have errors are removed from the reactor silently. - - - - - Register low-level libzmq pollitem with the reactor. When the pollitem - is ready, will call the handler, passing the arg. Returns 0 if OK, -1 - if there was an error. If you register the pollitem more than once, each - instance will invoke its corresponding handler. A pollitem with - socket=NULL and fd=0 means 'poll on FD zero'. - - - - - - - - Cancel a pollitem from the reactor, specified by socket or FD. If both - are specified, uses only socket. If multiple poll items exist for same - socket/FD, cancels ALL of them. - - - - - Configure a registered poller to ignore errors. If you do not set this, - then poller that have errors are removed from the reactor silently. - - - - - Register a timer that expires after some delay and repeats some number of - times. At each expiry, will call the handler, passing the arg. To run a - timer forever, use 0 times. Returns a timer_id that is used to cancel the - timer in the future. Returns -1 if there was an error. - - - - - - - - - Cancel a specific timer identified by a specific timer_id (as returned by - zloop_timer). - - - - - - Register a ticket timer. Ticket timers are very fast in the case where - you use a lot of timers (thousands), and frequently remove and add them. - The main use case is expiry timers for servers that handle many clients, - and which reset the expiry timer for each message received from a client. - Whereas normal timers perform poorly as the number of clients grows, the - cost of ticket timers is constant, no matter the number of clients. You - must set the ticket delay using zloop_set_ticket_delay before creating a - ticket. Returns a handle to the timer that you should use in - zloop_ticket_reset and zloop_ticket_delete. - - - - - - - Reset a ticket timer, which moves it to the end of the ticket list and - resets its execution time. This is a very fast operation. - - - - - Delete a ticket timer. We do not actually delete the ticket here, as - other code may still refer to the ticket. We mark as deleted, and remove - later and safely. - - - - - Set the ticket delay, which applies to all tickets. If you lower the - delay and there are already tickets created, the results are undefined. - - - - - Set hard limit on number of timers allowed. Setting more than a small - number of timers (10-100) can have a dramatic impact on the performance - of the reactor. For high-volume cases, use ticket timers. If the hard - limit is reached, the reactor stops creating new timers and logs an - error. - - - - - Set verbose tracing of reactor on/off. The default verbose setting is - off (false). - - - - - By default the reactor stops if the process receives a SIGINT or SIGTERM - signal. This makes it impossible to shut-down message based architectures - like zactors. This method lets you switch off break handling. The default - nonstop setting is off (false). - - - - - Start the reactor. Takes control of the thread and returns when the 0MQ - context is terminated or the process is interrupted, or any event handler - returns -1. Event handlers may register new sockets and timers, and - cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api deleted file mode 100644 index 6205fd02e3..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api +++ /dev/null @@ -1,250 +0,0 @@ - - - working with multipart messages - - - Create a new empty message object - - - - Destroy a message object and all frames it contains - - - - Receive message from socket, returns zmsg_t object or NULL if the recv - was interrupted. Does a blocking recv. If you want to not block then use - the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input - before receiving. - - - - - Send message to destination socket, and destroy the message after sending - it successfully. If the message has no frames, sends nothing but destroys - the message anyhow. Nullifies the caller's reference to the message (as - it is a destructor). - - - - - - - Send message to destination socket as part of a multipart sequence, and - destroy the message after sending it successfully. Note that after a - zmsg_sendm, you must call zmsg_send or another method that sends a final - message part. If the message has no frames, sends nothing but destroys - the message anyhow. Nullifies the caller's reference to the message (as - it is a destructor). - - - - - - - Return size of message, i.e. number of frames (0 or more). - - - - - Return total size of all frames in message. - - - - - Return message routing ID, if the message came from a ZMQ_SERVER socket. - Else returns zero. - - - - - Set routing ID on message. This is used if/when the message is sent to a - ZMQ_SERVER socket. - - - - - Push frame to the front of the message, i.e. before all other frames. - Message takes ownership of frame, will destroy it when message is sent. - Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not - nullify the caller's frame reference. - - - - - - Add frame to the end of the message, i.e. after all other frames. - Message takes ownership of frame, will destroy it when message is sent. - Returns 0 on success. Deprecates zmsg_add, which did not nullify the - caller's frame reference. - - - - - - Remove first frame from message, if any. Returns frame, or NULL. - - - - - Push block of memory to front of message, as a new frame. - Returns 0 on success, -1 on error. - - - - - - - Add block of memory to the end of the message, as a new frame. - Returns 0 on success, -1 on error. - - - - - - - Push string as new frame to front of message. - Returns 0 on success, -1 on error. - - - - - - Push string as new frame to end of message. - Returns 0 on success, -1 on error. - - - - - - Push formatted string as new frame to front of message. - Returns 0 on success, -1 on error. - - - - - - Push formatted string as new frame to end of message. - Returns 0 on success, -1 on error. - - - - - - Pop frame off front of message, return as fresh string. If there were - no more frames in the message, returns NULL. - - - - - Push encoded message as a new frame. Message takes ownership of - submessage, so the original is destroyed in this call. Returns 0 on - success, -1 on error. - - - - - - Remove first submessage from message, if any. Returns zmsg_t, or NULL if - decoding was not successful. - - - - - Remove specified frame from list, if present. Does not destroy frame. - - - - - Set cursor to first frame in message. Returns frame, or NULL, if the - message is empty. Use this to navigate the frames as a list. - - - - - Return the next frame. If there are no more frames, returns NULL. To move - to the first frame call zmsg_first(). Advances the cursor. - - - - - Return the last frame. If there are no frames, returns NULL. - - - - - Save message to an open file, return 0 if OK, else -1. The message is - saved as a series of frames, each with length and data. Note that the - file is NOT guaranteed to be portable between operating systems, not - versions of CZMQ. The file format is at present undocumented and liable - to arbitrary change. - - - - - - Load/append an open file into new message, return the message. - Returns NULL if the message could not be loaded. - - - - - Serialize multipart message to a single message frame. Use this method - to send structured messages across transports that do not support - multipart data. Allocates and returns a new frame containing the - serialized message. To decode a serialized message frame, use - zmsg_decode (). - - - - - Decodes a serialized message frame created by zmsg_encode () and returns - a new zmsg_t object. Returns NULL if the frame was badly formatted or - there was insufficient memory to work. - - - - - Create copy of message, as new message object. Returns a fresh zmsg_t - object. If message is null, or memory was exhausted, returns null. - - - - - Send message to zsys log sink (may be stdout, or system facility as - configured by zsys_set_logstream). - - - - Return true if the two messages have the same number of frames and each - frame in the first message is identical to the corresponding frame in the - other message. As with zframe_eq, return false if either message is NULL. - - - - - - Generate a signal message encoding the given status. A signal is a short - message carrying a 1-byte success/failure code (by convention, 0 means - OK). Signals are encoded to be distinguishable from "normal" messages. - - - - - Return signal value, 0 or greater, if message is a signal, -1 if not. - - - - - Probe the supplied object, and report if it looks like a zmsg_t. - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api deleted file mode 100644 index fc00f6a075..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api +++ /dev/null @@ -1,71 +0,0 @@ - - - event-driven reactor - - - Create new poller, specifying zero or more readers. The list of - readers ends in a NULL. Each reader can be a zsock_t instance, a - zactor_t instance, a libzmq socket (void *), or a file handle. - - - - - Destroy a poller - - - - Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may - be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. - - - - - - Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader - must have been passed during construction, or in an zpoller_add () call. - - - - - - By default the poller stops if the process receives a SIGINT or SIGTERM - signal. This makes it impossible to shut-down message based architectures - like zactors. This method lets you switch off break handling. The default - nonstop setting is off (false). - - - - - Poll the registered readers for I/O, return first reader that has input. - The reader will be a libzmq void * socket, or a zsock_t or zactor_t - instance as specified in zpoller_new/zpoller_add. The timeout should be - zero or greater, or -1 to wait indefinitely. Socket priority is defined - by their order in the poll list. If you need a balanced poll, use the low - level zmq_poll method directly. If the poll call was interrupted (SIGINT), - or the ZMQ context was destroyed, or the timeout expired, returns NULL. - You can test the actual exit condition by calling zpoller_expired () and - zpoller_terminated (). The timeout is in msec. - - - - - - Return true if the last zpoller_wait () call ended because the timeout - expired, without any error. - - - - - Return true if the last zpoller_wait () call ended because the process - was interrupted, or the parent context was destroyed. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api deleted file mode 100644 index 52c1c9123b..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api +++ /dev/null @@ -1,139 +0,0 @@ - - - process configuration and status - - - Returns CZMQ version as a single 6-digit integer encoding the major - version (x 10000), the minor version (x 100) and the patch. - - - - - Returns true if the process received a SIGINT or SIGTERM signal. - It is good practice to use this method to exit any infinite loop - processing messages. - - - - - Returns true if the underlying libzmq supports CURVE security. - - - - - Return current host name, for use in public tcp:// endpoints. - If the host name is not resolvable, returns NULL. - - - - - Move the current process into the background. The precise effect - depends on the operating system. On POSIX boxes, moves to a specified - working directory (if specified), closes all file handles, reopens - stdin, stdout, and stderr to the null device, and sets the process to - ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there - was an error. - - - - - Drop the process ID into the lockfile, with exclusive lock, and - switch the process to the specified group and/or user. Any of the - arguments may be null, indicating a no-op. Returns 0 on success, - -1 on failure. Note if you combine this with zsys_daemonize, run - after, not before that method, or the lockfile will hold the wrong - process ID. - - - - - - - Configure the number of I/O threads that ZeroMQ will use. A good - rule of thumb is one thread per gigabit of traffic in or out. The - default is 1, sufficient for most applications. If the environment - variable ZSYS_IO_THREADS is defined, that provides the default. - Note that this method is valid only before any socket is created. - - - - - Configure the number of sockets that ZeroMQ will allow. The default - is 1024. The actual limit depends on the system, and you can query it - by using zsys_socket_limit (). A value of zero means "maximum". - Note that this method is valid only before any socket is created. - - - - - Set network interface name to use for broadcasts, particularly zbeacon. - This lets the interface be configured for test environments where required. - For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is - the default when there is no specified interface. If the environment - variable ZSYS_INTERFACE is set, use that as the default interface name. - Setting the interface to "*" means "use all available interfaces". - - - - - Return network interface to use for broadcasts, or "" if none was set. - - - - - Set log identity, which is a string that prefixes all log messages sent - by this process. The log identity defaults to the environment variable - ZSYS_LOGIDENT, if that is set. - - - - - Sends log output to a PUB socket bound to the specified endpoint. To - collect such log output, create a SUB socket, subscribe to the traffic - you care about, and connect to the endpoint. Log traffic is sent as a - single string frame, in the same format as when sent to stdout. The - log system supports a single sender; multiple calls to this method will - bind the same sender to multiple endpoints. To disable the sender, call - this method with a null argument. - - - - - Enable or disable logging to the system facility (syslog on POSIX boxes, - event log on Windows). By default this is disabled. - - - - - Log error condition - highest priority - - - - - Log warning condition - high priority - - - - - Log normal, but significant, condition - normal priority - - - - - Log informational message - low priority - - - - - Log debug-level message - lowest priority - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api deleted file mode 100644 index 26b15cf509..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api +++ /dev/null @@ -1,406 +0,0 @@ - - - high-level socket API that hides libzmq contexts and sockets - - - Create a new socket. Returns the new socket, or NULL if the new socket - could not be created. Note that the symbol zsock_new (and other - constructors/destructors for zsock) are redirected to the *_checked - variant, enabling intelligent socket leak detection. This can have - performance implications if you use a LOT of sockets. To turn off this - redirection behaviour, define ZSOCK_NOCHECK. - - - - - - - - - - - - - - - - - - - - - - - - - - Destroy the socket. You must use this for any socket created via the - zsock_new method. - - - - Create a PUB socket. Default action is bind. - - - - - Create a SUB socket, and optionally subscribe to some prefix string. Default - action is connect. - - - - - - Create a REQ socket. Default action is connect. - - - - - Create a REP socket. Default action is bind. - - - - - Create a DEALER socket. Default action is connect. - - - - - Create a ROUTER socket. Default action is bind. - - - - - Create a PUSH socket. Default action is connect. - - - - - Create a PULL socket. Default action is bind. - - - - - Create an XPUB socket. Default action is bind. - - - - - Create an XSUB socket. Default action is connect. - - - - - Create a PAIR socket. Default action is connect. - - - - - Create a STREAM socket. Default action is connect. - - - - - Create a SERVER socket. Default action is bind. - - - - - Create a CLIENT socket. Default action is connect. - - - - - Create a RADIO socket. Default action is bind. - - - - - Create a DISH socket. Default action is connect. - - - - - Create a GATHER socket. Default action is bind. - - - - - Create a SCATTER socket. Default action is connect. - - - - - Bind a socket to a formatted endpoint. For tcp:// endpoints, supports - ephemeral ports, if you specify the port number as "*". By default - zsock uses the IANA designated range from C000 (49152) to FFFF (65535). - To override this range, follow the "*" with "[first-last]". Either or - both first and last may be empty. To bind to a random port within the - range, use "!" in place of "*". - - Examples: - tcp://127.0.0.1:* bind to first free port from C000 up - tcp://127.0.0.1:! bind to random port from C000 to FFFF - tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up - tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 - tcp://127.0.0.1:![55000-55999] - bind to random port from 55000 to 55999 - - On success, returns the actual port number used, for tcp:// endpoints, - and 0 for other transports. On failure, returns -1. Note that when using - ephemeral ports, a port may be reused by different services without - clients being aware. Protocols that run on ephemeral ports should take - this into account. - - - - - - Returns last bound endpoint, if any. - - - - - Unbind a socket from a formatted endpoint. - Returns 0 if OK, -1 if the endpoint was invalid or the function - isn't supported. - - - - - - Connect a socket to a formatted endpoint - Returns 0 if OK, -1 if the endpoint was invalid. - - - - - - Disconnect a socket from a formatted endpoint - Returns 0 if OK, -1 if the endpoint was invalid or the function - isn't supported. - - - - - - Attach a socket to zero or more endpoints. If endpoints is not null, - parses as list of ZeroMQ endpoints, separated by commas, and prefixed by - '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all - endpoints were valid, or -1 if there was a syntax error. If the endpoint - does not start with '@' or '>', the serverish argument defines whether - it is used to bind (serverish = true) or connect (serverish = false). - - - - - - - Returns socket type as printable constant string. - - - - - Send a 'picture' message to the socket (or actor). The picture is a - string that defines the type of each frame. This makes it easy to send - a complex multiframe message in one call. The picture can contain any - of these characters, each corresponding to one or two arguments: - - i = int (signed) - 1 = uint8_t - 2 = uint16_t - 4 = uint32_t - 8 = uint64_t - s = char * - b = byte *, size_t (2 arguments) - c = zchunk_t * - f = zframe_t * - h = zhashx_t * - U = zuuid_t * - p = void * (sends the pointer value, only meaningful over inproc) - m = zmsg_t * (sends all frames in the zmsg) - z = sends zero-sized frame (0 arguments) - u = uint (deprecated) - - Note that s, b, c, and f are encoded the same way and the choice is - offered as a convenience to the sender, which may or may not already - have data in a zchunk or zframe. Does not change or take ownership of - any arguments. Returns 0 if successful, -1 if sending failed for any - reason. - - - - - - Send a 'picture' message to the socket (or actor). This is a va_list - version of zsock_send (), so please consult its documentation for the - details. - - - - - - - Receive a 'picture' message to the socket (or actor). See zsock_send for - the format and meaning of the picture. Returns the picture elements into - a series of pointers as provided by the caller: - - i = int * (stores signed integer) - 4 = uint32_t * (stores 32-bit unsigned integer) - 8 = uint64_t * (stores 64-bit unsigned integer) - s = char ** (allocates new string) - b = byte **, size_t * (2 arguments) (allocates memory) - c = zchunk_t ** (creates zchunk) - f = zframe_t ** (creates zframe) - U = zuuid_t * (creates a zuuid with the data) - h = zhashx_t ** (creates zhashx) - p = void ** (stores pointer) - m = zmsg_t ** (creates a zmsg with the remaing frames) - z = null, asserts empty frame (0 arguments) - u = uint * (stores unsigned integer, deprecated) - - Note that zsock_recv creates the returned objects, and the caller must - destroy them when finished with them. The supplied pointers do not need - to be initialized. Returns 0 if successful, or -1 if it failed to recv - a message, in which case the pointers are not modified. When message - frames are truncated (a short message), sets return values to zero/null. - If an argument pointer is NULL, does not store any value (skips it). - An 'n' picture matches an empty frame; if the message does not match, - the method will return -1. - - - - - - Receive a 'picture' message from the socket (or actor). This is a - va_list version of zsock_recv (), so please consult its documentation - for the details. - - - - - - - Send a binary encoded 'picture' message to the socket (or actor). This - method is similar to zsock_send, except the arguments are encoded in a - binary format that is compatible with zproto, and is designed to reduce - memory allocations. The pattern argument is a string that defines the - type of each argument. Supports these argument types: - - pattern C type zproto type: - 1 uint8_t type = "number" size = "1" - 2 uint16_t type = "number" size = "2" - 4 uint32_t type = "number" size = "3" - 8 uint64_t type = "number" size = "4" - s char *, 0-255 chars type = "string" - S char *, 0-2^32-1 chars type = "longstr" - c zchunk_t * type = "chunk" - f zframe_t * type = "frame" - u zuuid_t * type = "uuid" - m zmsg_t * type = "msg" - p void *, sends pointer value, only over inproc - - Does not change or take ownership of any arguments. Returns 0 if - successful, -1 if sending failed for any reason. - - - - - - Receive a binary encoded 'picture' message from the socket (or actor). - This method is similar to zsock_recv, except the arguments are encoded - in a binary format that is compatible with zproto, and is designed to - reduce memory allocations. The pattern argument is a string that defines - the type of each argument. See zsock_bsend for the supported argument - types. All arguments must be pointers; this call sets them to point to - values held on a per-socket basis. - Note that zsock_brecv creates the returned objects, and the caller must - destroy them when finished with them. The supplied pointers do not need - to be initialized. Returns 0 if successful, or -1 if it failed to read - a message. - - - - - - Return socket routing ID if any. This returns 0 if the socket is not - of type ZMQ_SERVER or if no request was already received on it. - - - - - Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. - This will be used when sending messages on the socket via the zsock API. - - - - - Set socket to use unbounded pipes (HWM=0); use this in cases when you are - totally certain the message volume can fit in memory. This method works - across all versions of ZeroMQ. Takes a polymorphic socket reference. - - - - Send a signal over a socket. A signal is a short message carrying a - success/failure code (by convention, 0 means OK). Signals are encoded - to be distinguishable from "normal" messages. Accepts a zsock_t or a - zactor_t argument, and returns 0 if successful, -1 if the signal could - not be sent. Takes a polymorphic socket reference. - - - - - - Wait on a signal. Use this to coordinate between threads, over pipe - pairs. Blocks until the signal is received. Returns -1 on error, 0 or - greater on success. Accepts a zsock_t or a zactor_t as argument. - Takes a polymorphic socket reference. - - - - - If there is a partial message still waiting on the socket, remove and - discard it. This is useful when reading partial messages, to get specific - message types. - - - - Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. - Returns 0 if OK, -1 if failed. - - - - - - Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. - Returns 0 if OK, -1 if failed. - - - - - - Probe the supplied object, and report if it looks like a zsock_t. - Takes a polymorphic socket reference. - - - - - - Probe the supplied reference. If it looks like a zsock_t instance, return - the underlying libzmq socket handle; else if it looks like a file - descriptor, return NULL; else if it looks like a libzmq socket handle, - return the supplied value. Takes a polymorphic socket reference. - - - - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api deleted file mode 100644 index c5799b027e..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api +++ /dev/null @@ -1,797 +0,0 @@ - - - - - - Get socket option `heartbeat_ivl`. - Available from libzmq 4.2.0. - - - - - Set socket option `heartbeat_ivl`. - Available from libzmq 4.2.0. - - - - - Get socket option `heartbeat_ttl`. - Available from libzmq 4.2.0. - - - - - Set socket option `heartbeat_ttl`. - Available from libzmq 4.2.0. - - - - - Get socket option `heartbeat_timeout`. - Available from libzmq 4.2.0. - - - - - Set socket option `heartbeat_timeout`. - Available from libzmq 4.2.0. - - - - - Get socket option `use_fd`. - Available from libzmq 4.2.0. - - - - - Set socket option `use_fd`. - Available from libzmq 4.2.0. - - - - - Set socket option `xpub_manual`. - Available from libzmq 4.2.0. - - - - - Set socket option `xpub_welcome_msg`. - Available from libzmq 4.2.0. - - - - - Set socket option `stream_notify`. - Available from libzmq 4.2.0. - - - - - Get socket option `invert_matching`. - Available from libzmq 4.2.0. - - - - - Set socket option `invert_matching`. - Available from libzmq 4.2.0. - - - - - Set socket option `xpub_verboser`. - Available from libzmq 4.2.0. - - - - - Get socket option `connect_timeout`. - Available from libzmq 4.2.0. - - - - - Set socket option `connect_timeout`. - Available from libzmq 4.2.0. - - - - - Get socket option `tcp_maxrt`. - Available from libzmq 4.2.0. - - - - - Set socket option `tcp_maxrt`. - Available from libzmq 4.2.0. - - - - - Get socket option `thread_safe`. - Available from libzmq 4.2.0. - - - - - Get socket option `multicast_maxtpdu`. - Available from libzmq 4.2.0. - - - - - Set socket option `multicast_maxtpdu`. - Available from libzmq 4.2.0. - - - - - Get socket option `vmci_buffer_size`. - Available from libzmq 4.2.0. - - - - - Set socket option `vmci_buffer_size`. - Available from libzmq 4.2.0. - - - - - Get socket option `vmci_buffer_min_size`. - Available from libzmq 4.2.0. - - - - - Set socket option `vmci_buffer_min_size`. - Available from libzmq 4.2.0. - - - - - Get socket option `vmci_buffer_max_size`. - Available from libzmq 4.2.0. - - - - - Set socket option `vmci_buffer_max_size`. - Available from libzmq 4.2.0. - - - - - Get socket option `vmci_connect_timeout`. - Available from libzmq 4.2.0. - - - - - Set socket option `vmci_connect_timeout`. - Available from libzmq 4.2.0. - - - - - - - Get socket option `tos`. - Available from libzmq 4.1.0. - - - - - Set socket option `tos`. - Available from libzmq 4.1.0. - - - - - Set socket option `router_handover`. - Available from libzmq 4.1.0. - - - - - Set socket option `connect_rid`. - Available from libzmq 4.1.0. - - - - - Set socket option `connect_rid` from 32-octet binary - Available from libzmq 4.1.0. - - - - - Get socket option `handshake_ivl`. - Available from libzmq 4.1.0. - - - - - Set socket option `handshake_ivl`. - Available from libzmq 4.1.0. - - - - - Get socket option `socks_proxy`. - Available from libzmq 4.1.0. - - - - - Set socket option `socks_proxy`. - Available from libzmq 4.1.0. - - - - - Set socket option `xpub_nodrop`. - Available from libzmq 4.1.0. - - - - - - - Set socket option `router_mandatory`. - Available from libzmq 4.0.0. - - - - - Set socket option `probe_router`. - Available from libzmq 4.0.0. - - - - - Set socket option `req_relaxed`. - Available from libzmq 4.0.0. - - - - - Set socket option `req_correlate`. - Available from libzmq 4.0.0. - - - - - Set socket option `conflate`. - Available from libzmq 4.0.0. - - - - - Get socket option `zap_domain`. - Available from libzmq 4.0.0. - - - - - Set socket option `zap_domain`. - Available from libzmq 4.0.0. - - - - - Get socket option `mechanism`. - Available from libzmq 4.0.0. - - - - - Get socket option `plain_server`. - Available from libzmq 4.0.0. - - - - - Set socket option `plain_server`. - Available from libzmq 4.0.0. - - - - - Get socket option `plain_username`. - Available from libzmq 4.0.0. - - - - - Set socket option `plain_username`. - Available from libzmq 4.0.0. - - - - - Get socket option `plain_password`. - Available from libzmq 4.0.0. - - - - - Set socket option `plain_password`. - Available from libzmq 4.0.0. - - - - - Get socket option `curve_server`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_server`. - Available from libzmq 4.0.0. - - - - - Get socket option `curve_publickey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_publickey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_publickey` from 32-octet binary - Available from libzmq 4.0.0. - - - - - Get socket option `curve_secretkey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_secretkey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_secretkey` from 32-octet binary - Available from libzmq 4.0.0. - - - - - Get socket option `curve_serverkey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_serverkey`. - Available from libzmq 4.0.0. - - - - - Set socket option `curve_serverkey` from 32-octet binary - Available from libzmq 4.0.0. - - - - - Get socket option `gssapi_server`. - Available from libzmq 4.0.0. - - - - - Set socket option `gssapi_server`. - Available from libzmq 4.0.0. - - - - - Get socket option `gssapi_plaintext`. - Available from libzmq 4.0.0. - - - - - Set socket option `gssapi_plaintext`. - Available from libzmq 4.0.0. - - - - - Get socket option `gssapi_principal`. - Available from libzmq 4.0.0. - - - - - Set socket option `gssapi_principal`. - Available from libzmq 4.0.0. - - - - - Get socket option `gssapi_service_principal`. - Available from libzmq 4.0.0. - - - - - Set socket option `gssapi_service_principal`. - Available from libzmq 4.0.0. - - - - - Get socket option `ipv6`. - Available from libzmq 4.0.0. - - - - - Set socket option `ipv6`. - Available from libzmq 4.0.0. - - - - - Get socket option `immediate`. - Available from libzmq 4.0.0. - - - - - Set socket option `immediate`. - Available from libzmq 4.0.0. - - - - - - - Get socket option `type`. - Available from libzmq 3.0.0. - - - - - Get socket option `sndhwm`. - Available from libzmq 3.0.0. - - - - - Set socket option `sndhwm`. - Available from libzmq 3.0.0. - - - - - Get socket option `rcvhwm`. - Available from libzmq 3.0.0. - - - - - Set socket option `rcvhwm`. - Available from libzmq 3.0.0. - - - - - Get socket option `affinity`. - Available from libzmq 3.0.0. - - - - - Set socket option `affinity`. - Available from libzmq 3.0.0. - - - - - Set socket option `subscribe`. - Available from libzmq 3.0.0. - - - - - Set socket option `unsubscribe`. - Available from libzmq 3.0.0. - - - - - Get socket option `identity`. - Available from libzmq 3.0.0. - - - - - Set socket option `identity`. - Available from libzmq 3.0.0. - - - - - Get socket option `rate`. - Available from libzmq 3.0.0. - - - - - Set socket option `rate`. - Available from libzmq 3.0.0. - - - - - Get socket option `recovery_ivl`. - Available from libzmq 3.0.0. - - - - - Set socket option `recovery_ivl`. - Available from libzmq 3.0.0. - - - - - Get socket option `sndbuf`. - Available from libzmq 3.0.0. - - - - - Set socket option `sndbuf`. - Available from libzmq 3.0.0. - - - - - Get socket option `rcvbuf`. - Available from libzmq 3.0.0. - - - - - Set socket option `rcvbuf`. - Available from libzmq 3.0.0. - - - - - Get socket option `linger`. - Available from libzmq 3.0.0. - - - - - Set socket option `linger`. - Available from libzmq 3.0.0. - - - - - Get socket option `reconnect_ivl`. - Available from libzmq 3.0.0. - - - - - Set socket option `reconnect_ivl`. - Available from libzmq 3.0.0. - - - - - Get socket option `reconnect_ivl_max`. - Available from libzmq 3.0.0. - - - - - Set socket option `reconnect_ivl_max`. - Available from libzmq 3.0.0. - - - - - Get socket option `backlog`. - Available from libzmq 3.0.0. - - - - - Set socket option `backlog`. - Available from libzmq 3.0.0. - - - - - Get socket option `maxmsgsize`. - Available from libzmq 3.0.0. - - - - - Set socket option `maxmsgsize`. - Available from libzmq 3.0.0. - - - - - Get socket option `multicast_hops`. - Available from libzmq 3.0.0. - - - - - Set socket option `multicast_hops`. - Available from libzmq 3.0.0. - - - - - Get socket option `rcvtimeo`. - Available from libzmq 3.0.0. - - - - - Set socket option `rcvtimeo`. - Available from libzmq 3.0.0. - - - - - Get socket option `sndtimeo`. - Available from libzmq 3.0.0. - - - - - Set socket option `sndtimeo`. - Available from libzmq 3.0.0. - - - - - Set socket option `xpub_verbose`. - Available from libzmq 3.0.0. - - - - - Get socket option `tcp_keepalive`. - Available from libzmq 3.0.0. - - - - - Set socket option `tcp_keepalive`. - Available from libzmq 3.0.0. - - - - - Get socket option `tcp_keepalive_idle`. - Available from libzmq 3.0.0. - - - - - Set socket option `tcp_keepalive_idle`. - Available from libzmq 3.0.0. - - - - - Get socket option `tcp_keepalive_cnt`. - Available from libzmq 3.0.0. - - - - - Set socket option `tcp_keepalive_cnt`. - Available from libzmq 3.0.0. - - - - - Get socket option `tcp_keepalive_intvl`. - Available from libzmq 3.0.0. - - - - - Set socket option `tcp_keepalive_intvl`. - Available from libzmq 3.0.0. - - - - - Get socket option `tcp_accept_filter`. - Available from libzmq 3.0.0. - - - - - Set socket option `tcp_accept_filter`. - Available from libzmq 3.0.0. - - - - - Get socket option `rcvmore`. - Available from libzmq 3.0.0. - - - - - Get socket option `fd`. - Available from libzmq 3.0.0. - - - - - Get socket option `events`. - Available from libzmq 3.0.0. - - - - - Get socket option `last_endpoint`. - Available from libzmq 3.0.0. - - - - - Set socket option `router_raw`. - Available from libzmq 3.0.0. - - - - - Get socket option `ipv4only`. - Available from libzmq 3.0.0. - - - - - Set socket option `ipv4only`. - Available from libzmq 3.0.0. - - - - - Set socket option `delay_attach_on_connect`. - Available from libzmq 3.0.0. - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api deleted file mode 100644 index b4c951e720..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api +++ /dev/null @@ -1,90 +0,0 @@ - - - sending and receiving strings - - - Receive C string from socket. Caller must free returned string using - zstr_free(). Returns NULL if the context is being terminated or the - process was interrupted. - - - - - - Receive a series of strings (until NULL) from multipart data. - Each string is allocated and filled with string data; if there - are not enough frames, unallocated strings are set to NULL. - Returns -1 if the message could not be read, else returns the - number of strings filled, zero or more. Free each returned string - using zstr_free(). If not enough strings are provided, remaining - multipart frames in the message are dropped. - - - - - - - Send a C string to a socket, as a frame. The string is sent without - trailing null byte; to read this you can use zstr_recv, or a similar - method that adds a null terminator on the received string. String - may be NULL, which is sent as "". - - - - - - - Send a C string to a socket, as zstr_send(), with a MORE flag, so that - you can send further strings in the same multi-part message. - - - - - - - Send a formatted string to a socket. Note that you should NOT use - user-supplied strings in the format (they may contain '%' which - will create security holes). - - - - - - - Send a formatted string to a socket, as for zstr_sendf(), with a - MORE flag, so that you can send further strings in the same multi-part - message. - - - - - - - Send a series of strings (until NULL) as multipart data - Returns 0 if the strings could be sent OK, or -1 on error. - - - - - - - Accepts a void pointer and returns a fresh character string. If source - is null, returns an empty string. - - - - - - Free a provided string, and nullify the parent pointer. Safe to call on - a null pointer. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api deleted file mode 100644 index 20d3ca71ad..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api +++ /dev/null @@ -1,69 +0,0 @@ - - - timer set - - - Create new timer set. - - - - Destroy a timer set - - - - Callback function for timer event. - - - - - - Add a timer to the set. Returns timer id if OK, -1 on failure. - - - - - - - - Cancel a timer. Returns 0 if OK, -1 on failure. - - - - - - Set timer interval. Returns 0 if OK, -1 on failure. - This method is slow, canceling the timer and adding a new one yield better performance. - - - - - - - Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. - This method is slow, canceling the timer and adding a new one yield better performance. - - - - - - Return the time until the next interval. - Should be used as timeout parameter for the zpoller wait method. - The timeout is in msec. - - - - - Invoke callback function of all timers which their interval has elapsed. - Should be call after zpoller wait method. - Returns 0 if OK, -1 on failure. - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api deleted file mode 100644 index 01fc3a4131..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api +++ /dev/null @@ -1,80 +0,0 @@ - - - simple trie for tokenizable strings - - - Callback function for ztrie_node to destroy node data. - - - - - Creates a new ztrie. - - - - - Destroy the ztrie. - - - - Inserts a new route into the tree and attaches the data. Returns -1 - if the route already exists, otherwise 0. This method takes ownership of - the provided data if a destroy_data_fn is provided. - - - - - - - - Removes a route from the trie and destroys its data. Returns -1 if the - route does not exists, otherwise 0. - the start of the list call zlist_first (). Advances the cursor. - - - - - - Returns true if the path matches a route in the tree, otherwise false. - - - - - - Returns the data of a matched route from last ztrie_matches. If the path - did not match, returns NULL. Do not delete the data as it's owned by - ztrie. - - - - - Returns the count of parameters that a matched route has. - - - - - Returns the parameters of a matched route with named regexes from last - ztrie_matches. If the path did not match or the route did not contain any - named regexes, returns NULL. - - - - - Returns the asterisk matched part of a route, if there has been no match - or no asterisk match, returns NULL. - - - - - Print the trie - - - diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api deleted file mode 100644 index 1fdb9c4e06..0000000000 --- a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api +++ /dev/null @@ -1,82 +0,0 @@ - - - UUID support class - - - Create a new UUID object. - - - - Destroy a specified UUID object. - - - - Create UUID object from supplied ZUUID_LEN-octet value. - - - - - Set UUID to new supplied ZUUID_LEN-octet value. - - - - - Set UUID to new supplied string value skipping '-' and '{' '}' - optional delimiters. Return 0 if OK, else returns -1. - - - - - - Return UUID binary data. - - - - - Return UUID binary size - - - - - Returns UUID as string - - - - - Return UUID in the canonical string format: 8-4-4-4-12, in lower - case. Caller does not modify or free returned value. See - http://en.wikipedia.org/wiki/Universally_unique_identifier - - - - - Store UUID blob in target array - - - - - Check if UUID is same as supplied value - - - - - - Check if UUID is different from supplied value - - - - - - Make copy of UUID object; if uuid is null, or memory was exhausted, - returns null. - - - diff --git a/phonelibs/zmq/aarch64/include/czmq.h b/phonelibs/zmq/aarch64/include/czmq.h deleted file mode 100644 index ba21aa3bd1..0000000000 --- a/phonelibs/zmq/aarch64/include/czmq.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/phonelibs/zmq/aarch64/include/czmq_library.h b/phonelibs/zmq/aarch64/include/czmq_library.h deleted file mode 100644 index be348db3e9..0000000000 --- a/phonelibs/zmq/aarch64/include/czmq_library.h +++ /dev/null @@ -1,199 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 3 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 3 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -#else -# define CZMQ_EXPORT -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -typedef struct _zauth_v2_t zauth_v2_t; -#define ZAUTH_V2_T_DEFINED -typedef struct _zbeacon_v2_t zbeacon_v2_t; -#define ZBEACON_V2_T_DEFINED -typedef struct _zctx_t zctx_t; -#define ZCTX_T_DEFINED -typedef struct _zmonitor_v2_t zmonitor_v2_t; -#define ZMONITOR_V2_T_DEFINED -typedef struct _zmutex_t zmutex_t; -#define ZMUTEX_T_DEFINED -typedef struct _zproxy_v2_t zproxy_v2_t; -#define ZPROXY_V2_T_DEFINED -typedef struct _zsocket_t zsocket_t; -#define ZSOCKET_T_DEFINED -typedef struct _zsockopt_t zsockopt_t; -#define ZSOCKOPT_T_DEFINED -typedef struct _zthread_t zthread_t; -#define ZTHREAD_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#include "zauth_v2.h" -#include "zbeacon_v2.h" -#include "zctx.h" -#include "zmonitor_v2.h" -#include "zmutex.h" -#include "zproxy_v2.h" -#include "zsocket.h" -#include "zsockopt.h" -#include "zthread.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/phonelibs/zmq/aarch64/include/czmq_prelude.h b/phonelibs/zmq/aarch64/include/czmq_prelude.h deleted file mode 100644 index e9ceb691e8..0000000000 --- a/phonelibs/zmq/aarch64/include/czmq_prelude.h +++ /dev/null @@ -1,641 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SRV4)) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0)) -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined _ZMALLOC_DEBUG || _ZMALLOC_PEDANTIC -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zactor.h b/phonelibs/zmq/aarch64/include/zactor.h deleted file mode 100644 index c865c65daf..0000000000 --- a/phonelibs/zmq/aarch64/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zarmour.h b/phonelibs/zmq/aarch64/include/zarmour.h deleted file mode 100644 index c7f299f7af..0000000000 --- a/phonelibs/zmq/aarch64/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zauth.h b/phonelibs/zmq/aarch64/include/zauth.h deleted file mode 100644 index ca6bb913c8..0000000000 --- a/phonelibs/zmq/aarch64/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or nmore addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zauth_v2.h b/phonelibs/zmq/aarch64/include/zauth_v2.h deleted file mode 100644 index bbbee86b03..0000000000 --- a/phonelibs/zmq/aarch64/include/zauth_v2.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ========================================================================= - zauth_v2 - authentication for ZeroMQ servers (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_V2_H_INCLUDED__ -#define __ZAUTH_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#ifndef CURVE_ALLOW_ANY -# define CURVE_ALLOW_ANY "*" -#endif - -// Constructor -// Install authentication for the specified context. Returns a new zauth -// object that you can use to configure authentication. Note that until you -// add policies, all incoming NULL connections are allowed (classic ZeroMQ -// behaviour), and all PLAIN and CURVE connections are denied. If there was -// an error during initialization, returns NULL. -CZMQ_EXPORT zauth_t * - zauth_new (zctx_t *ctx); - -// Destructor -CZMQ_EXPORT void - zauth_destroy (zauth_t **self_p); - -// Allow (whitelist) a single IP address. For NULL, all clients from this -// address will be accepted. For PLAIN and CURVE, they will be allowed to -// continue with authentication. You can call this method multiple times -// to whitelist multiple IP addresses. If you whitelist a single address, -// any non-whitelisted addresses are treated as blacklisted. -CZMQ_EXPORT void - zauth_allow (zauth_t *self, const char *address); - -// Deny (blacklist) a single IP address. For all security mechanisms, this -// rejects the connection without any further authentication. Use either a -// whitelist, or a blacklist, not not both. If you define both a whitelist -// and a blacklist, only the whitelist takes effect. -CZMQ_EXPORT void - zauth_deny (zauth_t *self, const char *address); - -// Configure PLAIN authentication for a given domain. PLAIN authentication -// uses a plain-text password file. To cover all domains, use "*". You can -// modify the password file at any time; it is reloaded automatically. -CZMQ_EXPORT void - zauth_configure_plain (zauth_t *self, const char *domain, const char *filename); - -// Configure CURVE authentication for a given domain. CURVE authentication -// uses a directory that holds all public client certificates, i.e. their -// public keys. The certificates must be in zcert_save () format. To cover -// all domains, use "*". You can add and remove certificates in that -// directory at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the location. -CZMQ_EXPORT void - zauth_configure_curve (zauth_t *self, const char *domain, const char *location); - -// Configure GSSAPI authentication for a given domain. GSSAPI authentication -// uses an underlying mechanism (usually Kerberos) to establish a secure -// context and perform mutual authentication. To cover all domains, use "*". -CZMQ_EXPORT void - zauth_configure_gssapi (zauth_t *self, char *domain); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zauth_set_verbose (zauth_t *self, bool verbose); - -// Selftest -CZMQ_EXPORT void - zauth_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zbeacon.h b/phonelibs/zmq/aarch64/include/zbeacon.h deleted file mode 100644 index 78917e9577..0000000000 --- a/phonelibs/zmq/aarch64/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zbeacon_v2.h b/phonelibs/zmq/aarch64/include/zbeacon_v2.h deleted file mode 100644 index 8e8f3b4cde..0000000000 --- a/phonelibs/zmq/aarch64/include/zbeacon_v2.h +++ /dev/null @@ -1,75 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_V2_H_INCLUDED__ -#define __ZBEACON_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create a new beacon on a certain UDP port. If the system does not -// support UDP broadcasts (lacking a useful interface), returns NULL. -// To force the beacon to operate on a given port, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand. -// If you are using the new zsock API then pass NULL as the ctx here. -CZMQ_EXPORT zbeacon_t * - zbeacon_new (zctx_t *ctx, int port_nbr); - -// Destroy a beacon -CZMQ_EXPORT void - zbeacon_destroy (zbeacon_t **self_p); - -// Return our own IP address as printable string -CZMQ_EXPORT char * - zbeacon_hostname (zbeacon_t *self); - -// Set broadcast interval in milliseconds (default is 1000 msec) -CZMQ_EXPORT void - zbeacon_set_interval (zbeacon_t *self, int interval); - -// Filter out any beacon that looks exactly like ours -CZMQ_EXPORT void - zbeacon_noecho (zbeacon_t *self); - -// Start broadcasting beacon to peers at the specified interval -CZMQ_EXPORT void - zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size); - -// Stop broadcasting beacons -CZMQ_EXPORT void - zbeacon_silence (zbeacon_t *self); - -// Start listening to other peers; zero-sized filter means get everything -CZMQ_EXPORT void - zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size); - -// Stop listening to other peers -CZMQ_EXPORT void - zbeacon_unsubscribe (zbeacon_t *self); - -// Get beacon ZeroMQ socket, for polling or receiving messages -CZMQ_EXPORT void * - zbeacon_socket (zbeacon_t *self); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zcert.h b/phonelibs/zmq/aarch64/include/zcert.h deleted file mode 100644 index 495b579cda..0000000000 --- a/phonelibs/zmq/aarch64/include/zcert.h +++ /dev/null @@ -1,139 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Print certificate contents to open stream. This method is deprecated -// and you should use the print method. -CZMQ_EXPORT void - zcert_fprint (zcert_t *self, FILE *file); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/phonelibs/zmq/aarch64/include/zcertstore.h b/phonelibs/zmq/aarch64/include/zcertstore.h deleted file mode 100644 index c7f93c5a7d..0000000000 --- a/phonelibs/zmq/aarch64/include/zcertstore.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Print list of certificates in store to open stream. This method is -// deprecated, and you should use the print method. -CZMQ_EXPORT void - zcertstore_fprint (zcertstore_t *self, FILE *file); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/phonelibs/zmq/aarch64/include/zchunk.h b/phonelibs/zmq/aarch64/include/zchunk.h deleted file mode 100644 index 56f29b161a..0000000000 --- a/phonelibs/zmq/aarch64/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/aarch64/include/zclock.h b/phonelibs/zmq/aarch64/include/zclock.h deleted file mode 100644 index eb064162c4..0000000000 --- a/phonelibs/zmq/aarch64/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zconfig.h b/phonelibs/zmq/aarch64/include/zconfig.h deleted file mode 100644 index 4ec4e1c81f..0000000000 --- a/phonelibs/zmq/aarch64/include/zconfig.h +++ /dev/null @@ -1,194 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @ignore -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/phonelibs/zmq/aarch64/include/zctx.h b/phonelibs/zmq/aarch64/include/zctx.h deleted file mode 100644 index 88898410dc..0000000000 --- a/phonelibs/zmq/aarch64/include/zctx.h +++ /dev/null @@ -1,107 +0,0 @@ -/* ========================================================================= - zctx - working with 0MQ contexts - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCTX_H_INCLUDED__ -#define __ZCTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @interface -// Create new context, returns context object, replaces zmq_init -CZMQ_EXPORT zctx_t * - zctx_new (void); - -// Destroy context and all sockets in it, replaces zmq_term -CZMQ_EXPORT void - zctx_destroy (zctx_t **self_p); - -// Create new shadow context, returns context object -CZMQ_EXPORT zctx_t * - zctx_shadow (zctx_t *self); -// @end - -// Create a new context by shadowing a plain zmq context -CZMQ_EXPORT zctx_t * -zctx_shadow_zmq_ctx (void *zmqctx); - -// @interface -// Raise default I/O threads from 1, for crazy heavy applications -// The rule of thumb is one I/O thread per gigabyte of traffic in -// or out. Call this method before creating any sockets on the context, -// or calling zctx_shadow, or the setting will have no effect. -CZMQ_EXPORT void - zctx_set_iothreads (zctx_t *self, int iothreads); - -// Set msecs to flush sockets when closing them, see the ZMQ_LINGER -// man page section for more details. By default, set to zero, so -// any in-transit messages are discarded when you destroy a socket or -// a context. -CZMQ_EXPORT void - zctx_set_linger (zctx_t *self, int linger); - -// Set initial high-water mark for inter-thread pipe sockets. Note that -// this setting is separate from the default for normal sockets. You -// should change the default for pipe sockets *with care*. Too low values -// will cause blocked threads, and an infinite setting can cause memory -// exhaustion. The default, no matter the underlying ZeroMQ version, is -// 1,000. -CZMQ_EXPORT void - zctx_set_pipehwm (zctx_t *self, int pipehwm); - -// Set initial send HWM for all new normal sockets created in context. -// You can set this per-socket after the socket is created. -// The default, no matter the underlying ZeroMQ version, is 1,000. -CZMQ_EXPORT void - zctx_set_sndhwm (zctx_t *self, int sndhwm); - -// Set initial receive HWM for all new normal sockets created in context. -// You can set this per-socket after the socket is created. -// The default, no matter the underlying ZeroMQ version, is 1,000. -CZMQ_EXPORT void - zctx_set_rcvhwm (zctx_t *self, int rcvhwm); - -// Return low-level 0MQ context object, will be NULL before first socket -// is created. Use with care. -CZMQ_EXPORT void * - zctx_underlying (zctx_t *self); - -// Self test of this class -CZMQ_EXPORT void - zctx_test (bool verbose); -// @end - -// Create socket within this context, for CZMQ use only -void * - zctx__socket_new (zctx_t *self, int type); - -// Create pipe socket within this context, for CZMQ use only -void * - zctx__socket_pipe (zctx_t *self); - -// Destroy socket within this context, for CZMQ use only -void - zctx__socket_destroy (zctx_t *self, void *socket); - -// Initialize the low-level 0MQ context object, for CZMQ use only -void - zctx__initialize_underlying(zctx_t *self); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zdigest.h b/phonelibs/zmq/aarch64/include/zdigest.h deleted file mode 100644 index def9e86053..0000000000 --- a/phonelibs/zmq/aarch64/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zdir.h b/phonelibs/zmq/aarch64/include/zdir.h deleted file mode 100644 index 6c5551b57e..0000000000 --- a/phonelibs/zmq/aarch64/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/phonelibs/zmq/aarch64/include/zdir_patch.h b/phonelibs/zmq/aarch64/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb4..0000000000 --- a/phonelibs/zmq/aarch64/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zfile.h b/phonelibs/zmq/aarch64/include/zfile.h deleted file mode 100644 index 75c35774b9..0000000000 --- a/phonelibs/zmq/aarch64/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/aarch64/include/zframe.h b/phonelibs/zmq/aarch64/include/zframe.h deleted file mode 100644 index 728093c36c..0000000000 --- a/phonelibs/zmq/aarch64/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zgossip.h b/phonelibs/zmq/aarch64/include/zgossip.h deleted file mode 100644 index 647cb28c08..0000000000 --- a/phonelibs/zmq/aarch64/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zhash.h b/phonelibs/zmq/aarch64/include/zhash.h deleted file mode 100644 index 929bc2683a..0000000000 --- a/phonelibs/zmq/aarch64/include/zhash.h +++ /dev/null @@ -1,198 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Callback function for zhash_foreach method. Deprecated. -typedef int (zhash_foreach_fn) ( - const char *key, void *item, void *argument); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Apply function to each item in the hash table. Items are iterated in no -// defined order. Stops if callback function returns non-zero and returns -// final return code from callback function (zero = success). Deprecated. -CZMQ_EXPORT int - zhash_foreach (zhash_t *self, zhash_foreach_fn callback, void *argument); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @ignore -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zhashx.h b/phonelibs/zmq/aarch64/include/zhashx.h deleted file mode 100644 index 8776073156..0000000000 --- a/phonelibs/zmq/aarch64/include/zhashx.h +++ /dev/null @@ -1,301 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Callback function for zhashx_foreach method. -// This callback is deprecated and you should use zhashx_first/_next instead. -typedef int (zhashx_foreach_fn) ( - const char *key, void *item, void *argument); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Set hash for automatic value destruction. This method is deprecated -// and you should use set_destructor instead. -CZMQ_EXPORT void - zhashx_autofree (zhashx_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Apply function to each item in the hash table. Items are iterated in no -// defined order. Stops if callback function returns non-zero and returns -// final return code from callback function (zero = success). This method -// is deprecated and you should use zhashx_first/_next instead. -CZMQ_EXPORT int - zhashx_foreach (zhashx_t *self, zhashx_foreach_fn callback, void *argument); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/ziflist.h b/phonelibs/zmq/aarch64/include/ziflist.h deleted file mode 100644 index cb2b144802..0000000000 --- a/phonelibs/zmq/aarch64/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zlist.h b/phonelibs/zmq/aarch64/include/zlist.h deleted file mode 100644 index 1dcd39b995..0000000000 --- a/phonelibs/zmq/aarch64/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zlistx.h b/phonelibs/zmq/aarch64/include/zlistx.h deleted file mode 100644 index 512637cef3..0000000000 --- a/phonelibs/zmq/aarch64/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zloop.h b/phonelibs/zmq/aarch64/include/zloop.h deleted file mode 100644 index bc58ea0530..0000000000 --- a/phonelibs/zmq/aarch64/include/zloop.h +++ /dev/null @@ -1,168 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zmonitor.h b/phonelibs/zmq/aarch64/include/zmonitor.h deleted file mode 100644 index b490bcb1a0..0000000000 --- a/phonelibs/zmq/aarch64/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zmonitor_v2.h b/phonelibs/zmq/aarch64/include/zmonitor_v2.h deleted file mode 100644 index 5780e0bcb7..0000000000 --- a/phonelibs/zmq/aarch64/include/zmonitor_v2.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ========================================================================= - zmonitor_v2 - socket event monitor (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_V2_H_INCLUDED__ -#define __ZMONITOR_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This code needs backporting to work with ZMQ v3.2 -#if (ZMQ_VERSION_MAJOR == 4) - -// Create a new socket monitor -CZMQ_EXPORT zmonitor_t * - zmonitor_new (zctx_t *ctx, void *socket, int events); - -// Destroy a socket monitor -CZMQ_EXPORT void - zmonitor_destroy (zmonitor_t **self_p); - -// Receive a status message from the monitor; if no message arrives within -// 500 msec, or the call was interrupted, returns NULL. -CZMQ_EXPORT zmsg_t * - zmonitor_recv (zmonitor_t *self); - -// Get the ZeroMQ socket, for polling -CZMQ_EXPORT void * - zmonitor_socket (zmonitor_t *self); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zmonitor_set_verbose (zmonitor_t *self, bool verbose); -#endif // ZeroMQ 4.0 or later - -// Self test of this class -CZMQ_EXPORT void - zmonitor_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zmq.h b/phonelibs/zmq/aarch64/include/zmq.h deleted file mode 100644 index 5f35d1915f..0000000000 --- a/phonelibs/zmq/aarch64/include/zmq.h +++ /dev/null @@ -1,617 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 0 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* union here ensures correct alignment on architectures that require it, e.g. - * SPARC - */ -typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -// All options after this is for version 4.2 and still *draft* -// Subject to arbitrary change without notice -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zmq_utils.h b/phonelibs/zmq/aarch64/include/zmq_utils.h deleted file mode 100644 index f29638d553..0000000000 --- a/phonelibs/zmq/aarch64/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/phonelibs/zmq/aarch64/include/zmsg.h b/phonelibs/zmq/aarch64/include/zmsg.h deleted file mode 100644 index c6ab16c66e..0000000000 --- a/phonelibs/zmq/aarch64/include/zmsg.h +++ /dev/null @@ -1,285 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/phonelibs/zmq/aarch64/include/zmutex.h b/phonelibs/zmq/aarch64/include/zmutex.h deleted file mode 100644 index cba315999b..0000000000 --- a/phonelibs/zmq/aarch64/include/zmutex.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ========================================================================= - zmutex - working with mutexes - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMUTEX_H_INCLUDED__ -#define __ZMUTEX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This is a deprecated class, and will be removed over time. It is -// provided in stable builds to support old applications. You should -// stop using this class, and migrate any code that is still using it. - -// Create a new mutex container -CZMQ_EXPORT zmutex_t * - zmutex_new (void); - -// Destroy a mutex container -CZMQ_EXPORT void - zmutex_destroy (zmutex_t **self_p); - -// Lock mutex -CZMQ_EXPORT void - zmutex_lock (zmutex_t *self); - -// Unlock mutex -CZMQ_EXPORT void - zmutex_unlock (zmutex_t *self); - -// Try to lock mutex -CZMQ_EXPORT int - zmutex_try_lock (zmutex_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zmutex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zpoller.h b/phonelibs/zmq/aarch64/include/zpoller.h deleted file mode 100644 index 3756a935a6..0000000000 --- a/phonelibs/zmq/aarch64/include/zpoller.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/aarch64/include/zproc.h b/phonelibs/zmq/aarch64/include/zproc.h deleted file mode 100644 index a2e1b3dd99..0000000000 --- a/phonelibs/zmq/aarch64/include/zproc.h +++ /dev/null @@ -1,179 +0,0 @@ -/* ========================================================================= - zproc - process configuration and status - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZPROC_H_INCLUDED -#define ZPROC_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zproc.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal. -// It is good practice to use this method to exit any infinite loop -// processing messages. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints. -// If the host name is not resolvable, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background. The precise effect -// depends on the operating system. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there -// was an error. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user. Any of the -// arguments may be null, indicating a no-op. Returns 0 on success, -// -1 on failure. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition - highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition - high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log informational message - low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zproc_log_error (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_info (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zproxy.h b/phonelibs/zmq/aarch64/include/zproxy.h deleted file mode 100644 index f672c5e724..0000000000 --- a/phonelibs/zmq/aarch64/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zproxy_v2.h b/phonelibs/zmq/aarch64/include/zproxy_v2.h deleted file mode 100644 index 4bde951591..0000000000 --- a/phonelibs/zmq/aarch64/include/zproxy_v2.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ========================================================================= - zproxy_v2 - run a steerable proxy in the background (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_V2_H_INCLUDED__ -#define __ZPROXY_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface - -// Constructor -// Create a new zproxy object. You must create the frontend and backend -// sockets, configure them, and connect or bind them, before you pass them -// to the constructor. Do NOT use the sockets again, after passing them to -// this method. -CZMQ_EXPORT zproxy_t * - zproxy_new (zctx_t *ctx, void *frontend, void *backend); - -// Destructor -// Destroy a zproxy object; note this first stops the proxy. -CZMQ_EXPORT void - zproxy_destroy (zproxy_t **self_p); - -// Copy all proxied messages to specified endpoint; if this is NULL, any -// in-progress capturing will be stopped. You must already have bound the -// endpoint to a PULL socket. -CZMQ_EXPORT void - zproxy_capture (zproxy_t *self, const char *endpoint); - -// Pauses a zproxy object; a paused proxy will cease processing messages, -// causing them to be queued up and potentially hit the high-water mark on -// the frontend socket, causing messages to be dropped, or writing -// applications to block. -CZMQ_EXPORT void - zproxy_pause (zproxy_t *self); - -// Resume a zproxy object -CZMQ_EXPORT void - zproxy_resume (zproxy_t *self); - -// Self test of this class -CZMQ_EXPORT void - zproxy_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zrex.h b/phonelibs/zmq/aarch64/include/zrex.h deleted file mode 100644 index 8b50618a34..0000000000 --- a/phonelibs/zmq/aarch64/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zsock.h b/phonelibs/zmq/aarch64/include/zsock.h deleted file mode 100644 index fc5c46e45e..0000000000 --- a/phonelibs/zmq/aarch64/include/zsock.h +++ /dev/null @@ -1,921 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `tos`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `router_mandatory`. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Set socket option `router_raw`. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Get socket option `type`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_ivl`. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_ttl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_ttl`. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_timeout`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_timeout`. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `use_fd`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `use_fd`. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zsocket.h b/phonelibs/zmq/aarch64/include/zsocket.h deleted file mode 100644 index a60a0d9db3..0000000000 --- a/phonelibs/zmq/aarch64/include/zsocket.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zsocket - working with 0MQ sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCKET_H_INCLUDED__ -#define __ZSOCKET_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This port range is defined by IANA for dynamic or private ports -// We use this when choosing a port for dynamic binding. -#define ZSOCKET_DYNFROM 0xc000 -#define ZSOCKET_DYNTO 0xffff - -// Callback function for zero-copy methods -typedef void (zsocket_free_fn) (void *data, void *arg); - -// Create a new socket within our CZMQ context, replaces zmq_socket. -// Use this to get automatic management of the socket at shutdown. -// Note: SUB sockets do not automatically subscribe to everything; you -// must set filters explicitly. -CZMQ_EXPORT void * - zsocket_new (zctx_t *self, int type); - -// Destroy a socket within our CZMQ context, replaces zmq_close. -CZMQ_EXPORT void - zsocket_destroy (zctx_t *ctx, void *self); - -// Bind a socket to a formatted endpoint. If the port is specified as -// '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO -// and returns the actual port number used. Otherwise asserts that the -// bind succeeded with the specified port number. Always returns the -// port number if successful. -CZMQ_EXPORT int - zsocket_bind (void *self, const char *format, ...); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsocket_unbind (void *self, const char *format, ...); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsocket_connect (void *self, const char *format, ...); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsocket_disconnect (void *self, const char *format, ...); - -// Poll for input events on the socket. Returns TRUE if there is input -// ready on the socket, else FALSE. -CZMQ_EXPORT bool - zsocket_poll (void *self, int msecs); - -// Returns socket type as printable constant string -CZMQ_EXPORT const char * - zsocket_type_str (void *self); - -// Send data over a socket as a single message frame. -// Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT. -// Returns -1 on error, 0 on success -CZMQ_EXPORT int - zsocket_sendmem (void *self, const void *data, size_t size, int flags); - -// Send a signal over a socket. A signal is a zero-byte message. -// Signals are used primarily between threads, over pipe sockets. -// Returns -1 if there was an error sending the signal. -CZMQ_EXPORT int - zsocket_signal (void *self); - -// Wait on a signal. Use this to coordinate between threads, over -// pipe pairs. Returns -1 on error, 0 on success. -CZMQ_EXPORT int - zsocket_wait (void *self); - -// Self test of this class -CZMQ_EXPORT void - zsocket_test (bool verbose); -// @end - -// Compiler hints -CZMQ_EXPORT int zsocket_bind (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_unbind (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_connect (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_disconnect (void *self, const char *format, ...) CHECK_PRINTF (2); - -// Emulation of widely-used 2.x socket options -CZMQ_EXPORT void zsocket_set_hwm (void *self, int hwm); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zsockopt.h b/phonelibs/zmq/aarch64/include/zsockopt.h deleted file mode 100644 index 5246986dd0..0000000000 --- a/phonelibs/zmq/aarch64/include/zsockopt.h +++ /dev/null @@ -1,256 +0,0 @@ -/* ========================================================================= - zsockopt - get/set 0MQ socket options (deprecated) - - **************************************************** - * GENERATED SOURCE CODE, DO NOT EDIT!! * - * TO CHANGE THIS, EDIT src/zsockopt.gsl * - * AND RUN `gsl sockopts` in src/. * - **************************************************** - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCKOPT_H_INCLUDED__ -#define __ZSOCKOPT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#if (ZMQ_VERSION_MAJOR == 4) -// Get socket options -CZMQ_EXPORT int zsocket_heartbeat_ivl (void *zocket); -CZMQ_EXPORT int zsocket_heartbeat_ttl (void *zocket); -CZMQ_EXPORT int zsocket_heartbeat_timeout (void *zocket); -CZMQ_EXPORT int zsocket_use_fd (void *zocket); -CZMQ_EXPORT int zsocket_tos (void *zocket); -CZMQ_EXPORT char * zsocket_zap_domain (void *zocket); -CZMQ_EXPORT int zsocket_mechanism (void *zocket); -CZMQ_EXPORT int zsocket_plain_server (void *zocket); -CZMQ_EXPORT char * zsocket_plain_username (void *zocket); -CZMQ_EXPORT char * zsocket_plain_password (void *zocket); -CZMQ_EXPORT int zsocket_curve_server (void *zocket); -CZMQ_EXPORT char * zsocket_curve_publickey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_secretkey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_serverkey (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_server (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_plaintext (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_principal (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_service_principal (void *zocket); -CZMQ_EXPORT int zsocket_ipv6 (void *zocket); -CZMQ_EXPORT int zsocket_immediate (void *zocket); -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_heartbeat_ivl (void *zocket, int heartbeat_ivl); -CZMQ_EXPORT void zsocket_set_heartbeat_ttl (void *zocket, int heartbeat_ttl); -CZMQ_EXPORT void zsocket_set_heartbeat_timeout (void *zocket, int heartbeat_timeout); -CZMQ_EXPORT void zsocket_set_use_fd (void *zocket, int use_fd); -CZMQ_EXPORT void zsocket_set_tos (void *zocket, int tos); -CZMQ_EXPORT void zsocket_set_router_handover (void *zocket, int router_handover); -CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory); -CZMQ_EXPORT void zsocket_set_probe_router (void *zocket, int probe_router); -CZMQ_EXPORT void zsocket_set_req_relaxed (void *zocket, int req_relaxed); -CZMQ_EXPORT void zsocket_set_req_correlate (void *zocket, int req_correlate); -CZMQ_EXPORT void zsocket_set_conflate (void *zocket, int conflate); -CZMQ_EXPORT void zsocket_set_zap_domain (void *zocket, const char * zap_domain); -CZMQ_EXPORT void zsocket_set_plain_server (void *zocket, int plain_server); -CZMQ_EXPORT void zsocket_set_plain_username (void *zocket, const char * plain_username); -CZMQ_EXPORT void zsocket_set_plain_password (void *zocket, const char * plain_password); -CZMQ_EXPORT void zsocket_set_curve_server (void *zocket, int curve_server); -CZMQ_EXPORT void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey); -CZMQ_EXPORT void zsocket_set_gssapi_server (void *zocket, int gssapi_server); -CZMQ_EXPORT void zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext); -CZMQ_EXPORT void zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal); -CZMQ_EXPORT void zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal); -CZMQ_EXPORT void zsocket_set_ipv6 (void *zocket, int ipv6); -CZMQ_EXPORT void zsocket_set_immediate (void *zocket, int immediate); -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -// Get socket options -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -// Get socket options -CZMQ_EXPORT int zsocket_hwm (void *zocket); -CZMQ_EXPORT int zsocket_swap (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl_msec (void *zocket); -CZMQ_EXPORT int zsocket_mcast_loop (void *zocket); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -# endif -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_hwm (void *zocket, int hwm); -CZMQ_EXPORT void zsocket_set_swap (void *zocket, int swap); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec); -CZMQ_EXPORT void zsocket_set_mcast_loop (void *zocket, int mcast_loop); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -# endif -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -#endif - -// Self test of this class -CZMQ_EXPORT void zsockopt_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zstr.h b/phonelibs/zmq/aarch64/include/zstr.h deleted file mode 100644 index 3d3f1a862a..0000000000 --- a/phonelibs/zmq/aarch64/include/zstr.h +++ /dev/null @@ -1,115 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zsys.h b/phonelibs/zmq/aarch64/include/zsys.h deleted file mode 100644 index 97f88a9555..0000000000 --- a/phonelibs/zmq/aarch64/include/zsys.h +++ /dev/null @@ -1,386 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zthread.h b/phonelibs/zmq/aarch64/include/zthread.h deleted file mode 100644 index fc0602dd9f..0000000000 --- a/phonelibs/zmq/aarch64/include/zthread.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ========================================================================= - zthread - working with system threads (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZTHREAD_H_INCLUDED__ -#define __ZTHREAD_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Detached threads follow POSIX pthreads API -typedef void *(zthread_detached_fn) (void *args); - -// Attached threads get context and pipe from parent -typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe); - -// Create a detached thread. A detached thread operates autonomously -// and is used to simulate a separate process. It gets no ctx, and no -// pipe. -CZMQ_EXPORT int - zthread_new (zthread_detached_fn *thread_fn, void *args); - -// Create an attached thread. An attached thread gets a ctx and a PAIR -// pipe back to its parent. It must monitor its pipe, and exit if the -// pipe becomes unreadable. Do not destroy the ctx, the thread does this -// automatically when it ends. -CZMQ_EXPORT void * - zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args); - -// Self test of this class -CZMQ_EXPORT void - zthread_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/ztimerset.h b/phonelibs/zmq/aarch64/include/ztimerset.h deleted file mode 100644 index 29633fafdb..0000000000 --- a/phonelibs/zmq/aarch64/include/ztimerset.h +++ /dev/null @@ -1,90 +0,0 @@ -/* ========================================================================= - ztimerset - timer set - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTIMERSET_H_INCLUDED -#define ZTIMERSET_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztimerset.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set. Returns timer id if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer. Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval. -// Should be used as timeout parameter for the zpoller wait method. -// The timeout is in msec. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed. -// Should be call after zpoller wait method. -// Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/ztrie.h b/phonelibs/zmq/aarch64/include/ztrie.h deleted file mode 100644 index 6fd53234b1..0000000000 --- a/phonelibs/zmq/aarch64/include/ztrie.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ========================================================================= - ztrie - simple trie for tokenizable strings - - Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com - Copyright other contributors as noted in the AUTHORS file. - - This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTRIE_H_INCLUDED -#define ZTRIE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztrie.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data. Returns -1 -// if the route already exists, otherwise 0. This method takes ownership of -// the provided data if a destroy_data_fn is provided. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data. Returns -1 if the -// route does not exists, otherwise 0. -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches. If the path -// did not match, returns NULL. Do not delete the data as it's owned by -// ztrie. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches. If the path did not match or the route did not contain any -// named regexes, returns NULL. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/include/zuuid.h b/phonelibs/zmq/aarch64/include/zuuid.h deleted file mode 100644 index afc1104fea..0000000000 --- a/phonelibs/zmq/aarch64/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/aarch64/lib/libczmq.a b/phonelibs/zmq/aarch64/lib/libczmq.a deleted file mode 100644 index 2d2a251c2f..0000000000 Binary files a/phonelibs/zmq/aarch64/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/aarch64/lib/libczmq.la b/phonelibs/zmq/aarch64/lib/libczmq.la deleted file mode 100755 index 7eb675e692..0000000000 --- a/phonelibs/zmq/aarch64/lib/libczmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libczmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libczmq.so' - -# Names of this library. -library_names='libczmq.so' - -# The name of the static archive. -old_library='libczmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -L/Users/batman/src/czmq/builds/android/prefix/aarch64-linux-android-4.9/lib -L/opt/android-ndk/platforms/android-21/arch-arm64/usr/lib -L/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a -L/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib /Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.la -llog -lc -lgcc -ldl -lm -lgnustl_shared' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libczmq. -current=3 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/Users/batman/src/czmq/builds/android/prefix/aarch64-linux-android-4.9/lib' diff --git a/phonelibs/zmq/aarch64/lib/libczmq.so b/phonelibs/zmq/aarch64/lib/libczmq.so deleted file mode 100755 index 6b662a197f..0000000000 Binary files a/phonelibs/zmq/aarch64/lib/libczmq.so and /dev/null differ diff --git a/phonelibs/zmq/aarch64/lib/libgnustl_shared.so b/phonelibs/zmq/aarch64/lib/libgnustl_shared.so deleted file mode 100755 index 2226b7b324..0000000000 Binary files a/phonelibs/zmq/aarch64/lib/libgnustl_shared.so and /dev/null differ diff --git a/phonelibs/zmq/aarch64/lib/libzmq.a b/phonelibs/zmq/aarch64/lib/libzmq.a deleted file mode 100644 index b764af7b61..0000000000 Binary files a/phonelibs/zmq/aarch64/lib/libzmq.a and /dev/null differ diff --git a/phonelibs/zmq/aarch64/lib/libzmq.la b/phonelibs/zmq/aarch64/lib/libzmq.la deleted file mode 100755 index d7d420a4bd..0000000000 --- a/phonelibs/zmq/aarch64/lib/libzmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so' - -# Names of this library. -library_names='libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -L/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib -L/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a -lgnustl_shared' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=5 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib' diff --git a/phonelibs/zmq/aarch64/lib/libzmq.so b/phonelibs/zmq/aarch64/lib/libzmq.so deleted file mode 100755 index 909c7f43a6..0000000000 Binary files a/phonelibs/zmq/aarch64/lib/libzmq.so and /dev/null differ diff --git a/phonelibs/zmq/arm/include/czmq.h b/phonelibs/zmq/arm/include/czmq.h deleted file mode 100644 index ba21aa3bd1..0000000000 --- a/phonelibs/zmq/arm/include/czmq.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/phonelibs/zmq/arm/include/czmq_library.h b/phonelibs/zmq/arm/include/czmq_library.h deleted file mode 100644 index be348db3e9..0000000000 --- a/phonelibs/zmq/arm/include/czmq_library.h +++ /dev/null @@ -1,199 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 3 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 3 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -#else -# define CZMQ_EXPORT -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -typedef struct _zauth_v2_t zauth_v2_t; -#define ZAUTH_V2_T_DEFINED -typedef struct _zbeacon_v2_t zbeacon_v2_t; -#define ZBEACON_V2_T_DEFINED -typedef struct _zctx_t zctx_t; -#define ZCTX_T_DEFINED -typedef struct _zmonitor_v2_t zmonitor_v2_t; -#define ZMONITOR_V2_T_DEFINED -typedef struct _zmutex_t zmutex_t; -#define ZMUTEX_T_DEFINED -typedef struct _zproxy_v2_t zproxy_v2_t; -#define ZPROXY_V2_T_DEFINED -typedef struct _zsocket_t zsocket_t; -#define ZSOCKET_T_DEFINED -typedef struct _zsockopt_t zsockopt_t; -#define ZSOCKOPT_T_DEFINED -typedef struct _zthread_t zthread_t; -#define ZTHREAD_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#include "zauth_v2.h" -#include "zbeacon_v2.h" -#include "zctx.h" -#include "zmonitor_v2.h" -#include "zmutex.h" -#include "zproxy_v2.h" -#include "zsocket.h" -#include "zsockopt.h" -#include "zthread.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/phonelibs/zmq/arm/include/czmq_prelude.h b/phonelibs/zmq/arm/include/czmq_prelude.h deleted file mode 100644 index e9ceb691e8..0000000000 --- a/phonelibs/zmq/arm/include/czmq_prelude.h +++ /dev/null @@ -1,641 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SRV4)) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0)) -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined _ZMALLOC_DEBUG || _ZMALLOC_PEDANTIC -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zactor.h b/phonelibs/zmq/arm/include/zactor.h deleted file mode 100644 index c865c65daf..0000000000 --- a/phonelibs/zmq/arm/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zarmour.h b/phonelibs/zmq/arm/include/zarmour.h deleted file mode 100644 index c7f299f7af..0000000000 --- a/phonelibs/zmq/arm/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zauth.h b/phonelibs/zmq/arm/include/zauth.h deleted file mode 100644 index ca6bb913c8..0000000000 --- a/phonelibs/zmq/arm/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or nmore addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zauth_v2.h b/phonelibs/zmq/arm/include/zauth_v2.h deleted file mode 100644 index bbbee86b03..0000000000 --- a/phonelibs/zmq/arm/include/zauth_v2.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ========================================================================= - zauth_v2 - authentication for ZeroMQ servers (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_V2_H_INCLUDED__ -#define __ZAUTH_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#ifndef CURVE_ALLOW_ANY -# define CURVE_ALLOW_ANY "*" -#endif - -// Constructor -// Install authentication for the specified context. Returns a new zauth -// object that you can use to configure authentication. Note that until you -// add policies, all incoming NULL connections are allowed (classic ZeroMQ -// behaviour), and all PLAIN and CURVE connections are denied. If there was -// an error during initialization, returns NULL. -CZMQ_EXPORT zauth_t * - zauth_new (zctx_t *ctx); - -// Destructor -CZMQ_EXPORT void - zauth_destroy (zauth_t **self_p); - -// Allow (whitelist) a single IP address. For NULL, all clients from this -// address will be accepted. For PLAIN and CURVE, they will be allowed to -// continue with authentication. You can call this method multiple times -// to whitelist multiple IP addresses. If you whitelist a single address, -// any non-whitelisted addresses are treated as blacklisted. -CZMQ_EXPORT void - zauth_allow (zauth_t *self, const char *address); - -// Deny (blacklist) a single IP address. For all security mechanisms, this -// rejects the connection without any further authentication. Use either a -// whitelist, or a blacklist, not not both. If you define both a whitelist -// and a blacklist, only the whitelist takes effect. -CZMQ_EXPORT void - zauth_deny (zauth_t *self, const char *address); - -// Configure PLAIN authentication for a given domain. PLAIN authentication -// uses a plain-text password file. To cover all domains, use "*". You can -// modify the password file at any time; it is reloaded automatically. -CZMQ_EXPORT void - zauth_configure_plain (zauth_t *self, const char *domain, const char *filename); - -// Configure CURVE authentication for a given domain. CURVE authentication -// uses a directory that holds all public client certificates, i.e. their -// public keys. The certificates must be in zcert_save () format. To cover -// all domains, use "*". You can add and remove certificates in that -// directory at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the location. -CZMQ_EXPORT void - zauth_configure_curve (zauth_t *self, const char *domain, const char *location); - -// Configure GSSAPI authentication for a given domain. GSSAPI authentication -// uses an underlying mechanism (usually Kerberos) to establish a secure -// context and perform mutual authentication. To cover all domains, use "*". -CZMQ_EXPORT void - zauth_configure_gssapi (zauth_t *self, char *domain); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zauth_set_verbose (zauth_t *self, bool verbose); - -// Selftest -CZMQ_EXPORT void - zauth_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zbeacon.h b/phonelibs/zmq/arm/include/zbeacon.h deleted file mode 100644 index 78917e9577..0000000000 --- a/phonelibs/zmq/arm/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zbeacon_v2.h b/phonelibs/zmq/arm/include/zbeacon_v2.h deleted file mode 100644 index 8e8f3b4cde..0000000000 --- a/phonelibs/zmq/arm/include/zbeacon_v2.h +++ /dev/null @@ -1,75 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_V2_H_INCLUDED__ -#define __ZBEACON_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create a new beacon on a certain UDP port. If the system does not -// support UDP broadcasts (lacking a useful interface), returns NULL. -// To force the beacon to operate on a given port, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand. -// If you are using the new zsock API then pass NULL as the ctx here. -CZMQ_EXPORT zbeacon_t * - zbeacon_new (zctx_t *ctx, int port_nbr); - -// Destroy a beacon -CZMQ_EXPORT void - zbeacon_destroy (zbeacon_t **self_p); - -// Return our own IP address as printable string -CZMQ_EXPORT char * - zbeacon_hostname (zbeacon_t *self); - -// Set broadcast interval in milliseconds (default is 1000 msec) -CZMQ_EXPORT void - zbeacon_set_interval (zbeacon_t *self, int interval); - -// Filter out any beacon that looks exactly like ours -CZMQ_EXPORT void - zbeacon_noecho (zbeacon_t *self); - -// Start broadcasting beacon to peers at the specified interval -CZMQ_EXPORT void - zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size); - -// Stop broadcasting beacons -CZMQ_EXPORT void - zbeacon_silence (zbeacon_t *self); - -// Start listening to other peers; zero-sized filter means get everything -CZMQ_EXPORT void - zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size); - -// Stop listening to other peers -CZMQ_EXPORT void - zbeacon_unsubscribe (zbeacon_t *self); - -// Get beacon ZeroMQ socket, for polling or receiving messages -CZMQ_EXPORT void * - zbeacon_socket (zbeacon_t *self); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zcert.h b/phonelibs/zmq/arm/include/zcert.h deleted file mode 100644 index 495b579cda..0000000000 --- a/phonelibs/zmq/arm/include/zcert.h +++ /dev/null @@ -1,139 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Print certificate contents to open stream. This method is deprecated -// and you should use the print method. -CZMQ_EXPORT void - zcert_fprint (zcert_t *self, FILE *file); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/phonelibs/zmq/arm/include/zcertstore.h b/phonelibs/zmq/arm/include/zcertstore.h deleted file mode 100644 index c7f93c5a7d..0000000000 --- a/phonelibs/zmq/arm/include/zcertstore.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Print list of certificates in store to open stream. This method is -// deprecated, and you should use the print method. -CZMQ_EXPORT void - zcertstore_fprint (zcertstore_t *self, FILE *file); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/phonelibs/zmq/arm/include/zchunk.h b/phonelibs/zmq/arm/include/zchunk.h deleted file mode 100644 index 56f29b161a..0000000000 --- a/phonelibs/zmq/arm/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/arm/include/zclock.h b/phonelibs/zmq/arm/include/zclock.h deleted file mode 100644 index eb064162c4..0000000000 --- a/phonelibs/zmq/arm/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zconfig.h b/phonelibs/zmq/arm/include/zconfig.h deleted file mode 100644 index 4ec4e1c81f..0000000000 --- a/phonelibs/zmq/arm/include/zconfig.h +++ /dev/null @@ -1,194 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @ignore -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/phonelibs/zmq/arm/include/zctx.h b/phonelibs/zmq/arm/include/zctx.h deleted file mode 100644 index 88898410dc..0000000000 --- a/phonelibs/zmq/arm/include/zctx.h +++ /dev/null @@ -1,107 +0,0 @@ -/* ========================================================================= - zctx - working with 0MQ contexts - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCTX_H_INCLUDED__ -#define __ZCTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @interface -// Create new context, returns context object, replaces zmq_init -CZMQ_EXPORT zctx_t * - zctx_new (void); - -// Destroy context and all sockets in it, replaces zmq_term -CZMQ_EXPORT void - zctx_destroy (zctx_t **self_p); - -// Create new shadow context, returns context object -CZMQ_EXPORT zctx_t * - zctx_shadow (zctx_t *self); -// @end - -// Create a new context by shadowing a plain zmq context -CZMQ_EXPORT zctx_t * -zctx_shadow_zmq_ctx (void *zmqctx); - -// @interface -// Raise default I/O threads from 1, for crazy heavy applications -// The rule of thumb is one I/O thread per gigabyte of traffic in -// or out. Call this method before creating any sockets on the context, -// or calling zctx_shadow, or the setting will have no effect. -CZMQ_EXPORT void - zctx_set_iothreads (zctx_t *self, int iothreads); - -// Set msecs to flush sockets when closing them, see the ZMQ_LINGER -// man page section for more details. By default, set to zero, so -// any in-transit messages are discarded when you destroy a socket or -// a context. -CZMQ_EXPORT void - zctx_set_linger (zctx_t *self, int linger); - -// Set initial high-water mark for inter-thread pipe sockets. Note that -// this setting is separate from the default for normal sockets. You -// should change the default for pipe sockets *with care*. Too low values -// will cause blocked threads, and an infinite setting can cause memory -// exhaustion. The default, no matter the underlying ZeroMQ version, is -// 1,000. -CZMQ_EXPORT void - zctx_set_pipehwm (zctx_t *self, int pipehwm); - -// Set initial send HWM for all new normal sockets created in context. -// You can set this per-socket after the socket is created. -// The default, no matter the underlying ZeroMQ version, is 1,000. -CZMQ_EXPORT void - zctx_set_sndhwm (zctx_t *self, int sndhwm); - -// Set initial receive HWM for all new normal sockets created in context. -// You can set this per-socket after the socket is created. -// The default, no matter the underlying ZeroMQ version, is 1,000. -CZMQ_EXPORT void - zctx_set_rcvhwm (zctx_t *self, int rcvhwm); - -// Return low-level 0MQ context object, will be NULL before first socket -// is created. Use with care. -CZMQ_EXPORT void * - zctx_underlying (zctx_t *self); - -// Self test of this class -CZMQ_EXPORT void - zctx_test (bool verbose); -// @end - -// Create socket within this context, for CZMQ use only -void * - zctx__socket_new (zctx_t *self, int type); - -// Create pipe socket within this context, for CZMQ use only -void * - zctx__socket_pipe (zctx_t *self); - -// Destroy socket within this context, for CZMQ use only -void - zctx__socket_destroy (zctx_t *self, void *socket); - -// Initialize the low-level 0MQ context object, for CZMQ use only -void - zctx__initialize_underlying(zctx_t *self); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zdigest.h b/phonelibs/zmq/arm/include/zdigest.h deleted file mode 100644 index def9e86053..0000000000 --- a/phonelibs/zmq/arm/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zdir.h b/phonelibs/zmq/arm/include/zdir.h deleted file mode 100644 index 6c5551b57e..0000000000 --- a/phonelibs/zmq/arm/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/phonelibs/zmq/arm/include/zdir_patch.h b/phonelibs/zmq/arm/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb4..0000000000 --- a/phonelibs/zmq/arm/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zfile.h b/phonelibs/zmq/arm/include/zfile.h deleted file mode 100644 index 75c35774b9..0000000000 --- a/phonelibs/zmq/arm/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/arm/include/zframe.h b/phonelibs/zmq/arm/include/zframe.h deleted file mode 100644 index 728093c36c..0000000000 --- a/phonelibs/zmq/arm/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zgossip.h b/phonelibs/zmq/arm/include/zgossip.h deleted file mode 100644 index 647cb28c08..0000000000 --- a/phonelibs/zmq/arm/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zhash.h b/phonelibs/zmq/arm/include/zhash.h deleted file mode 100644 index 929bc2683a..0000000000 --- a/phonelibs/zmq/arm/include/zhash.h +++ /dev/null @@ -1,198 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Callback function for zhash_foreach method. Deprecated. -typedef int (zhash_foreach_fn) ( - const char *key, void *item, void *argument); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Apply function to each item in the hash table. Items are iterated in no -// defined order. Stops if callback function returns non-zero and returns -// final return code from callback function (zero = success). Deprecated. -CZMQ_EXPORT int - zhash_foreach (zhash_t *self, zhash_foreach_fn callback, void *argument); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @ignore -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zhashx.h b/phonelibs/zmq/arm/include/zhashx.h deleted file mode 100644 index 8776073156..0000000000 --- a/phonelibs/zmq/arm/include/zhashx.h +++ /dev/null @@ -1,301 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// This class has legacy methods, which will be removed over time. You -// should not use them, and migrate any code that is still using them. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Callback function for zhashx_foreach method. -// This callback is deprecated and you should use zhashx_first/_next instead. -typedef int (zhashx_foreach_fn) ( - const char *key, void *item, void *argument); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Set hash for automatic value destruction. This method is deprecated -// and you should use set_destructor instead. -CZMQ_EXPORT void - zhashx_autofree (zhashx_t *self); - -// *** Deprecated method, slated for removal: avoid using it *** -// Apply function to each item in the hash table. Items are iterated in no -// defined order. Stops if callback function returns non-zero and returns -// final return code from callback function (zero = success). This method -// is deprecated and you should use zhashx_first/_next instead. -CZMQ_EXPORT int - zhashx_foreach (zhashx_t *self, zhashx_foreach_fn callback, void *argument); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/ziflist.h b/phonelibs/zmq/arm/include/ziflist.h deleted file mode 100644 index cb2b144802..0000000000 --- a/phonelibs/zmq/arm/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zlist.h b/phonelibs/zmq/arm/include/zlist.h deleted file mode 100644 index 1dcd39b995..0000000000 --- a/phonelibs/zmq/arm/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zlistx.h b/phonelibs/zmq/arm/include/zlistx.h deleted file mode 100644 index 512637cef3..0000000000 --- a/phonelibs/zmq/arm/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zloop.h b/phonelibs/zmq/arm/include/zloop.h deleted file mode 100644 index bc58ea0530..0000000000 --- a/phonelibs/zmq/arm/include/zloop.h +++ /dev/null @@ -1,168 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zmonitor.h b/phonelibs/zmq/arm/include/zmonitor.h deleted file mode 100644 index b490bcb1a0..0000000000 --- a/phonelibs/zmq/arm/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zmonitor_v2.h b/phonelibs/zmq/arm/include/zmonitor_v2.h deleted file mode 100644 index 5780e0bcb7..0000000000 --- a/phonelibs/zmq/arm/include/zmonitor_v2.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ========================================================================= - zmonitor_v2 - socket event monitor (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_V2_H_INCLUDED__ -#define __ZMONITOR_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This code needs backporting to work with ZMQ v3.2 -#if (ZMQ_VERSION_MAJOR == 4) - -// Create a new socket monitor -CZMQ_EXPORT zmonitor_t * - zmonitor_new (zctx_t *ctx, void *socket, int events); - -// Destroy a socket monitor -CZMQ_EXPORT void - zmonitor_destroy (zmonitor_t **self_p); - -// Receive a status message from the monitor; if no message arrives within -// 500 msec, or the call was interrupted, returns NULL. -CZMQ_EXPORT zmsg_t * - zmonitor_recv (zmonitor_t *self); - -// Get the ZeroMQ socket, for polling -CZMQ_EXPORT void * - zmonitor_socket (zmonitor_t *self); - -// Enable verbose tracing of commands and activity -CZMQ_EXPORT void - zmonitor_set_verbose (zmonitor_t *self, bool verbose); -#endif // ZeroMQ 4.0 or later - -// Self test of this class -CZMQ_EXPORT void - zmonitor_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zmq.h b/phonelibs/zmq/arm/include/zmq.h deleted file mode 100644 index 5f35d1915f..0000000000 --- a/phonelibs/zmq/arm/include/zmq.h +++ /dev/null @@ -1,617 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 0 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* union here ensures correct alignment on architectures that require it, e.g. - * SPARC - */ -typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -// All options after this is for version 4.2 and still *draft* -// Subject to arbitrary change without notice -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zmq_utils.h b/phonelibs/zmq/arm/include/zmq_utils.h deleted file mode 100644 index f29638d553..0000000000 --- a/phonelibs/zmq/arm/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/phonelibs/zmq/arm/include/zmsg.h b/phonelibs/zmq/arm/include/zmsg.h deleted file mode 100644 index c6ab16c66e..0000000000 --- a/phonelibs/zmq/arm/include/zmsg.h +++ /dev/null @@ -1,285 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/phonelibs/zmq/arm/include/zmutex.h b/phonelibs/zmq/arm/include/zmutex.h deleted file mode 100644 index cba315999b..0000000000 --- a/phonelibs/zmq/arm/include/zmutex.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ========================================================================= - zmutex - working with mutexes - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMUTEX_H_INCLUDED__ -#define __ZMUTEX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This is a deprecated class, and will be removed over time. It is -// provided in stable builds to support old applications. You should -// stop using this class, and migrate any code that is still using it. - -// Create a new mutex container -CZMQ_EXPORT zmutex_t * - zmutex_new (void); - -// Destroy a mutex container -CZMQ_EXPORT void - zmutex_destroy (zmutex_t **self_p); - -// Lock mutex -CZMQ_EXPORT void - zmutex_lock (zmutex_t *self); - -// Unlock mutex -CZMQ_EXPORT void - zmutex_unlock (zmutex_t *self); - -// Try to lock mutex -CZMQ_EXPORT int - zmutex_try_lock (zmutex_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zmutex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zpoller.h b/phonelibs/zmq/arm/include/zpoller.h deleted file mode 100644 index 3756a935a6..0000000000 --- a/phonelibs/zmq/arm/include/zpoller.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/arm/include/zproc.h b/phonelibs/zmq/arm/include/zproc.h deleted file mode 100644 index a2e1b3dd99..0000000000 --- a/phonelibs/zmq/arm/include/zproc.h +++ /dev/null @@ -1,179 +0,0 @@ -/* ========================================================================= - zproc - process configuration and status - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZPROC_H_INCLUDED -#define ZPROC_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zproc.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal. -// It is good practice to use this method to exit any infinite loop -// processing messages. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints. -// If the host name is not resolvable, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background. The precise effect -// depends on the operating system. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there -// was an error. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user. Any of the -// arguments may be null, indicating a no-op. Returns 0 on success, -// -1 on failure. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition - highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition - high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log informational message - low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT void - zproc_log_error (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_info (const char *format, ...) CHECK_PRINTF (1); -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zproxy.h b/phonelibs/zmq/arm/include/zproxy.h deleted file mode 100644 index f672c5e724..0000000000 --- a/phonelibs/zmq/arm/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zproxy_v2.h b/phonelibs/zmq/arm/include/zproxy_v2.h deleted file mode 100644 index 4bde951591..0000000000 --- a/phonelibs/zmq/arm/include/zproxy_v2.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ========================================================================= - zproxy_v2 - run a steerable proxy in the background (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_V2_H_INCLUDED__ -#define __ZPROXY_V2_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface - -// Constructor -// Create a new zproxy object. You must create the frontend and backend -// sockets, configure them, and connect or bind them, before you pass them -// to the constructor. Do NOT use the sockets again, after passing them to -// this method. -CZMQ_EXPORT zproxy_t * - zproxy_new (zctx_t *ctx, void *frontend, void *backend); - -// Destructor -// Destroy a zproxy object; note this first stops the proxy. -CZMQ_EXPORT void - zproxy_destroy (zproxy_t **self_p); - -// Copy all proxied messages to specified endpoint; if this is NULL, any -// in-progress capturing will be stopped. You must already have bound the -// endpoint to a PULL socket. -CZMQ_EXPORT void - zproxy_capture (zproxy_t *self, const char *endpoint); - -// Pauses a zproxy object; a paused proxy will cease processing messages, -// causing them to be queued up and potentially hit the high-water mark on -// the frontend socket, causing messages to be dropped, or writing -// applications to block. -CZMQ_EXPORT void - zproxy_pause (zproxy_t *self); - -// Resume a zproxy object -CZMQ_EXPORT void - zproxy_resume (zproxy_t *self); - -// Self test of this class -CZMQ_EXPORT void - zproxy_v2_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zrex.h b/phonelibs/zmq/arm/include/zrex.h deleted file mode 100644 index 8b50618a34..0000000000 --- a/phonelibs/zmq/arm/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zsock.h b/phonelibs/zmq/arm/include/zsock.h deleted file mode 100644 index fc5c46e45e..0000000000 --- a/phonelibs/zmq/arm/include/zsock.h +++ /dev/null @@ -1,921 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `tos`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `router_mandatory`. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Set socket option `router_raw`. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Get socket option `type`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_ivl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_ivl`. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_ttl`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_ttl`. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `heartbeat_timeout`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `heartbeat_timeout`. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// *** Draft method, for development use, may change without warning *** -// Get socket option `use_fd`. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// *** Draft method, for development use, may change without warning *** -// Set socket option `use_fd`. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zsocket.h b/phonelibs/zmq/arm/include/zsocket.h deleted file mode 100644 index a60a0d9db3..0000000000 --- a/phonelibs/zmq/arm/include/zsocket.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zsocket - working with 0MQ sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCKET_H_INCLUDED__ -#define __ZSOCKET_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// This port range is defined by IANA for dynamic or private ports -// We use this when choosing a port for dynamic binding. -#define ZSOCKET_DYNFROM 0xc000 -#define ZSOCKET_DYNTO 0xffff - -// Callback function for zero-copy methods -typedef void (zsocket_free_fn) (void *data, void *arg); - -// Create a new socket within our CZMQ context, replaces zmq_socket. -// Use this to get automatic management of the socket at shutdown. -// Note: SUB sockets do not automatically subscribe to everything; you -// must set filters explicitly. -CZMQ_EXPORT void * - zsocket_new (zctx_t *self, int type); - -// Destroy a socket within our CZMQ context, replaces zmq_close. -CZMQ_EXPORT void - zsocket_destroy (zctx_t *ctx, void *self); - -// Bind a socket to a formatted endpoint. If the port is specified as -// '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO -// and returns the actual port number used. Otherwise asserts that the -// bind succeeded with the specified port number. Always returns the -// port number if successful. -CZMQ_EXPORT int - zsocket_bind (void *self, const char *format, ...); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsocket_unbind (void *self, const char *format, ...); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsocket_connect (void *self, const char *format, ...); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsocket_disconnect (void *self, const char *format, ...); - -// Poll for input events on the socket. Returns TRUE if there is input -// ready on the socket, else FALSE. -CZMQ_EXPORT bool - zsocket_poll (void *self, int msecs); - -// Returns socket type as printable constant string -CZMQ_EXPORT const char * - zsocket_type_str (void *self); - -// Send data over a socket as a single message frame. -// Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT. -// Returns -1 on error, 0 on success -CZMQ_EXPORT int - zsocket_sendmem (void *self, const void *data, size_t size, int flags); - -// Send a signal over a socket. A signal is a zero-byte message. -// Signals are used primarily between threads, over pipe sockets. -// Returns -1 if there was an error sending the signal. -CZMQ_EXPORT int - zsocket_signal (void *self); - -// Wait on a signal. Use this to coordinate between threads, over -// pipe pairs. Returns -1 on error, 0 on success. -CZMQ_EXPORT int - zsocket_wait (void *self); - -// Self test of this class -CZMQ_EXPORT void - zsocket_test (bool verbose); -// @end - -// Compiler hints -CZMQ_EXPORT int zsocket_bind (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_unbind (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_connect (void *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zsocket_disconnect (void *self, const char *format, ...) CHECK_PRINTF (2); - -// Emulation of widely-used 2.x socket options -CZMQ_EXPORT void zsocket_set_hwm (void *self, int hwm); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zsockopt.h b/phonelibs/zmq/arm/include/zsockopt.h deleted file mode 100644 index 5246986dd0..0000000000 --- a/phonelibs/zmq/arm/include/zsockopt.h +++ /dev/null @@ -1,256 +0,0 @@ -/* ========================================================================= - zsockopt - get/set 0MQ socket options (deprecated) - - **************************************************** - * GENERATED SOURCE CODE, DO NOT EDIT!! * - * TO CHANGE THIS, EDIT src/zsockopt.gsl * - * AND RUN `gsl sockopts` in src/. * - **************************************************** - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCKOPT_H_INCLUDED__ -#define __ZSOCKOPT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#if (ZMQ_VERSION_MAJOR == 4) -// Get socket options -CZMQ_EXPORT int zsocket_heartbeat_ivl (void *zocket); -CZMQ_EXPORT int zsocket_heartbeat_ttl (void *zocket); -CZMQ_EXPORT int zsocket_heartbeat_timeout (void *zocket); -CZMQ_EXPORT int zsocket_use_fd (void *zocket); -CZMQ_EXPORT int zsocket_tos (void *zocket); -CZMQ_EXPORT char * zsocket_zap_domain (void *zocket); -CZMQ_EXPORT int zsocket_mechanism (void *zocket); -CZMQ_EXPORT int zsocket_plain_server (void *zocket); -CZMQ_EXPORT char * zsocket_plain_username (void *zocket); -CZMQ_EXPORT char * zsocket_plain_password (void *zocket); -CZMQ_EXPORT int zsocket_curve_server (void *zocket); -CZMQ_EXPORT char * zsocket_curve_publickey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_secretkey (void *zocket); -CZMQ_EXPORT char * zsocket_curve_serverkey (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_server (void *zocket); -CZMQ_EXPORT int zsocket_gssapi_plaintext (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_principal (void *zocket); -CZMQ_EXPORT char * zsocket_gssapi_service_principal (void *zocket); -CZMQ_EXPORT int zsocket_ipv6 (void *zocket); -CZMQ_EXPORT int zsocket_immediate (void *zocket); -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_heartbeat_ivl (void *zocket, int heartbeat_ivl); -CZMQ_EXPORT void zsocket_set_heartbeat_ttl (void *zocket, int heartbeat_ttl); -CZMQ_EXPORT void zsocket_set_heartbeat_timeout (void *zocket, int heartbeat_timeout); -CZMQ_EXPORT void zsocket_set_use_fd (void *zocket, int use_fd); -CZMQ_EXPORT void zsocket_set_tos (void *zocket, int tos); -CZMQ_EXPORT void zsocket_set_router_handover (void *zocket, int router_handover); -CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory); -CZMQ_EXPORT void zsocket_set_probe_router (void *zocket, int probe_router); -CZMQ_EXPORT void zsocket_set_req_relaxed (void *zocket, int req_relaxed); -CZMQ_EXPORT void zsocket_set_req_correlate (void *zocket, int req_correlate); -CZMQ_EXPORT void zsocket_set_conflate (void *zocket, int conflate); -CZMQ_EXPORT void zsocket_set_zap_domain (void *zocket, const char * zap_domain); -CZMQ_EXPORT void zsocket_set_plain_server (void *zocket, int plain_server); -CZMQ_EXPORT void zsocket_set_plain_username (void *zocket, const char * plain_username); -CZMQ_EXPORT void zsocket_set_plain_password (void *zocket, const char * plain_password); -CZMQ_EXPORT void zsocket_set_curve_server (void *zocket, int curve_server); -CZMQ_EXPORT void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey); -CZMQ_EXPORT void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey); -CZMQ_EXPORT void zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey); -CZMQ_EXPORT void zsocket_set_gssapi_server (void *zocket, int gssapi_server); -CZMQ_EXPORT void zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext); -CZMQ_EXPORT void zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal); -CZMQ_EXPORT void zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal); -CZMQ_EXPORT void zsocket_set_ipv6 (void *zocket, int ipv6); -CZMQ_EXPORT void zsocket_set_immediate (void *zocket, int immediate); -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 3) -// Get socket options -CZMQ_EXPORT int zsocket_ipv4only (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_sndhwm (void *zocket); -CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); -CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); -CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); -CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); -CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); -CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); -CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); -CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); -CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); -CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); -CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); -CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); -CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); -#endif - -#if (ZMQ_VERSION_MAJOR == 2) -// Get socket options -CZMQ_EXPORT int zsocket_hwm (void *zocket); -CZMQ_EXPORT int zsocket_swap (void *zocket); -CZMQ_EXPORT int zsocket_affinity (void *zocket); -CZMQ_EXPORT char * zsocket_identity (void *zocket); -CZMQ_EXPORT int zsocket_rate (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); -CZMQ_EXPORT int zsocket_recovery_ivl_msec (void *zocket); -CZMQ_EXPORT int zsocket_mcast_loop (void *zocket); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); -# endif -CZMQ_EXPORT int zsocket_sndbuf (void *zocket); -CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); -CZMQ_EXPORT int zsocket_linger (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); -CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); -CZMQ_EXPORT int zsocket_backlog (void *zocket); -CZMQ_EXPORT int zsocket_type (void *zocket); -CZMQ_EXPORT int zsocket_rcvmore (void *zocket); -CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); -CZMQ_EXPORT int zsocket_events (void *zocket); - -// Set socket options -CZMQ_EXPORT void zsocket_set_hwm (void *zocket, int hwm); -CZMQ_EXPORT void zsocket_set_swap (void *zocket, int swap); -CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); -CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); -CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); -CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); -CZMQ_EXPORT void zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec); -CZMQ_EXPORT void zsocket_set_mcast_loop (void *zocket, int mcast_loop); -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); -# endif -# if (ZMQ_VERSION_MINOR == 2) -CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); -# endif -CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); -CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); -CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); -CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); -CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); -CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); -CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); -CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); -#endif - -// Self test of this class -CZMQ_EXPORT void zsockopt_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zstr.h b/phonelibs/zmq/arm/include/zstr.h deleted file mode 100644 index 3d3f1a862a..0000000000 --- a/phonelibs/zmq/arm/include/zstr.h +++ /dev/null @@ -1,115 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @ignore -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zsys.h b/phonelibs/zmq/arm/include/zsys.h deleted file mode 100644 index 97f88a9555..0000000000 --- a/phonelibs/zmq/arm/include/zsys.h +++ /dev/null @@ -1,386 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zthread.h b/phonelibs/zmq/arm/include/zthread.h deleted file mode 100644 index fc0602dd9f..0000000000 --- a/phonelibs/zmq/arm/include/zthread.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ========================================================================= - zthread - working with system threads (deprecated) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZTHREAD_H_INCLUDED__ -#define __ZTHREAD_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Detached threads follow POSIX pthreads API -typedef void *(zthread_detached_fn) (void *args); - -// Attached threads get context and pipe from parent -typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe); - -// Create a detached thread. A detached thread operates autonomously -// and is used to simulate a separate process. It gets no ctx, and no -// pipe. -CZMQ_EXPORT int - zthread_new (zthread_detached_fn *thread_fn, void *args); - -// Create an attached thread. An attached thread gets a ctx and a PAIR -// pipe back to its parent. It must monitor its pipe, and exit if the -// pipe becomes unreadable. Do not destroy the ctx, the thread does this -// automatically when it ends. -CZMQ_EXPORT void * - zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args); - -// Self test of this class -CZMQ_EXPORT void - zthread_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/ztimerset.h b/phonelibs/zmq/arm/include/ztimerset.h deleted file mode 100644 index 29633fafdb..0000000000 --- a/phonelibs/zmq/arm/include/ztimerset.h +++ /dev/null @@ -1,90 +0,0 @@ -/* ========================================================================= - ztimerset - timer set - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTIMERSET_H_INCLUDED -#define ZTIMERSET_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztimerset.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set. Returns timer id if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer. Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval. -// Should be used as timeout parameter for the zpoller wait method. -// The timeout is in msec. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed. -// Should be call after zpoller wait method. -// Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/ztrie.h b/phonelibs/zmq/arm/include/ztrie.h deleted file mode 100644 index 6fd53234b1..0000000000 --- a/phonelibs/zmq/arm/include/ztrie.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ========================================================================= - ztrie - simple trie for tokenizable strings - - Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com - Copyright other contributors as noted in the AUTHORS file. - - This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTRIE_H_INCLUDED -#define ZTRIE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztrie.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data. Returns -1 -// if the route already exists, otherwise 0. This method takes ownership of -// the provided data if a destroy_data_fn is provided. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data. Returns -1 if the -// route does not exists, otherwise 0. -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches. If the path -// did not match, returns NULL. Do not delete the data as it's owned by -// ztrie. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches. If the path did not match or the route did not contain any -// named regexes, returns NULL. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/include/zuuid.h b/phonelibs/zmq/arm/include/zuuid.h deleted file mode 100644 index afc1104fea..0000000000 --- a/phonelibs/zmq/arm/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/arm/lib/libczmq.a b/phonelibs/zmq/arm/lib/libczmq.a deleted file mode 100644 index cb78e4b829..0000000000 Binary files a/phonelibs/zmq/arm/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/arm/lib/libczmq.so b/phonelibs/zmq/arm/lib/libczmq.so deleted file mode 100755 index 87ee937f72..0000000000 Binary files a/phonelibs/zmq/arm/lib/libczmq.so and /dev/null differ diff --git a/phonelibs/zmq/arm/lib/libzmq.a b/phonelibs/zmq/arm/lib/libzmq.a deleted file mode 100644 index cd523cd73e..0000000000 Binary files a/phonelibs/zmq/arm/lib/libzmq.a and /dev/null differ diff --git a/phonelibs/zmq/arm/lib/libzmq.so b/phonelibs/zmq/arm/lib/libzmq.so deleted file mode 100755 index 27ec72d7bc..0000000000 Binary files a/phonelibs/zmq/arm/lib/libzmq.so and /dev/null differ diff --git a/phonelibs/zmq/build.sh b/phonelibs/zmq/build.sh deleted file mode 100755 index 8c4d9a50f1..0000000000 --- a/phonelibs/zmq/build.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -set -e - -# aarch64 is actually built natively and copied in... - -SED=gsed - -git clone --depth 1 -b v4.2.2 git://github.com/zeromq/libzmq.git libzmq -git clone --depth 1 -b v4.0.2 git://github.com/zeromq/czmq.git czmq - -$SED -i 's/defined .HAVE_GETIFADDRS./0/' czmq/src/ziflist.c - -LIBZMQ_ROOT=$HOME/one/phonelibs/zmq/libzmq - -export ANDROID_NDK_ROOT=/opt/android-ndk - -export ANDROID_BUILD_EXTRA_CFLAGS='-std=gnu99 -O2' -export ANDROID_BUILD_EXTRA_CXXFLAGS='-O2' - -######## arm - -export TOOLCHAIN_PATH=${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin -export TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -export TOOLCHAIN_HOST=arm-linux-androideabi -export TOOLCHAIN_ARCH=arm -cd czmq/builds/android -./build.sh -cd ../../../ -cp czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libczmq.a \ - czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libczmq.so \ - czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libzmq.a \ - czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libzmq.so ./arm/lib/ -cp czmq/builds/android/prefix/arm-linux-androideabi-4.9/include/*.h ./arm/include/ - - -######## aarch64 - -(cd libzmq && patch -p0 <../build_aarch64.patch) -(cd czmq && patch -p0 <../build_aarch64.patch) - -# android-9 lacks aarch64. -$SED -i 's/android-9/android-24/' *zmq/builds/android/android_build_helper.sh -# For some reason gcc doesn't work for aarch64, but g++ does. -$SED -i 's/-lgnustl_shared/-l:libgnustl_static.a/' *zmq/builds/android/android_build_helper.sh - -export TOOLCHAIN_PATH=${ANDROID_NDK_ROOT}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin -export TOOLCHAIN_NAME=aarch64-linux-android-4.9 -export TOOLCHAIN_HOST=aarch64-linux-android -export TOOLCHAIN_ARCH=arm64 -cd czmq/builds/android -./build.sh -cd ../../../ -cp czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libczmq.a \ - czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libczmq.so \ - czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.a \ - czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.so ./aarch64/lib/ -cp czmq/builds/android/prefix/aarch64-linux-android-4.9/include/*.h ./aarch64/include/ - -# rm -rf czmq -echo SUCCESS diff --git a/phonelibs/zmq/build_aarch64.patch b/phonelibs/zmq/build_aarch64.patch deleted file mode 100644 index d689b99c51..0000000000 --- a/phonelibs/zmq/build_aarch64.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git builds/android/android_build_helper.sh builds/android/android_build_helper.sh -index 6263f70..d0b24c3 100755 ---- builds/android/android_build_helper.sh -+++ builds/android/android_build_helper.sh -@@ -202,6 +202,10 @@ function _android_build_opts_process_cxx_stl { - LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips" - CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips/include" - ;; -+ arm64) -+ LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a" -+ CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include" -+ ;; - *) - ANDROID_BUILD_FAIL+=("Unknown combination for ANDROID_BUILD_CXXSTL and TOOLCHAIN_ARCH") - ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXXSTL}") diff --git a/phonelibs/zmq/build_linux.txt b/phonelibs/zmq/build_linux.txt deleted file mode 100644 index 54e3b2a340..0000000000 --- a/phonelibs/zmq/build_linux.txt +++ /dev/null @@ -1,7 +0,0 @@ -https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz -./configure --prefix="this_thingy" -make -j4 -make install - -czmq -see ~/one/external/zmq/build_czmq.sh diff --git a/phonelibs/zmq/mac/lib/libczmq.a b/phonelibs/zmq/mac/lib/libczmq.a deleted file mode 100644 index 061f2afabd..0000000000 Binary files a/phonelibs/zmq/mac/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/mac/lib/libczmq.dylib b/phonelibs/zmq/mac/lib/libczmq.dylib deleted file mode 100644 index 50d2167e9c..0000000000 Binary files a/phonelibs/zmq/mac/lib/libczmq.dylib and /dev/null differ diff --git a/phonelibs/zmq/mac/lib/libzmq.a b/phonelibs/zmq/mac/lib/libzmq.a deleted file mode 100644 index 3365d42e87..0000000000 Binary files a/phonelibs/zmq/mac/lib/libzmq.a and /dev/null differ diff --git a/phonelibs/zmq/mac/lib/libzmq.dylib b/phonelibs/zmq/mac/lib/libzmq.dylib deleted file mode 100755 index 19b7514960..0000000000 Binary files a/phonelibs/zmq/mac/lib/libzmq.dylib and /dev/null differ diff --git a/phonelibs/zmq/x64/include/czmq.h b/phonelibs/zmq/x64/include/czmq.h deleted file mode 100644 index dbf1fe5e40..0000000000 --- a/phonelibs/zmq/x64/include/czmq.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= - - "Tell them I was a writer. - A maker of software. - A humanist. A father. - And many things. - But above all, a writer. - Thank You. :) - - Pieter Hintjens -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/phonelibs/zmq/x64/include/czmq_library.h b/phonelibs/zmq/x64/include/czmq_library.h deleted file mode 100644 index 89dc4eb917..0000000000 --- a/phonelibs/zmq/x64/include/czmq_library.h +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 4 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 2 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -# define CZMQ_PRIVATE -#else -# define CZMQ_EXPORT -# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden"))) -# else -# define CZMQ_PRIVATE -# endif -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/phonelibs/zmq/x64/include/czmq_prelude.h b/phonelibs/zmq/x64/include/czmq_prelude.h deleted file mode 100644 index 534f47023c..0000000000 --- a/phonelibs/zmq/x64/include/czmq_prelude.h +++ /dev/null @@ -1,647 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0600) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -// Note that (at least in Solaris) while rand() returns an int limited by -// RAND_MAX, random() returns a 32-bit value all filled with random bits. -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# if defined(RAND_MAX) -# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0)) -# else -# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0)) -# endif -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC) -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zactor.h b/phonelibs/zmq/x64/include/zactor.h deleted file mode 100644 index c865c65daf..0000000000 --- a/phonelibs/zmq/x64/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zarmour.h b/phonelibs/zmq/x64/include/zarmour.h deleted file mode 100644 index c7f299f7af..0000000000 --- a/phonelibs/zmq/x64/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zauth.h b/phonelibs/zmq/x64/include/zauth.h deleted file mode 100644 index 3e0e59ecab..0000000000 --- a/phonelibs/zmq/x64/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or more addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zbeacon.h b/phonelibs/zmq/x64/include/zbeacon.h deleted file mode 100644 index 78917e9577..0000000000 --- a/phonelibs/zmq/x64/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zcert.h b/phonelibs/zmq/x64/include/zcert.h deleted file mode 100644 index 3161bc0596..0000000000 --- a/phonelibs/zmq/x64/include/zcert.h +++ /dev/null @@ -1,128 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/phonelibs/zmq/x64/include/zcertstore.h b/phonelibs/zmq/x64/include/zcertstore.h deleted file mode 100644 index 689b228ac1..0000000000 --- a/phonelibs/zmq/x64/include/zcertstore.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/phonelibs/zmq/x64/include/zchunk.h b/phonelibs/zmq/x64/include/zchunk.h deleted file mode 100644 index 56f29b161a..0000000000 --- a/phonelibs/zmq/x64/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/x64/include/zclock.h b/phonelibs/zmq/x64/include/zclock.h deleted file mode 100644 index eb064162c4..0000000000 --- a/phonelibs/zmq/x64/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zconfig.h b/phonelibs/zmq/x64/include/zconfig.h deleted file mode 100644 index df0c708493..0000000000 --- a/phonelibs/zmq/x64/include/zconfig.h +++ /dev/null @@ -1,185 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/phonelibs/zmq/x64/include/zdigest.h b/phonelibs/zmq/x64/include/zdigest.h deleted file mode 100644 index def9e86053..0000000000 --- a/phonelibs/zmq/x64/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zdir.h b/phonelibs/zmq/x64/include/zdir.h deleted file mode 100644 index 6c5551b57e..0000000000 --- a/phonelibs/zmq/x64/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/phonelibs/zmq/x64/include/zdir_patch.h b/phonelibs/zmq/x64/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb4..0000000000 --- a/phonelibs/zmq/x64/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zfile.h b/phonelibs/zmq/x64/include/zfile.h deleted file mode 100644 index 75c35774b9..0000000000 --- a/phonelibs/zmq/x64/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/x64/include/zframe.h b/phonelibs/zmq/x64/include/zframe.h deleted file mode 100644 index 728093c36c..0000000000 --- a/phonelibs/zmq/x64/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zgossip.h b/phonelibs/zmq/x64/include/zgossip.h deleted file mode 100644 index 647cb28c08..0000000000 --- a/phonelibs/zmq/x64/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zhash.h b/phonelibs/zmq/x64/include/zhash.h deleted file mode 100644 index 138adf63ac..0000000000 --- a/phonelibs/zmq/x64/include/zhash.h +++ /dev/null @@ -1,182 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zhashx.h b/phonelibs/zmq/x64/include/zhashx.h deleted file mode 100644 index 360a773ee8..0000000000 --- a/phonelibs/zmq/x64/include/zhashx.h +++ /dev/null @@ -1,277 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ziflist.h b/phonelibs/zmq/x64/include/ziflist.h deleted file mode 100644 index cb2b144802..0000000000 --- a/phonelibs/zmq/x64/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zlist.h b/phonelibs/zmq/x64/include/zlist.h deleted file mode 100644 index 1dcd39b995..0000000000 --- a/phonelibs/zmq/x64/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zlistx.h b/phonelibs/zmq/x64/include/zlistx.h deleted file mode 100644 index 512637cef3..0000000000 --- a/phonelibs/zmq/x64/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zloop.h b/phonelibs/zmq/x64/include/zloop.h deleted file mode 100644 index 83f46f282a..0000000000 --- a/phonelibs/zmq/x64/include/zloop.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmonitor.h b/phonelibs/zmq/x64/include/zmonitor.h deleted file mode 100644 index b490bcb1a0..0000000000 --- a/phonelibs/zmq/x64/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmq.h b/phonelibs/zmq/x64/include/zmq.h deleted file mode 100644 index 21a78eb657..0000000000 --- a/phonelibs/zmq/x64/include/zmq.h +++ /dev/null @@ -1,643 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 2 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - -// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it -// defines compatibility macros for them. Need to include that header first to -// stop build failures since zmq_pollset_t defines them as events and revents. -#ifdef ZMQ_HAVE_AIX - #include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer - * alignment and raise sigbus on violations. Make sure applications allocate - * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. - */ -typedef struct zmq_msg_t { -#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ - (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); -#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) - __declspec (align (8)) unsigned char _ [64]; -#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) - __declspec (align (4)) unsigned char _ [64]; -#else - unsigned char _ [64]; -#endif -} zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT 0MQ socket events and monitoring */ -#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 -#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 - -/* DRAFT Context options */ -#define ZMQ_MSG_T_SIZE 6 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); -ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmq_utils.h b/phonelibs/zmq/x64/include/zmq_utils.h deleted file mode 100644 index f29638d553..0000000000 --- a/phonelibs/zmq/x64/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/phonelibs/zmq/x64/include/zmsg.h b/phonelibs/zmq/x64/include/zmsg.h deleted file mode 100644 index d8a84d1f41..0000000000 --- a/phonelibs/zmq/x64/include/zmsg.h +++ /dev/null @@ -1,280 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/phonelibs/zmq/x64/include/zpoller.h b/phonelibs/zmq/x64/include/zpoller.h deleted file mode 100644 index 3b394c3516..0000000000 --- a/phonelibs/zmq/x64/include/zpoller.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/x64/include/zproc.h b/phonelibs/zmq/x64/include/zproc.h deleted file mode 100644 index 4fd3fcf445..0000000000 --- a/phonelibs/zmq/x64/include/zproc.h +++ /dev/null @@ -1,168 +0,0 @@ -/* ========================================================================= - zproc - process configuration and status - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZPROC_H_INCLUDED -#define ZPROC_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zproc.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal. -// It is good practice to use this method to exit any infinite loop -// processing messages. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints. -// If the host name is not resolvable, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background. The precise effect -// depends on the operating system. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there -// was an error. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user. Any of the -// arguments may be null, indicating a no-op. Returns 0 on success, -// -1 on failure. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition - highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition - high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log informational message - low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zproxy.h b/phonelibs/zmq/x64/include/zproxy.h deleted file mode 100644 index f672c5e724..0000000000 --- a/phonelibs/zmq/x64/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zrex.h b/phonelibs/zmq/x64/include/zrex.h deleted file mode 100644 index 8b50618a34..0000000000 --- a/phonelibs/zmq/x64/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zsock.h b/phonelibs/zmq/x64/include/zsock.h deleted file mode 100644 index 9ab060d6a3..0000000000 --- a/phonelibs/zmq/x64/include/zsock.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32-octet binary -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef CZMQ_BUILD_DRAFT_API -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); -#endif // CZMQ_BUILD_DRAFT_API - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zstr.h b/phonelibs/zmq/x64/include/zstr.h deleted file mode 100644 index 67f2f852b6..0000000000 --- a/phonelibs/zmq/x64/include/zstr.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zsys.h b/phonelibs/zmq/x64/include/zsys.h deleted file mode 100644 index 200271d924..0000000000 --- a/phonelibs/zmq/x64/include/zsys.h +++ /dev/null @@ -1,395 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent. -// The default is INT_MAX. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ztimerset.h b/phonelibs/zmq/x64/include/ztimerset.h deleted file mode 100644 index 29633fafdb..0000000000 --- a/phonelibs/zmq/x64/include/ztimerset.h +++ /dev/null @@ -1,90 +0,0 @@ -/* ========================================================================= - ztimerset - timer set - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTIMERSET_H_INCLUDED -#define ZTIMERSET_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztimerset.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set. Returns timer id if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer. Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval. -// Should be used as timeout parameter for the zpoller wait method. -// The timeout is in msec. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed. -// Should be call after zpoller wait method. -// Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ztrie.h b/phonelibs/zmq/x64/include/ztrie.h deleted file mode 100644 index 6fd53234b1..0000000000 --- a/phonelibs/zmq/x64/include/ztrie.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ========================================================================= - ztrie - simple trie for tokenizable strings - - Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com - Copyright other contributors as noted in the AUTHORS file. - - This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTRIE_H_INCLUDED -#define ZTRIE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztrie.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data. Returns -1 -// if the route already exists, otherwise 0. This method takes ownership of -// the provided data if a destroy_data_fn is provided. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data. Returns -1 if the -// route does not exists, otherwise 0. -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches. If the path -// did not match, returns NULL. Do not delete the data as it's owned by -// ztrie. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches. If the path did not match or the route did not contain any -// named regexes, returns NULL. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zuuid.h b/phonelibs/zmq/x64/include/zuuid.h deleted file mode 100644 index afc1104fea..0000000000 --- a/phonelibs/zmq/x64/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/lib/libczmq.a b/phonelibs/zmq/x64/lib/libczmq.a deleted file mode 100644 index 9045eb980e..0000000000 Binary files a/phonelibs/zmq/x64/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libczmq.la b/phonelibs/zmq/x64/lib/libczmq.la deleted file mode 100755 index 8e4a9ee364..0000000000 --- a/phonelibs/zmq/x64/lib/libczmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libczmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libczmq.so.4' - -# Names of this library. -library_names='libczmq.so.4.0.2 libczmq.so.4 libczmq.so' - -# The name of the static archive. -old_library='libczmq.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -L/home/batman/one/external/zmq/lib -L/usr/local/lib /home/batman/one/external/zmq/lib/libzmq.la -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libczmq. -current=4 -age=0 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/phonelibs/zmq/x64/lib/libczmq.so b/phonelibs/zmq/x64/lib/libczmq.so deleted file mode 120000 index db9aa60f9b..0000000000 --- a/phonelibs/zmq/x64/lib/libczmq.so +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libczmq.so.4 b/phonelibs/zmq/x64/lib/libczmq.so.4 deleted file mode 120000 index db9aa60f9b..0000000000 --- a/phonelibs/zmq/x64/lib/libczmq.so.4 +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 b/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 deleted file mode 100755 index eaf4cce8b9..0000000000 Binary files a/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libzmq.a b/phonelibs/zmq/x64/lib/libzmq.a deleted file mode 100644 index 28c77cc36e..0000000000 Binary files a/phonelibs/zmq/x64/lib/libzmq.a and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libzmq.la b/phonelibs/zmq/x64/lib/libzmq.la deleted file mode 100644 index 69652b3463..0000000000 --- a/phonelibs/zmq/x64/lib/libzmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/phonelibs/zmq/x64/lib/libzmq.lai b/phonelibs/zmq/x64/lib/libzmq.lai deleted file mode 100644 index 93c1a83dc3..0000000000 --- a/phonelibs/zmq/x64/lib/libzmq.lai +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib' diff --git a/phonelibs/zmq/x64/lib/libzmq.so b/phonelibs/zmq/x64/lib/libzmq.so deleted file mode 120000 index ef44cafc6a..0000000000 --- a/phonelibs/zmq/x64/lib/libzmq.so +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libzmq.so.5 b/phonelibs/zmq/x64/lib/libzmq.so.5 deleted file mode 120000 index ef44cafc6a..0000000000 --- a/phonelibs/zmq/x64/lib/libzmq.so.5 +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 b/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 deleted file mode 100755 index e08e8c2dfb..0000000000 Binary files a/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc b/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc deleted file mode 100644 index b6fb3dc133..0000000000 --- a/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libczmq -Description: The high-level C binding for 0MQ -Version: 4.0.2 - -Requires:libzmq - -Libs: -L${libdir} -lczmq -Cflags: -I${includedir} -Libs.private: -L/usr/local/lib -lzmq - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ diff --git a/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc b/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc deleted file mode 100644 index aba3d3a75e..0000000000 --- a/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libzmq -Description: 0MQ c++ library -Version: 4.2.2 -Libs: -L${libdir} -lzmq -Cflags: -I${includedir} diff --git a/release/files_common b/release/files_common index c2c5d50ee5..12e0ec978f 100644 --- a/release/files_common +++ b/release/files_common @@ -407,8 +407,6 @@ phonelibs/boringssl/* phonelibs/bzip2/* phonelibs/openmax/** -phonelibs/zmq/aarch64/lib/* - phonelibs/json11/json11.cpp phonelibs/json11/json11.hpp @@ -420,8 +418,6 @@ phonelibs/libyuv/lib/** phonelibs/snpe/include/** phonelibs/snpe/aarch64** -phonelibs/fastcv/aarch64/** - phonelibs/android_frameworks_native/** phonelibs/android_hardware_libhardware/** phonelibs/android_system_core/** diff --git a/selfdrive/boardd/boardd_setup.py b/selfdrive/boardd/boardd_setup.py index 5956c11a52..cf71901cb6 100644 --- a/selfdrive/boardd/boardd_setup.py +++ b/selfdrive/boardd/boardd_setup.py @@ -1,5 +1,4 @@ import subprocess -import platform from distutils.core import Extension, setup from Cython.Build import cythonize @@ -11,20 +10,7 @@ import os PHONELIBS = os.path.join(BASEDIR, 'phonelibs') ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() - -if ARCH == "x86_64": - if platform.system() == "Darwin": - libraries = ['can_list_to_can_capnp', 'capnp', 'kj'] - ARCH_DIR = 'mac' - else: - libraries = [':libcan_list_to_can_capnp.a', ':libcapnp.a', ':libkj.a'] - ARCH_DIR = 'x64' -else: - libraries = [':libcan_list_to_can_capnp.a', 'capnp', 'kj'] - if os.path.isdir("/system"): - ARCH_DIR = 'aarch64' - else: - ARCH_DIR = 'larch64' +libraries = ['can_list_to_can_capnp', 'capnp', 'kj'] setup(name='Boardd API Implementation', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, @@ -34,7 +20,6 @@ setup(name='Boardd API Implementation', libraries=libraries, library_dirs=[ './', - PHONELIBS + '/capnp-cpp/' + ARCH_DIR + '/lib/', ], sources=['boardd_api_impl.pyx'], language="c++", diff --git a/selfdrive/modeld/models/dmonitoring.cc b/selfdrive/modeld/models/dmonitoring.cc index 7e8d635101..41de617ad6 100644 --- a/selfdrive/modeld/models/dmonitoring.cc +++ b/selfdrive/modeld/models/dmonitoring.cc @@ -3,7 +3,6 @@ #include "common/mat.h" #include "common/timing.h" -// #include #include #define MODEL_WIDTH 160 diff --git a/tools/ubuntu_setup.sh b/tools/ubuntu_setup.sh index 85bccf7d65..a70def87a2 100755 --- a/tools/ubuntu_setup.sh +++ b/tools/ubuntu_setup.sh @@ -4,6 +4,8 @@ sudo apt-get update && sudo apt-get install -y \ autoconf \ build-essential \ bzip2 \ + capnproto \ + libcapnp-dev \ clang \ cmake \ curl \ @@ -29,7 +31,8 @@ sudo apt-get update && sudo apt-get install -y \ libsqlite3-dev \ libtool \ libusb-1.0-0-dev \ - libzmq5-dev \ + libzmq3-dev \ + libczmq-dev \ locales \ ocl-icd-libopencl1 \ ocl-icd-opencl-dev \